[LLVMdev] Nice nodes dumping patch

Stepan Dyatkovskiy stpworld at narod.ru
Sun Sep 16 07:45:52 PDT 2012


Hi All!

I updated patch.

I extended ways of debug customization. Now it is possible to print 
either node ids, or SDNode* or both node ids+SDNode*. You can also set 
different formats for nodes and its operands printing.
And you can inline constants, registers and undefs (of course you can 
customize it too).

All changes was moved out from SelectionDAG.h. Now all is allocated in 
SelectionDAGDumper.cpp + export declaration in SelectionDAGNodes.h.

Andrew,
I tried to use SDNode::getNodeId, but node UIDS are not always set. 
Since my purpose was keep the main functionality unchanged, I decided to 
use special "debug" ids for damping.

Back to patch..
I changed again option names (sorry):

-debug-node-op-inline=<string>
For some classes of operands allows to inline its values in node dumps. 
Valid characters are c,C,u,U,r,R. c/C means inline constants, u/U means 
inline undefs, r/R means inline registers. Lower case means 'hint' mode: 
node and its value will printed. Upper case means 'replace' mode: node 
will replaced with its value. If you don't want to inline something, 
just omit respective character. Examples: 'RCu' - hint mode for undefs, 
replace mode for registers and constants; 'ur' - hint mode for undefs 
and registers, don't inline contants.

-debug-node-output                 - Customize how SDNode should be dumped
     =ptr                           -   Print SDNode* value
     =idptr                         -   Print Debug ID and SDNode*
     =id

-debug-node-op-output              - Customize how SDNode operands 
should be dumped
     =default                       -   Use the same format as for 
SDNodes itself.
     =ptr                           -   Print SDNode* value
     =idptr                         -   Print Debug ID and SDNode*
     =id                            -   Print Debug ID only

Some examples (launched from llvm-obj 'bin' directory):

./llc -debug -debug-node-output=id \
       ../../../llvm/test/CodeGen/ARM/crash-shufflevector.ll
output: http://pastebin.com/Gfrs0Gdi

./llc -debug -debug-node-output=idptr \
       -debug-node-op-output=id \
       ../../../llvm/test/CodeGen/ARM/crash-shufflevector.ll
output: http://pastebin.com/2n28W3H0

./llc -debug -debug-node-output=id \
       -debug-node-op-inline=C 
../../../llvm/test/CodeGen/ARM/crash-shufflevector.ll
output: http://pastebin.com/WBUXCc50

./llc -debug -debug-node-output=id \
       -debug-node-op-inline=CRU 
../../../llvm/test/CodeGen/ARM/crash-shufflevector.ll
output: http://pastebin.com/MW5AxX2Q

./llc -debug -debug-node-output=id \
       -debug-node-op-inline=Cru 
../../../llvm/test/CodeGen/ARM/crash-shufflevector.ll
output: http://pastebin.com/JsGTbiDP

In next step, I'm going to adopt these changes for the DOT graphs.

Any requests and reviews are welcome!

-Stepan.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nice-debug-2.patch
Type: text/x-patch
Size: 8569 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120916/8e50502b/attachment.bin>


More information about the llvm-dev mailing list