Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to analyse GCC Internal Representation like GIMPLE, RTL

Tags:

gcc

dump

gimple

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

like image 285
linuxqwerty Avatar asked Oct 15 '25 14:10

linuxqwerty


1 Answers

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

like image 113
Jordy Baylac Avatar answered Oct 19 '25 13:10

Jordy Baylac