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

Stuart Hastings stuart at apple.com
Wed Feb 4 09:45:53 PST 2009

On Feb 4, 2009, at 8:51 AM, Duncan Sands wrote:

> Hi Stuart, can you please document what the difference
> is between dump and dumpr; likewise print and printr.

Sorry to be clueless, but I don't know where the SelectionDAG dump and  
print functions are documented.  :-(  Please direct me.

I presumed that very few LLVM developers were using the SelectionDAG  
dump(), as it only prints one instruction, and that doesn't seem very  
"friendly" when you're working on a DAG.  dumpr() prints all all the  
children of a given node, as if you picked up that node and walked the  
DAG underneath.  Trivial nodes that have no children are printed  
inline, on the same line as their parent, and may appear multiple  
times in one dump.  Non-trivial nodes that have children go on a  
unique line, and are printed exactly once.  The resulting dump seems  
"denser" IMHO, making more effective use of the screen area.  I made  
the dump go top-down because of a comment from Dale; personally, I  
don't care if the root node is at the top or the bottom.

printr() is just print(), but it omits the usual list of children so  
they may be dumped by other means (e.g. simple children printed inline).

I prefer to run GDB under Emacs.  With dumpr(), I can see the entire  
DAG as viewed from a particular node, and I can use the Emacs search  
feature to find and highlight multiple references to a given node.   
(Emacs highlights all the matching strings visible in a buffer  
window.  The color choices are garish, but the matches are immediately  
obvious.  :-)

If nobody objects, I would propose to delete the existing SelectionDAG  
dump() and rename dumpr() to replace it.  I guess the existing print()  
should stay, as it seems to be an LLVM requirement (?).

Mike Stump has informed me that he has a tweaked version of GraphViz  
that should work on the OS I'm obliged to use.  IMHO GraphViz would be  
a vastly superior debugging aid when it's available.  IMHO dumpr() is  
friendlier than dump(), but both are useless when you're dealing with  
a really large DAG.


More information about the llvm-commits mailing list