[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Chris Lattner
lattner at cs.uiuc.edu
Sun Jan 9 12:38:47 PST 2005
Changes in directory llvm/lib/CodeGen/SelectionDAG:
SelectionDAG.cpp updated: 1.17 -> 1.18
---
Log message:
Print the DAG out more like a DAG in nested format.
---
Diffs of the changes: (+18 -2)
Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.17 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.18
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.17 Sun Jan 9 14:26:36 2005
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sun Jan 9 14:38:33 2005
@@ -920,15 +920,31 @@
}
+static void DumpNodes(SDNode *N, unsigned indent) {
+ for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i)
+ if (N->getOperand(i).Val->hasOneUse())
+ DumpNodes(N->getOperand(i).Val, indent+2);
+ else
+ std::cerr << "\n" << std::string(indent+2, ' ')
+ << (void*)N->getOperand(i).Val << ": <multiple use>";
+
+
+ std::cerr << "\n" << std::string(indent, ' ');
+ N->dump();
+}
+
void SelectionDAG::dump() const {
std::cerr << "SelectionDAG has " << AllNodes.size() << " nodes:";
std::vector<SDNode*> Nodes(AllNodes);
std::sort(Nodes.begin(), Nodes.end());
for (unsigned i = 0, e = Nodes.size(); i != e; ++i) {
- std::cerr << "\n ";
- Nodes[i]->dump();
+ if (!Nodes[i]->hasOneUse() && Nodes[i] != getRoot().Val)
+ DumpNodes(Nodes[i], 2);
}
+
+ DumpNodes(getRoot().Val, 2);
+
std::cerr << "\n\n";
}
More information about the llvm-commits
mailing list