diff options
author | Evan Cheng <evan.cheng@apple.com> | 2005-11-30 02:04:11 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2005-11-30 02:04:11 +0000 |
commit | 61ca74bc3a29b2af2be7e4bd612289da8aae85b5 (patch) | |
tree | 896f6424b7503bc1de07fe094ef7e2435e50c570 /lib/CodeGen/SelectionDAG/SelectionDAG.cpp | |
parent | 345c3f370d56477fd2ab3f742f36e6d8fd4f82fa (diff) |
Added an index field to GlobalAddressSDNode so it can represent X+12, etc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24523 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 1eb95864c0..606ed5234b 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -500,10 +500,10 @@ SDOperand SelectionDAG::getGlobalAddress(const GlobalValue *GV, } SDOperand SelectionDAG::getTargetGlobalAddress(const GlobalValue *GV, - MVT::ValueType VT) { + MVT::ValueType VT, int offset) { SDNode *&N = TargetGlobalValues[GV]; if (N) return SDOperand(N, 0); - N = new GlobalAddressSDNode(true, GV, VT); + N = new GlobalAddressSDNode(true, GV, VT, offset); AllNodes.push_back(N); return SDOperand(N, 0); } @@ -1457,6 +1457,16 @@ void SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, N->setOperands(Op1, Op2, Op3, Op4, Op5); } +void SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, + MVT::ValueType VT, SDOperand Op1, + SDOperand Op2, SDOperand Op3, SDOperand Op4, + SDOperand Op5, SDOperand Op6) { + RemoveNodeFromCSEMaps(N); + N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc); + N->setValueTypes(VT); + N->setOperands(Op1, Op2, Op3, Op4, Op5, Op6); +} + void SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT1, MVT::ValueType VT2, SDOperand Op1, SDOperand Op2) { @@ -1859,8 +1869,13 @@ void SDNode::dump(const SelectionDAG *G) const { std::cerr << "<" << CSDN->getValue() << ">"; } else if (const GlobalAddressSDNode *GADN = dyn_cast<GlobalAddressSDNode>(this)) { + int offset = GADN->getOffset(); std::cerr << "<"; WriteAsOperand(std::cerr, GADN->getGlobal()) << ">"; + if (offset > 0) + std::cerr << " + " << offset; + else + std::cerr << " " << offset; } else if (const FrameIndexSDNode *FIDN = dyn_cast<FrameIndexSDNode>(this)) { std::cerr << "<" << FIDN->getIndex() << ">"; } else if (const ConstantPoolSDNode *CP = dyn_cast<ConstantPoolSDNode>(this)){ |