From 9109fb1eb7d3341727353777c2a4282aa1a0c39a Mon Sep 17 00:00:00 2001 From: Evan Cheng Date: Sun, 5 Nov 2006 09:30:09 +0000 Subject: [PATCH] Added getIndexedStore. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31458 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/CodeGen/SelectionDAG.h | 2 ++ lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 30 +++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/include/llvm/CodeGen/SelectionDAG.h b/include/llvm/CodeGen/SelectionDAG.h index f0e63c0dceb..b64b9c2143b 100644 --- a/include/llvm/CodeGen/SelectionDAG.h +++ b/include/llvm/CodeGen/SelectionDAG.h @@ -327,6 +327,8 @@ public: SDOperand getTruncStore(SDOperand Chain, SDOperand Value, SDOperand Ptr, const Value *SV, int SVOffset, MVT::ValueType TVT, bool isVolatile=false); + SDOperand getIndexedStore(SDOperand OrigStoe, SDOperand Base, + SDOperand Offset, ISD::MemOpAddrMode AM); // getSrcValue - construct a node to track a Value* through the backend SDOperand getSrcValue(const Value* I, int offset = 0); diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 4c21eff3a6f..6e69728ad33 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -1723,6 +1723,36 @@ SDOperand SelectionDAG::getTruncStore(SDOperand Chain, SDOperand Value, return SDOperand(N, 0); } +SDOperand SelectionDAG::getIndexedStore(SDOperand OrigStore, SDOperand Base, + SDOperand Offset, ISD::MemOpAddrMode AM){ + StoreSDNode *ST = cast(OrigStore); + assert(ST->getOffset().getOpcode() == ISD::UNDEF && + "Store is already a indexed store!"); + SDVTList VTs = getVTList(Base.getValueType(), MVT::Other); + SDOperand Ops[] = { ST->getChain(), ST->getValue(), Base, Offset }; + FoldingSetNodeID ID; + AddNodeIDNode(ID, ISD::STORE, VTs, Ops, 4); + ID.AddInteger(AM); + ID.AddInteger(ST->isTruncatingStore()); + ID.AddInteger(ST->getStoredVT()); + ID.AddPointer(ST->getSrcValue()); + ID.AddInteger(ST->getSrcValueOffset()); + ID.AddInteger(ST->getAlignment()); + ID.AddInteger(ST->isVolatile()); + void *IP = 0; + if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) + return SDOperand(E, 0); + SDNode *N = new StoreSDNode(ST->getChain(), ST->getValue(), + Base, Offset, AM, + ST->isTruncatingStore(), ST->getStoredVT(), + ST->getSrcValue(), ST->getSrcValueOffset(), + ST->getAlignment(), ST->isVolatile()); + N->setValueTypes(VTs); + CSEMap.InsertNode(N, IP); + AllNodes.push_back(N); + return SDOperand(N, 0); +} + SDOperand SelectionDAG::getVAArg(MVT::ValueType VT, SDOperand Chain, SDOperand Ptr, SDOperand SV) {