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

Chris Lattner lattner at cs.uiuc.edu
Mon Jan 6 12:27:00 PST 2003


Changes in directory llvm/include/llvm/CodeGen:

MachineInstr.h updated: 1.94 -> 1.95

---
Log message:

* Add support for ConstantPool indices.
* Fix a bug where unassigned virtual registers were considered to be physical
  registers because they had regno -1



---
Diffs of the changes:

Index: llvm/include/llvm/CodeGen/MachineInstr.h
diff -u llvm/include/llvm/CodeGen/MachineInstr.h:1.94 llvm/include/llvm/CodeGen/MachineInstr.h:1.95
--- llvm/include/llvm/CodeGen/MachineInstr.h:1.94	Sat Dec 28 14:05:44 2002
+++ llvm/include/llvm/CodeGen/MachineInstr.h	Mon Jan  6 12:25:53 2003
@@ -81,6 +81,7 @@
     MO_PCRelativeDisp,
     MO_MachineBasicBlock,       // MachineBasicBlock reference
     MO_FrameIndex,              // Abstract Stack Frame Index
+    MO_ConstantPoolIndex,       // Address of indexed Constant in Constant Pool
   };
   
 private:
@@ -174,7 +175,7 @@
   }
   bool isPhysicalRegister() const {
     return (opType == MO_VirtualRegister || opType == MO_MachineRegister) 
-      && regNum < MRegisterInfo::FirstVirtualRegister;
+      && (unsigned)regNum < MRegisterInfo::FirstVirtualRegister;
   }
   bool isRegister() const { return isVirtualRegister() || isPhysicalRegister();}
   bool isMachineRegister() const { return !isVirtualRegister(); }
@@ -184,6 +185,7 @@
     return opType == MO_SignExtendedImmed || opType == MO_UnextendedImmed;
   }
   bool isFrameIndex() const { return opType == MO_FrameIndex; }
+  bool isConstantPoolIndex() const { return opType == MO_ConstantPoolIndex; }
 
   Value* getVRegValue() const {
     assert(opType == MO_VirtualRegister || opType == MO_CCRegister || 
@@ -204,6 +206,10 @@
     return MBB;
   }
   int getFrameIndex() const { assert(isFrameIndex()); return immedVal; }
+  unsigned getConstantPoolIndex() const {
+    assert(isConstantPoolIndex());
+    return immedVal;
+  }
 
   bool          opIsUse         () const { return (flags & USEDEFMASK) == 0; }
   bool		opIsDef		() const { return flags & DEFFLAG; }
@@ -500,6 +506,15 @@
     operands.push_back(MachineOperand(Idx, MachineOperand::MO_FrameIndex));
   }
 
+  /// addConstantPoolndexOperand - Add a constant pool object index to the
+  /// instruction.
+  ///
+  void addConstantPoolIndexOperand(unsigned I) {
+    assert(!OperandsComplete() &&
+           "Trying to add an operand to a machine instr that is already done!");
+    operands.push_back(MachineOperand(I, MachineOperand::MO_ConstantPoolIndex));
+  }
+
 
   //===--------------------------------------------------------------------===//
   // Accessors used to modify instructions in place.
@@ -511,6 +526,17 @@
   /// below.
   /// 
   void replace(MachineOpCode Opcode, unsigned numOperands);
+
+  /// setOpcode - Replace the opcode of the current instruction with a new one.
+  ///
+  void setOpcode(unsigned Op) { opCode = Op; }
+
+  /// RemoveOperand - Erase an operand  from an instruction, leaving it with one
+  /// fewer operand than it started with.
+  ///
+  void RemoveOperand(unsigned i) {
+    operands.erase(operands.begin()+i);
+  }
 
   // Access to set the operands when building the machine instruction
   // 





More information about the llvm-commits mailing list