How to analyse GCC Internal Representation like GIMPLE, RTL

1.9k Views Asked by At

I have generated dump output files using command -fdump-tree-all and -fdump-rtl-all and I got a lot of dump files. I have read that the codes in GIMPLE are in pseudo-C syntax and RTL dump files are too low level to be understood. Is there any ways to understand GIMPLE and RTL dump files? Any software that can convert it to C code or something useful? Any tutorial to learn to understand it? Thanks

1

There are 1 best solutions below

4
On

the best way to do it (for me) is to dump some examples and understand by yourself the emitted code. It's not difficult, there are some change from the original code (like cycles are transformed in if with goto), there are a lot of passes in gcc and my advice is to dump what you need. In my case i use frequently the commands:

-fdump-tree-lower    
-fdump-tree-cfg     
-fdump-tree-ssa 
-fdump-tree-optimized (it's the last pass before going into rtl passes)  

rtl is almost incompressible and it's needed a great understanding over that dialect