[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Evan Cheng evan.cheng at apple.com
Thu Oct 26 14:53:54 PDT 2006



Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAG.cpp updated: 1.355 -> 1.356
---
Log message:

getPreIndexedLoad -> getIndexedLoad.

---
Diffs of the changes:  (+7 -21)

 SelectionDAG.cpp |   28 +++++++---------------------
 1 files changed, 7 insertions(+), 21 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.355 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.356
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.355	Tue Oct 17 16:47:13 2006
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp	Thu Oct 26 16:53:40 2006
@@ -1447,28 +1447,14 @@
   return SDOperand(N, 0);
 }
 
-SDOperand SelectionDAG::getPreIndexedLoad(SDOperand OrigLoad, SDOperand Base) {
+SDOperand SelectionDAG::getIndexedLoad(SDOperand OrigLoad, SDOperand Base,
+                                       SDOperand Offset, ISD::MemOpAddrMode AM){
   LoadSDNode *LD = cast<LoadSDNode>(OrigLoad);
-  SDOperand Ptr = LD->getBasePtr();
-  MVT::ValueType PtrVT = Ptr.getValueType();
-  unsigned Opc = Ptr.getOpcode();
-  SDOperand Offset = LD->getOffset();
-  assert(Offset.getOpcode() == ISD::UNDEF);
-  assert((Opc == ISD::ADD || Opc == ISD::SUB) &&
-         "Load address must be <base +/- offset>!");
-  ISD::MemOpAddrMode AM = (Opc == ISD::ADD) ? ISD::PRE_INC : ISD::PRE_DEC;
-  if (Ptr.getOperand(0) == Base) {
-    Offset = Ptr.getOperand(1);
-    Ptr = Ptr.getOperand(0);
-  } else {
-    assert(Ptr.getOperand(1) == Base);
-    Offset = Ptr.getOperand(0);
-    Ptr = Ptr.getOperand(1);
-  }
-
+  assert(LD->getOffset().getOpcode() == ISD::UNDEF &&
+         "Load is already a indexed load!");
   MVT::ValueType VT = OrigLoad.getValueType();
-  SDVTList VTs = getVTList(VT, PtrVT, MVT::Other);
-  SelectionDAGCSEMap::NodeID ID(ISD::LOAD, VTs, LD->getChain(), Ptr, Offset);
+  SDVTList VTs = getVTList(VT, Base.getValueType(), MVT::Other);
+  SelectionDAGCSEMap::NodeID ID(ISD::LOAD, VTs, LD->getChain(), Base, Offset);
   ID.AddInteger(AM);
   ID.AddInteger(LD->getExtensionType());
   ID.AddInteger(LD->getLoadedVT());
@@ -1479,7 +1465,7 @@
   void *IP = 0;
   if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP))
     return SDOperand(E, 0);
-  SDNode *N = new LoadSDNode(LD->getChain(), Ptr, Offset, AM,
+  SDNode *N = new LoadSDNode(LD->getChain(), Base, Offset, AM,
                              LD->getExtensionType(), LD->getLoadedVT(),
                              LD->getSrcValue(), LD->getSrcValueOffset(),
                              LD->getAlignment(), LD->isVolatile());






More information about the llvm-commits mailing list