Can GCC compile GIMPLE?
This project is called GIMPLE FE (front-end). The first try never reached a usable state. It was restarted during GSoC'16, merged into gcc-8, and has been regularly improving since. It is enabled with -fgimple
.
The goal is to help write testcases. It is not a complete dump/reload facility as llvm provides. The dumps you get with -fdump-*
(there is a -gimple
modifier, as in -fdump-tree-all-gimple
, to get a syntax that matches what the FE reads) are nice to let you know what is going on, but they don't contain enough information to rebuild the internal structures. And the FE reads a dialect that only lets you specify a small subset of the information that GIMPLE can encode.
Similarly, there exists a partial RTL front-end, for this other internal representation of gcc.
A more complete dump/reload is provided by LTO. When you compile a file with -flto -c
, gcc saves a bytecode representation of GIMPLE in a section of the .o
file, which it can read again when called as a linker. This representation is almost complete (there are some issues with debug information I think). However, it is not meant to be easy to read like a text dump, and the exact format changes with every minor version of the compiler. Also, you can only dump/reload at one predefined point in the pipeline, not after an arbitrary pass.