diff options
| author | Chris Lattner <sabre@nondot.org> | 2002-12-25 05:00:49 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2002-12-25 05:00:49 +0000 |
| commit | 21d48e8f2c7474546ff151bca69ff86a994cc708 (patch) | |
| tree | abdc608d53fd09e0f7fd7c8a9a1533ccba5ea501 | |
| parent | 6e6c6eda24079f3a4b023d0ffa6a07c486120bc4 (diff) | |
| download | bcm5719-llvm-21d48e8f2c7474546ff151bca69ff86a994cc708.tar.gz bcm5719-llvm-21d48e8f2c7474546ff151bca69ff86a994cc708.zip | |
*** empty log message ***
llvm-svn: 5138
| -rw-r--r-- | llvm/include/llvm/CodeGen/MachineInstr.h | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/llvm/include/llvm/CodeGen/MachineInstr.h b/llvm/include/llvm/CodeGen/MachineInstr.h index b173d6a5505..a7e00f72275 100644 --- a/llvm/include/llvm/CodeGen/MachineInstr.h +++ b/llvm/include/llvm/CodeGen/MachineInstr.h @@ -80,6 +80,7 @@ public: MO_UnextendedImmed, MO_PCRelativeDisp, MO_MachineBasicBlock, // MachineBasicBlock reference + MO_FrameIndex, // Abstract Stack Frame Index }; private: @@ -182,28 +183,27 @@ public: bool isImmediate() const { return opType == MO_SignExtendedImmed || opType == MO_UnextendedImmed; } + bool isFrameIndex() const { return opType == MO_FrameIndex; } - inline Value* getVRegValue () const { + Value* getVRegValue() const { assert(opType == MO_VirtualRegister || opType == MO_CCRegister || - opType == MO_PCRelativeDisp); + isPCRelativeDisp()); return value; } - inline Value* getVRegValueOrNull() const { + Value* getVRegValueOrNull() const { return (opType == MO_VirtualRegister || opType == MO_CCRegister || - opType == MO_PCRelativeDisp)? value : NULL; + isPCRelativeDisp()) ? value : NULL; } - inline int getMachineRegNum() const { + int getMachineRegNum() const { assert(opType == MO_MachineRegister); return regNum; } - inline int64_t getImmedValue () const { - assert(isImmediate()); - return immedVal; - } + int64_t getImmedValue() const { assert(isImmediate()); return immedVal; } MachineBasicBlock *getMachineBasicBlock() const { assert(isMachineBasicBlock() && "Can't get MBB in non-MBB operand!"); return MBB; } + unsigned getFrameIndex() const { assert(isFrameIndex()); return immedVal; } bool opIsUse () const { return (flags & USEDEFMASK) == 0; } bool opIsDef () const { return flags & DEFFLAG; } @@ -214,20 +214,20 @@ public: bool opLoBits64 () const { return flags & LOFLAG64; } // used to check if a machine register has been allocated to this operand - inline bool hasAllocatedReg() const { + bool hasAllocatedReg() const { return (regNum >= 0 && (opType == MO_VirtualRegister || opType == MO_CCRegister || opType == MO_MachineRegister)); } // used to get the reg number if when one is allocated - inline int getAllocatedRegNum() const { + int getAllocatedRegNum() const { assert(opType == MO_VirtualRegister || opType == MO_CCRegister || opType == MO_MachineRegister); return regNum; } - inline unsigned getReg() const { + unsigned getReg() const { assert(hasAllocatedReg() && "Cannot call MachineOperand::getReg()!"); return regNum; } @@ -511,6 +511,14 @@ public: operands.push_back(MachineOperand(MBB)); } + /// addFrameIndexOperand - Add an abstract frame index to the instruction + /// + void addFrameIndexOperand(unsigned Idx) { + assert(!OperandsComplete() && + "Trying to add an operand to a machine instr that is already done!"); + operands.push_back(MachineOperand(Idx, MachineOperand::MO_FrameIndex)); + } + unsigned substituteValue(const Value* oldVal, Value* newVal, bool defsOnly = true); |

