[llvm-commits] [llvm] r93538 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAGNodes.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

Chris Lattner clattner at apple.com
Fri Jan 15 11:47:28 PST 2010


On Jan 15, 2010, at 11:43 AM, David Greene wrote:
> Add some debug routines to SelectionDAG to dump full DAGs.
> print/dumpWithDepth allows one to dump a DAG up to N levels deep.
> dump/printWithFullDepth prints the whole DAG, subject to a depth limit
> on 100 in the default case (to prevent infinite recursion).
>
> Have CannotYetSelect to a dumpWithFullDepth so it is clearer exactly
> what the non-matching DAG looks like.

As Dan requested, please remove limit.

> +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Fri Jan 15  
> 13:43:23 2010
> @@ -5893,6 +5893,49 @@
>   print_details(OS, G);
> }
>
> +void SDNode::printWithDepth(raw_ostream &OS, const SelectionDAG *G,
> +                            unsigned depth, unsigned indent,

What is the relation here between depth and indent?  why not always  
print the message and remove limit?

> +  while (myindent--) {
> +    OS << ' ';
> +  }

O.indent(indent).


> +
> +  print(OS, G);
> +
> +  if (depth > 1) {

Please use early exit here.

>
> +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);
> +}

It would be nice to eliminate some of these unless they are all truly  
useful.

-Chris




More information about the llvm-commits mailing list