How to check the whole ISD Node generated from .ll file?

take the following simple IR code from .ll file for example :

%6 = mul nsw i64 %4, %5

In stage of Legalized selection DAG, this “mul” operation will be translated to ISD Node SMUL_LOHI. If my backend still has some bugs and can not generate .s file yet (other wise, I could use Graphviz to check the ISD Node) . How can I check What ISD DAG will be generated according to the given .ll file ?


You can use -debug-only=isel to see the DAG after each phase.


Thank you for reply !
But the output by this command is still hard to read, like :joy:

ISEL: Starting selection on root node: t63: ch = store<(store 4 into %ir.3 + 4)> t13, t60, t104, undef:i32
ISEL: Starting pattern match
  Initial Opcode index to 105
  Morphed node: t63: ch = ST_W<Mem:(store 4 into %ir.3 + 4)> t60, TargetFrameIndex:i32<2>, TargetConstant:i32<4>, t13
ISEL: Match complete!

ISEL: Starting selection on root node: t61: ch = store<(store 4 into %ir.3, align 8)> t13, t56, FrameIndex:i32<2>, undef:i32
ISEL: Starting pattern match
  Initial Opcode index to 105
  Morphed node: t61: ch = ST_W<Mem:(store 4 into %ir.3, align 8)> t56, TargetFrameIndex:i32<2>, TargetConstant:i32<0>, t13
ISEL: Match complete!

Is there any other way to see only the IR Node name and type? Something like:

set and add

Did you try --view-dag-combine1-dags? This is the earliest DAG you can get by command. You can also use CurDAG->viewGraph in gdb to dump the DAG at any phase.


You are right sir !
run llc with-view-dag-combine1-dags option would fail with a broken .dot file which can’t be opened or viewed by Graphviz if my program can’t generate the .s file yet.

But ! if I use gdb tool and set a break point before the selection stage of the instruction my backend didn’t support, and print CurDAG->viewGraph , it can generate a normal .dot file and can be opened with Graphviz.

Thank you very much !

By the way, years passed by, LLVM still does not have a human-friendly visual debugging tool, :cry: