diff options
author | Chris Lattner <sabre@nondot.org> | 2006-05-04 17:52:23 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-05-04 17:52:23 +0000 |
commit | e53f4a055f74bded20d6129b4724ddd17fd199f6 (patch) | |
tree | 298e99166cc5b20f68b64050b71a6d3dcf21f4ad /include/llvm/CodeGen/MachineInstr.h | |
parent | e3158308e0d51ce5c2624529e85c9a6be8f5ff46 (diff) | |
download | llvm-e53f4a055f74bded20d6129b4724ddd17fd199f6.tar.gz llvm-e53f4a055f74bded20d6129b4724ddd17fd199f6.tar.bz2 llvm-e53f4a055f74bded20d6129b4724ddd17fd199f6.tar.xz |
Move some methods out of MachineInstr into MachineOperand
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28102 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen/MachineInstr.h')
-rw-r--r-- | include/llvm/CodeGen/MachineInstr.h | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/include/llvm/CodeGen/MachineInstr.h b/include/llvm/CodeGen/MachineInstr.h index bd23b5ad22..239f879727 100644 --- a/include/llvm/CodeGen/MachineInstr.h +++ b/include/llvm/CodeGen/MachineInstr.h @@ -234,7 +234,7 @@ public: extra.regNum = Reg; } - void setImmedValue(int immVal) { + void setImmedValue(int64_t immVal) { assert(isImmediate() && "Wrong MachineOperand mutator"); contents.immedVal = immVal; } @@ -245,6 +245,22 @@ public: "Wrong MachineOperand accessor"); extra.offset = Offset; } + + /// ChangeToImmediate - Replace this operand with a new immediate operand of + /// the specified value. If an operand is known to be an immediate already, + /// the setImmedValue method should be used. + void ChangeToImmediate(int64_t ImmVal) { + opType = MO_Immediate; + contents.immedVal = ImmVal; + } + + /// ChangeToRegister - Replace this operand with a new register operand of + /// the specified value. If an operand is known to be an register already, + /// the setReg method should be used. + void ChangeToRegister(unsigned Reg) { + opType = MO_VirtualRegister; + extra.regNum = Reg; + } friend std::ostream& operator<<(std::ostream& os, const MachineOperand& mop); @@ -436,7 +452,6 @@ public: //===--------------------------------------------------------------------===// // Accessors used to modify instructions in place. // - // FIXME: Move this stuff to MachineOperand itself! /// setOpcode - Replace the opcode of the current instruction with a new one. /// @@ -448,14 +463,6 @@ public: void RemoveOperand(unsigned i) { operands.erase(operands.begin()+i); } - - // Access to set the operands when building the machine instruction - // - void SetMachineOperandConst(unsigned i, - MachineOperand::MachineOperandType operandType, - int intValue); - - void SetMachineOperandReg(unsigned i, int regNum); }; //===----------------------------------------------------------------------===// |