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: Args: ./llc -debug -debug-node-output=id ../../../llvm/test/CodeGen/ARM/crash-sh - Pastebin.com
./llc -debug -debug-node-output=idptr \
-debug-node-op-output=id \
../../../llvm/test/CodeGen/ARM/crash-shufflevector.ll
output: Args: ./llc -debug -debug-node-output=idptr -debug-node-op-output=id ../../../ll - Pastebin.com
./llc -debug -debug-node-output=id \
-debug-node-op-inline=C ../../../llvm/test/CodeGen/ARM/crash-shufflevector.ll
output: Args: ./llc -debug -debug-node-output=id -debug-node-op-inline=C ../../../llvm/t - Pastebin.com
./llc -debug -debug-node-output=id \
-debug-node-op-inline=CRU ../../../llvm/test/CodeGen/ARM/crash-shufflevector.ll
output: Args: ./llc -debug -debug-node-output=id -debug-node-op-inline=CRU ../../../llvm - Pastebin.com
./llc -debug -debug-node-output=id \
-debug-node-op-inline=Cru ../../../llvm/test/CodeGen/ARM/crash-shufflevector.ll
output: Args: ./llc -debug -debug-node-output=id -debug-node-op-inline=Cru ../../../llvm - Pastebin.com
In next step, I'm going to adopt these changes for the DOT graphs.
Any requests and reviews are welcome!
-Stepan.
nice-debug-2.patch (8.37 KB)