Hi all. Currently if you launch some tool with "-debug" option, you got pretty detailed dump. Though the SelectionDAG nodes will dumped as its pointer values: 0xa1d7258: i32 = GlobalAddress<void (i32, ...)* @f> 0 0xa1d7368: i32 = undef [ORD=1] 0xa1d73f0: i32 = TargetConstant<12> [ORD=1] ... It is good if you want to look at memory contents by its address then. But if you just want to understand how the DAG looks 0xABRACADABRA annoying sometimes. This patch allows to see the DAG in more readable form: Node0: i32 = GlobalAddress<void (i32, ...)* @f> 0 Node1: i32 = undef [ORD=1] Node2: i32 = TargetConstant<12> [ORD=1] Just invoke tools with "-debug -dump-node-ids" options. Note if you omit the second option it will dump nodes as its pointer values. This feature also allows to compare two debug logs with diff tool, since node ids depends on its dump order only. Note sure that it should gone to the main branch. But absolutely sure that it may be helpful ;-) -Stepan. -------------- next part -------------- A non-text attachment was scrubbed... Name: nice-debug.patch Type: text/x-patch Size: 4301 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120912/c5919cc8/attachment.bin>
> Note sure that it should gone to the main branch. But absolutely sure > that it may be helpfulNOT sure that it should gone to the main branch... damn typos.
As James requested, added constant inlining feature. Options are: -debug-node-ids -debug-inline-consts -Stepan Stepan Dyatkovskiy wrote:> Hi all. Currently if you launch some tool with "-debug" option, you got > pretty detailed dump. Though the SelectionDAG nodes will dumped as its > pointer values: > 0xa1d7258: i32 = GlobalAddress<void (i32, ...)* @f> 0 > 0xa1d7368: i32 = undef [ORD=1] > 0xa1d73f0: i32 = TargetConstant<12> [ORD=1] > ... > It is good if you want to look at memory contents by its address then. > But if you just want to understand how the DAG looks 0xABRACADABRA > annoying sometimes. > This patch allows to see the DAG in more readable form: > > Node0: i32 = GlobalAddress<void (i32, ...)* @f> 0 > Node1: i32 = undef [ORD=1] > Node2: i32 = TargetConstant<12> [ORD=1] > > Just invoke tools with "-debug -dump-node-ids" options. Note if you omit > the second option it will dump nodes as its pointer values. > > This feature also allows to compare two debug logs with diff tool, since > node ids depends on its dump order only. > > Note sure that it should gone to the main branch. But absolutely sure > that it may be helpful ;-) > > -Stepan. > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >-------------- next part -------------- A non-text attachment was scrubbed... Name: nice-debug.patch Type: text/x-patch Size: 4794 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120912/1f56c29e/attachment.bin>
On Sep 12, 2012, at 6:36 AM, Stepan Dyatkovskiy <STPWORLD at narod.ru> wrote:> Hi all. Currently if you launch some tool with "-debug" option, you got pretty detailed dump. Though the SelectionDAG nodes will dumped as its pointer values: > 0xa1d7258: i32 = GlobalAddress<void (i32, ...)* @f> 0 > 0xa1d7368: i32 = undef [ORD=1] > 0xa1d73f0: i32 = TargetConstant<12> [ORD=1] > ... > It is good if you want to look at memory contents by its address then. But if you just want to understand how the DAG looks 0xABRACADABRA annoying sometimes.Only sometimes?> This patch allows to see the DAG in more readable form: > > Node0: i32 = GlobalAddress<void (i32, ...)* @f> 0 > Node1: i32 = undef [ORD=1] > Node2: i32 = TargetConstant<12> [ORD=1] > > Just invoke tools with "-debug -dump-node-ids" options. Note if you omit the second option it will dump nodes as its pointer values. > > This feature also allows to compare two debug logs with diff tool, since node ids depends on its dump order only. > > Note sure that it should gone to the main branch. But absolutely sure that it may be helpful ;-)Great. But I would also like to debug based on the dump... e.g. break at node N. It would be much simpler to use the existing NodeID instead of assigning new IDs, which I think is confusing. Can someone who understands SD explain why we can't always set NodeID, e.g. after ISEL? Seems like an easy thing. -Andy
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>
Maybe Matching Threads
- [LLVMdev] Nice nodes dumping patch
- LangRef semantics for shufflevector with undef mask is incorrect
- LangRef semantics for shufflevector with undef mask is incorrect
- [PATCH] D70246: [InstCombine] remove identity shuffle simplification for mask with undefs
- [RFC][SVE] Supporting Scalable Vector Architectures in LLVM IR (take 2)