[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp SelectionDAG.cpp SelectionDAGPrinter.cpp
Evan Cheng
evan.cheng at apple.com
Tue Nov 29 18:04:24 PST 2005
Changes in directory llvm/lib/CodeGen/SelectionDAG:
ScheduleDAG.cpp updated: 1.45 -> 1.46
SelectionDAG.cpp updated: 1.216 -> 1.217
SelectionDAGPrinter.cpp updated: 1.29 -> 1.30
---
Log message:
Added an index field to GlobalAddressSDNode so it can represent X+12, etc.
---
Diffs of the changes: (+23 -3)
ScheduleDAG.cpp | 2 +-
SelectionDAG.cpp | 19 +++++++++++++++++--
SelectionDAGPrinter.cpp | 5 +++++
3 files changed, 23 insertions(+), 3 deletions(-)
Index: llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp:1.45 llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp:1.46
--- llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp:1.45 Wed Nov 9 17:47:37 2005
+++ llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp Tue Nov 29 20:04:11 2005
@@ -1123,7 +1123,7 @@
MI->addRegOperand(R->getReg(), MachineOperand::Use);
} else if (GlobalAddressSDNode *TGA =
dyn_cast<GlobalAddressSDNode>(Node->getOperand(i))) {
- MI->addGlobalAddressOperand(TGA->getGlobal(), false, 0);
+ MI->addGlobalAddressOperand(TGA->getGlobal(), false, TGA->getOffset());
} else if (BasicBlockSDNode *BB =
dyn_cast<BasicBlockSDNode>(Node->getOperand(i))) {
MI->addMachineBasicBlockOperand(BB->getBasicBlock());
Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.216 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.217
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.216 Tue Nov 29 00:21:05 2005
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Nov 29 20:04:11 2005
@@ -500,10 +500,10 @@
}
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 @@
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 @@
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)){
Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp:1.29 llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp:1.30
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp:1.29 Tue Nov 29 00:21:05 2005
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Tue Nov 29 20:04:11 2005
@@ -70,7 +70,12 @@
Op += ": " + ftostr(CSDN->getValue());
} else if (const GlobalAddressSDNode *GADN =
dyn_cast<GlobalAddressSDNode>(Node)) {
+ int offset = GADN->getOffset();
Op += ": " + GADN->getGlobal()->getName();
+ if (offset > 0)
+ Op += "+" + itostr(offset);
+ else
+ Op += itostr(offset);
} else if (const FrameIndexSDNode *FIDN = dyn_cast<FrameIndexSDNode>(Node)) {
Op += " " + itostr(FIDN->getIndex());
} else if (const ConstantPoolSDNode *CP = dyn_cast<ConstantPoolSDNode>(Node)){
More information about the llvm-commits
mailing list