[llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineInstr.h

Chris Lattner lattner at cs.uiuc.edu
Thu May 4 10:52:41 PDT 2006



Changes in directory llvm/include/llvm/CodeGen:

MachineInstr.h updated: 1.174 -> 1.175
---
Log message:

Move some methods out of MachineInstr into MachineOperand


---
Diffs of the changes:  (+17 -10)

 MachineInstr.h |   27 +++++++++++++++++----------
 1 files changed, 17 insertions(+), 10 deletions(-)


Index: llvm/include/llvm/CodeGen/MachineInstr.h
diff -u llvm/include/llvm/CodeGen/MachineInstr.h:1.174 llvm/include/llvm/CodeGen/MachineInstr.h:1.175
--- llvm/include/llvm/CodeGen/MachineInstr.h:1.174	Thu May  4 12:21:19 2006
+++ llvm/include/llvm/CodeGen/MachineInstr.h	Thu May  4 12:52:22 2006
@@ -234,7 +234,7 @@
     extra.regNum = Reg;
   }
 
-  void setImmedValue(int immVal) {
+  void setImmedValue(int64_t immVal) {
     assert(isImmediate() && "Wrong MachineOperand mutator");
     contents.immedVal = immVal;
   }
@@ -245,6 +245,22 @@
         "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 @@
   //===--------------------------------------------------------------------===//
   // 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 @@
   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);
 };
 
 //===----------------------------------------------------------------------===//






More information about the llvm-commits mailing list