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

Evan Cheng evan.cheng at apple.com
Sat Feb 25 01:53:08 PST 2006



Changes in directory llvm/include/llvm/CodeGen:

MachineInstr.h updated: 1.164 -> 1.165
MachineInstrBuilder.h updated: 1.28 -> 1.29
SelectionDAG.h updated: 1.99 -> 1.100
SelectionDAGNodes.h updated: 1.103 -> 1.104
---
Log message:

Added an offset field to ConstantPoolSDNode.


---
Diffs of the changes:  (+33 -22)

 MachineInstr.h        |   16 ++++++++++------
 MachineInstrBuilder.h |    8 +++++---
 SelectionDAG.h        |   10 ++++++----
 SelectionDAGNodes.h   |   21 ++++++++++++---------
 4 files changed, 33 insertions(+), 22 deletions(-)


Index: llvm/include/llvm/CodeGen/MachineInstr.h
diff -u llvm/include/llvm/CodeGen/MachineInstr.h:1.164 llvm/include/llvm/CodeGen/MachineInstr.h:1.165
--- llvm/include/llvm/CodeGen/MachineInstr.h:1.164	Wed Feb 22 10:23:43 2006
+++ llvm/include/llvm/CodeGen/MachineInstr.h	Sat Feb 25 03:52:55 2006
@@ -131,7 +131,8 @@
                                 // will be set for a value after reg allocation
 
     int offset;                 // Offset to address of global or external, only
-                                // valid for MO_GlobalAddress and MO_ExternalSym
+                                // valid for MO_GlobalAddress, MO_ExternalSym
+                                // and MO_ConstantPoolIndex
   } extra;
 
   void zeroContents () {
@@ -140,11 +141,14 @@
   }
 
   MachineOperand(int64_t ImmVal = 0,
-        MachineOperandType OpTy = MO_VirtualRegister)
+        MachineOperandType OpTy = MO_VirtualRegister, int Offset = 0)
     : flags(0), opType(OpTy) {
     zeroContents ();
     contents.immedVal = ImmVal;
-    extra.regNum = -1;
+    if (OpTy == MachineOperand::MO_ConstantPoolIndex)
+      extra.offset = Offset;
+    else
+      extra.regNum = -1;
   }
 
   MachineOperand(int Reg, MachineOperandType OpTy, UseType UseTy)
