On Tue, 2024-02-13 at 23:40 -0800, Andi Kleen via Gcc wrote: > Robert Dubner <rdub...@symas.com> writes: > > > There didn't seem to be any such functionality in GCC. I found a > > routine > > in print-tree.cc which printed out a single node, but I needed to > > understand the entire tree of nodes for a function. > > FWIW the standard way to do this is to run the compiler in gdb with > the .gdbinit in the object directory, set a suitable break > point and then use pt etc to dump the trees. It prints all the fields > and you can use the gdb command line to explore further. > > > ***********************************This is NodeNumber0 > > (0x7f12e13b0d00) NodeNumber0 > > tree_code: function_decl > > tree_code_class: tcc_declaration > > My suggestion if you go this route would be to generate > some standard format like YAML or JSON that other tools > can easily parse.
I'd love it if we had a JSON output for our IR. FWIW, as of r14-6228- g3bd8241a1f1982 our JSON output routines can nicely format the generated JSON in a way that I find very readable in debugging (and I'm using this when debugging the analyzer). Dave