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

David Greene dag at cray.com
Fri Jan 15 13:52:46 PST 2010


On Friday 15 January 2010 13:47, Chris Lattner wrote:
> 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.

Ok.

> > +++ 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?

They're essentially inverses.  I'll create a helper to track indent and
clean up the interface visible to the user.

We could compute indent if we tracked the original depth presented to
the routine, but that wouldn't be any less complicated.

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

Cool, didn't know that existed.

> > +
> > +  print(OS, G);
> > +
> > +  if (depth > 1) {
>
> Please use early exit here.

Ok.

> > +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.

After removing limit, we definitely want both for the case of
buggy DAGs that cause infinite recursion.

                                -Dave



More information about the llvm-commits mailing list