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

Chris Lattner lattner at cs.uiuc.edu
Thu May 4 11:06:05 PDT 2006



Changes in directory llvm/include/llvm/CodeGen:

MachineInstr.h updated: 1.176 -> 1.177
MachineInstrBuilder.h updated: 1.34 -> 1.35
---
Log message:

Rename MO_VirtualRegister -> MO_Register.  Clean up immediate handling.


---
Diffs of the changes:  (+19 -34)

 MachineInstr.h        |   45 +++++++++++++++------------------------------
 MachineInstrBuilder.h |    8 ++++----
 2 files changed, 19 insertions(+), 34 deletions(-)


Index: llvm/include/llvm/CodeGen/MachineInstr.h
diff -u llvm/include/llvm/CodeGen/MachineInstr.h:1.176 llvm/include/llvm/CodeGen/MachineInstr.h:1.177
--- llvm/include/llvm/CodeGen/MachineInstr.h:1.176	Thu May  4 12:56:20 2006
+++ llvm/include/llvm/CodeGen/MachineInstr.h	Thu May  4 13:05:42 2006
@@ -61,7 +61,7 @@
   };
 
   enum MachineOperandType {
-    MO_VirtualRegister,         // virtual register for *value
+    MO_Register,                // Register operand.
     MO_Immediate,               // Immediate Operand
     MO_MachineBasicBlock,       // MachineBasicBlock reference
     MO_FrameIndex,              // Abstract Stack Frame Index
@@ -93,12 +93,17 @@
     extra.offset = 0;
   }
 
-  MachineOperand(int64_t ImmVal, MachineOperandType OpTy, int Offset = 0)
-    : flags(0), opType(OpTy) {
+  MachineOperand(int64_t ImmVal) : flags(0), opType(MO_Immediate) {
     contents.immedVal = ImmVal;
-    extra.offset = Offset;
+    extra.offset = 0;
   }
 
+  MachineOperand(unsigned Idx, MachineOperandType OpTy)
+    : flags(0), opType(OpTy) {
+    contents.immedVal = Idx;
+    extra.offset = 0;
+  }
+  
   MachineOperand(int Reg, MachineOperandType OpTy, UseType UseTy)
     : flags(UseTy), opType(OpTy) {
     zeroContents();
@@ -152,7 +157,7 @@
 
   /// Accessors that tell you what kind of MachineOperand you're looking at.
   ///
-  bool isRegister() const { return opType == MO_VirtualRegister; }
+  bool isRegister() const { return opType == MO_Register; }
   bool isImmediate() const { return opType == MO_Immediate; }
   bool isMachineBasicBlock() const { return opType == MO_MachineBasicBlock; }
   bool isFrameIndex() const { return opType == MO_FrameIndex; }
@@ -245,7 +250,7 @@
   /// 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;
+    opType = MO_Register;
     extra.regNum = Reg;
   }
 
@@ -355,41 +360,21 @@
 
   /// addRegOperand - Add a symbolic virtual register reference...
   ///
-  void addRegOperand(int reg, bool isDef) {
-    assert(!OperandsComplete() &&
-           "Trying to add an operand to a machine instr that is already done!");
-    operands.push_back(
-      MachineOperand(reg, MachineOperand::MO_VirtualRegister,
-                     isDef ? MachineOperand::Def : MachineOperand::Use));
-  }
-
-  /// addRegOperand - Add a symbolic virtual register reference...
-  ///
   void addRegOperand(int reg,
                      MachineOperand::UseType UTy = MachineOperand::Use) {
     assert(!OperandsComplete() &&
            "Trying to add an operand to a machine instr that is already done!");
     operands.push_back(
-      MachineOperand(reg, MachineOperand::MO_VirtualRegister, UTy));
+      MachineOperand(reg, MachineOperand::MO_Register, UTy));
   }
 
-  /// addZeroExtImmOperand - Add a zero extended constant argument to the
+  /// addImmOperand - Add a zero extended constant argument to the
   /// machine instruction.
   ///
-  void addZeroExtImmOperand(int intValue) {
-    assert(!OperandsComplete() &&
-           "Trying to add an operand to a machine instr that is already done!");
-    operands.push_back(
-      MachineOperand(intValue, MachineOperand::MO_Immediate));
-  }
-
-  /// addZeroExtImm64Operand - Add a zero extended 64-bit constant argument
-  /// to the machine instruction.
-  ///
-  void addZeroExtImm64Operand(uint64_t intValue) {
+  void addImmOperand(int64_t Val) {
     assert(!OperandsComplete() &&
            "Trying to add an operand to a machine instr that is already done!");
-    operands.push_back(MachineOperand(intValue, MachineOperand::MO_Immediate));
+    operands.push_back(MachineOperand(Val));
   }
 
   void addMachineBasicBlockOperand(MachineBasicBlock *MBB) {


Index: llvm/include/llvm/CodeGen/MachineInstrBuilder.h
diff -u llvm/include/llvm/CodeGen/MachineInstrBuilder.h:1.34 llvm/include/llvm/CodeGen/MachineInstrBuilder.h:1.35
--- llvm/include/llvm/CodeGen/MachineInstrBuilder.h:1.34	Thu May  4 12:21:19 2006
+++ llvm/include/llvm/CodeGen/MachineInstrBuilder.h	Thu May  4 13:05:43 2006
@@ -42,22 +42,22 @@
 
   /// addImm - Add a new immediate operand.
   ///
-  const MachineInstrBuilder &addImm(int Val) const {
-    MI->addZeroExtImmOperand(Val);
+  const MachineInstrBuilder &addImm(int64_t Val) const {
+    MI->addImmOperand(Val);
     return *this;
   }
 
   /// addZImm - Add a new zero extended immediate operand...
   ///
   const MachineInstrBuilder &addZImm(unsigned Val) const {
-    MI->addZeroExtImmOperand(Val);
+    MI->addImmOperand(Val);
     return *this;
   }
 
   /// addImm64 - Add a new 64-bit immediate operand...
   ///
   const MachineInstrBuilder &addImm64(uint64_t Val) const {
-    MI->addZeroExtImm64Operand(Val);
+    MI->addImmOperand(Val);
     return *this;
   }
 






More information about the llvm-commits mailing list