From 5270cf1b77e68b19e2c689e87700029821c70aa2 Mon Sep 17 00:00:00 2001 From: Evan Cheng Date: Thu, 26 Oct 2006 21:53:40 +0000 Subject: [PATCH] getPreIndexedLoad -> getIndexedLoad. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31209 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 28 ++++++----------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 45fd350496c..3bd6768576c 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -1447,28 +1447,14 @@ SDOperand SelectionDAG::getExtLoad(ISD::LoadExtType ExtType, MVT::ValueType VT, 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(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 !"); - 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 @@ SDOperand SelectionDAG::getPreIndexedLoad(SDOperand OrigLoad, SDOperand Base) { 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()); -- 2.34.1