diff options
author | David Greene <greened@obbligato.org> | 2010-01-19 20:37:34 +0000 |
---|---|---|
committer | David Greene <greened@obbligato.org> | 2010-01-19 20:37:34 +0000 |
commit | ce6715faa37b2e44edcf400084aa808ae30d7085 (patch) | |
tree | 48d9e0200f70bd00635046cdf2fb9f6ab109effd /lib | |
parent | b9a25b7744ed12b80031426978decce3d4cebbd7 (diff) | |
download | external_llvm-ce6715faa37b2e44edcf400084aa808ae30d7085.zip external_llvm-ce6715faa37b2e44edcf400084aa808ae30d7085.tar.gz external_llvm-ce6715faa37b2e44edcf400084aa808ae30d7085.tar.bz2 |
Add some new debugging APIs to print out "raw" SelectionDAGs to make
understanding CannotYTetSelect and other errors easier.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93901 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 52 | ||||
-rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 2 |
2 files changed, 25 insertions, 29 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index b8ac005..49b08bb 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -5893,47 +5893,43 @@ 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"; +static void printrWithDepthHelper(raw_ostream &OS, const SDNode *N, + const SelectionDAG *G, unsigned depth, + unsigned indent) +{ + if (depth == 0) return; - } - int myindent = indent; + OS.indent(indent); - while (myindent--) { - OS << ' '; - } + N->print(OS, G); - print(OS, G); + if (depth < 1) + return; - 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); - } + for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i) { + OS << '\n'; + printrWithDepthHelper(OS, N->getOperand(i).getNode(), G, depth-1, indent+2); } +} + +void SDNode::printrWithDepth(raw_ostream &OS, const SelectionDAG *G, + unsigned depth) const { + printrWithDepthHelper(OS, this, G, depth, 0); } -void SDNode::printWithFullDepth(raw_ostream &OS, const SelectionDAG *G, - unsigned indent) const { +void SDNode::printrFull(raw_ostream &OS, const SelectionDAG *G) const { // Don't print impossibly deep things. - printWithDepth(OS, G, 100, indent, true); -} + printrWithDepth(OS, G, 100); +} -void SDNode::dumpWithDepth(const SelectionDAG *G, unsigned depth, - unsigned indent, bool limit) const { - printWithDepth(dbgs(), G, depth, indent, limit); +void SDNode::dumprWithDepth(const SelectionDAG *G, unsigned depth) const { + printrWithDepth(dbgs(), G, depth); } -void SDNode::dumpWithFullDepth(const SelectionDAG *G, unsigned indent) const { +void SDNode::dumprFull(const SelectionDAG *G) const { // Don't print impossibly deep things. - dumpWithDepth(G, 100, indent, true); + dumprWithDepth(G, 100); } static void DumpNodes(const SDNode *N, unsigned indent, const SelectionDAG *G) { diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index e539664..d0fc02d 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->printWithFullDepth(Msg, CurDAG); + N->printrFull(Msg, CurDAG); llvm_report_error(Msg.str()); } |