diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 43 | ||||
-rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 2 |
2 files changed, 44 insertions, 1 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index cb1a0d6..b8ac005 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -5893,6 +5893,49 @@ void SDNode::print(raw_ostream &OS, const SelectionDAG *G) const { print_details(OS, G); } +void SDNode::printWithDepth(raw_ostream &OS, const SelectionDAG *G, + unsigned depth, unsigned indent, + bool limit) const { + if (depth == 0) { + if (limit) + OS << "*** <max depth> - Cycle? ***\n"; + return; + } + + int myindent = indent; + + while (myindent--) { + OS << ' '; + } + + print(OS, G); + + if (depth > 1) { + for (unsigned i = 0, e = getNumOperands(); i != e; ++i) { + OS << '\n'; + getOperand(i).getNode()->printWithDepth(OS, G, + depth > 0 ? depth-1 : depth, + indent+2); + } + } +} + +void SDNode::printWithFullDepth(raw_ostream &OS, const SelectionDAG *G, + unsigned indent) const { + // Don't print impossibly deep things. + printWithDepth(OS, G, 100, indent, true); +} + +void SDNode::dumpWithDepth(const SelectionDAG *G, unsigned depth, + unsigned indent, bool limit) const { + printWithDepth(dbgs(), G, depth, indent, limit); +} + +void SDNode::dumpWithFullDepth(const SelectionDAG *G, unsigned indent) const { + // Don't print impossibly deep things. + dumpWithDepth(G, 100, indent, true); +} + static void DumpNodes(const SDNode *N, unsigned indent, const SelectionDAG *G) { for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i) if (N->getOperand(i).getNode()->hasOneUse()) diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index 9ac8f83..e539664 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -1426,7 +1426,7 @@ void SelectionDAGISel::CannotYetSelect(SDNode *N) { std::string msg; raw_string_ostream Msg(msg); Msg << "Cannot yet select: "; - N->print(Msg, CurDAG); + N->printWithFullDepth(Msg, CurDAG); llvm_report_error(Msg.str()); } |