@@ -286,7 +290,7 @@
     return (GlobalValue*)contents.value;
   }
   int getOffset() const {
-    assert((isGlobalAddress() || isExternalSymbol()) &&
+    assert((isGlobalAddress() || isExternalSymbol() || isConstantPoolIndex()) &&
         "Wrong MachineOperand accessor");
     return extra.offset;
   }
@@ -344,7 +348,7 @@
   }
 
   void setOffset(int Offset) {
-    assert((isGlobalAddress() || isExternalSymbol()) &&
+    assert((isGlobalAddress() || isExternalSymbol() || isConstantPoolIndex()) &&
         "Wrong MachineOperand accessor");
     extra.offset = Offset;
   }
@@ -644,7 +648,7 @@
   /// addConstantPoolndexOperand - Add a constant pool object index to the
   /// instruction.
   ///
-  void addConstantPoolIndexOperand(unsigned I) {
+  void addConstantPoolIndexOperand(unsigned I, int Offset=0) {
     assert(!OperandsComplete() &&
            "Trying to add an operand to a machine instr that is already done!");
     operands.push_back(MachineOperand(I, MachineOperand::MO_ConstantPoolIndex));


Index: llvm/include/llvm/CodeGen/MachineInstrBuilder.h
diff -u llvm/include/llvm/CodeGen/MachineInstrBuilder.h:1.28 llvm/include/llvm/CodeGen/MachineInstrBuilder.h:1.29
--- llvm/include/llvm/CodeGen/MachineInstrBuilder.h:1.28	Thu Apr 21 15:38:00 2005
+++ llvm/include/llvm/CodeGen/MachineInstrBuilder.h	Sat Feb 25 03:52:55 2006
@@ -125,13 +125,15 @@
     return *this;
   }
 
-  const MachineInstrBuilder &addConstantPoolIndex(unsigned Idx) const {
-    MI->addConstantPoolIndexOperand(Idx);
+  const MachineInstrBuilder &addConstantPoolIndex(unsigned Idx,
+                                                  int Offset = 0) const {
+    MI->addConstantPoolIndexOperand(Idx, Offset);
     return *this;
   }
 
   const MachineInstrBuilder &addGlobalAddress(GlobalValue *GV,
-                                              bool isPCRelative = false, int Offset = 0) const {
+                                              bool isPCRelative = false,
+                                              int Offset = 0) const {
     MI->addGlobalAddressOperand(GV, isPCRelative, Offset);
     return *this;
   }


Index: llvm/include/llvm/CodeGen/SelectionDAG.h
diff -u llvm/include/llvm/CodeGen/SelectionDAG.h:1.99 llvm/include/llvm/CodeGen/SelectionDAG.h:1.100
--- llvm/include/llvm/CodeGen/SelectionDAG.h:1.99	Fri Feb 17 15:57:00 2006
+++ llvm/include/llvm/CodeGen/SelectionDAG.h	Sat Feb 25 03:52:55 2006
@@ -121,9 +121,9 @@
   SDOperand getFrameIndex(int FI, MVT::ValueType VT);
   SDOperand getTargetFrameIndex(int FI, MVT::ValueType VT);
   SDOperand getConstantPool(Constant *C, MVT::ValueType VT,
-                            unsigned Alignment=0);
+                           unsigned Alignment=0,  int offset = 0);
   SDOperand getTargetConstantPool(Constant *C, MVT::ValueType VT,
-                                  unsigned Alignment=0);
+                                  unsigned Alignment=0, int offset = 0);
   SDOperand getBasicBlock(MachineBasicBlock *MBB);
   SDOperand getExternalSymbol(const char *Sym, MVT::ValueType VT);
   SDOperand getTargetExternalSymbol(const char *Sym, MVT::ValueType VT);
@@ -469,8 +469,10 @@
   std::map<std::pair<uint64_t, MVT::ValueType>, SDNode*> ConstantFPs;
   std::map<std::pair<uint64_t, MVT::ValueType>, SDNode*> TargetConstantFPs;
   std::map<int, SDNode*> FrameIndices, TargetFrameIndices;
-  std::map<std::pair<Constant *, unsigned>, SDNode*> ConstantPoolIndices;
-  std::map<std::pair<Constant *, unsigned>, SDNode*> TargetConstantPoolIndices;
+  std::map<std::pair<Constant *,
+                     std::pair<int, unsigned> >, SDNode*> ConstantPoolIndices;
+  std::map<std::pair<Constant *,
+                 std::pair<int, unsigned> >, SDNode*> TargetConstantPoolIndices;
   std::map<MachineBasicBlock *, SDNode*> BBNodes;
   std::vector<SDNode*> ValueTypeNodes;
   std::map<std::string, SDNode*> ExternalSymbols;


Index: llvm/include/llvm/CodeGen/SelectionDAGNodes.h
diff -u llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.103 llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.104
--- llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.103	Wed Feb 22 10:23:43 2006
+++ llvm/include/llvm/CodeGen/SelectionDAGNodes.h	Sat Feb 25 03:52:55 2006
@@ -1028,19 +1028,19 @@
 
 class GlobalAddressSDNode : public SDNode {
   GlobalValue *TheGlobal;
-  int offset;
+  int Offset;
 protected:
   friend class SelectionDAG;
   GlobalAddressSDNode(bool isTarget, const GlobalValue *GA, MVT::ValueType VT,
                       int o=0)
-    : SDNode(isTarget ? ISD::TargetGlobalAddress : ISD::GlobalAddress, VT) {
+    : SDNode(isTarget ? ISD::TargetGlobalAddress : ISD::GlobalAddress, VT),
+      Offset(o) {
     TheGlobal = const_cast<GlobalValue*>(GA);
-    offset = o;
   }
 public:
 
   GlobalValue *getGlobal() const { return TheGlobal; }
-  int getOffset() const { return offset; }
+  int getOffset() const { return Offset; }
 
   static bool classof(const GlobalAddressSDNode *) { return true; }
   static bool classof(const SDNode *N) {
@@ -1069,19 +1069,22 @@
 
 class ConstantPoolSDNode : public SDNode {
   Constant *C;
+  int Offset;
   unsigned Alignment;
 protected:
   friend class SelectionDAG;
-  ConstantPoolSDNode(Constant *c, MVT::ValueType VT, bool isTarget)
+  ConstantPoolSDNode(bool isTarget, Constant *c, MVT::ValueType VT,
+                     int o=0)
     : SDNode(isTarget ? ISD::TargetConstantPool : ISD::ConstantPool, VT),
-    C(c), Alignment(0) {}
-  ConstantPoolSDNode(Constant *c, MVT::ValueType VT, unsigned Align,
-                     bool isTarget)
+      C(c), Offset(o), Alignment(0) {}
+  ConstantPoolSDNode(bool isTarget, Constant *c, MVT::ValueType VT, int o,
+                     unsigned Align)
     : SDNode(isTarget ? ISD::TargetConstantPool : ISD::ConstantPool, VT),
-    C(c), Alignment(Align) {}
+      C(c), Offset(o), Alignment(Align) {}
 public:
 
   Constant *get() const { return C; }
+  int getOffset() const { return Offset; }
   
   // Return the alignment of this constant pool object, which is either 0 (for
   // default alignment) or log2 of the desired value.






More information about the llvm-commits mailing list