aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-01-09 20:38:33 +0000
committerChris Lattner <sabre@nondot.org>2005-01-09 20:38:33 +0000
commitea946cdb1b16827a5f19a2593d054953e51b9fb6 (patch)
tree3d7307ef2a6d7b2979e041f75ba5ca346cd20375 /lib/CodeGen/SelectionDAG/SelectionDAG.cpp
parent49d24716a4398fc249d2b5ac993ff97a421f0635 (diff)
Print the DAG out more like a DAG in nested format.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19422 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAG.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 2bd1739501..3b4694a764 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -920,15 +920,31 @@ void SDNode::dump() const {
}
+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";
}