How to dump data from intermediate stages of gcc compilation?
Developer seeks to inspect GCC's intermediate representation before RTL generation for custom CPU targeting.
Basile Starynkevitch suggests using GCC plugins to access the SSA representation before RTL generation. This approach is intended to help a developer modify GCC to target a custom CPU by allowing inspection and potential dumping of the intermediate compilation stages. The advice points towards GCC plugins and the SSA representation as the primary means to achieve this.
- proposer
Suggests using GCC plugins and the SSA representation to dump intermediate compilation data before RTL generation. Recommends looking into CompCert for further insights.
“Practically, I would recommend first writing a GCC plugin ... Your plugin would work on the SSA representation.”
In Details
This query concerns accessing GCC's internal representation, specifically the high-level SSA (Static Single Assignment) form before it's lowered to RTL (Register Transfer Language). The user wants to inspect this data, likely for a new backend or analysis, and is asking for methods beyond RTL dumping.
- GCC plugin
- A dynamically loadable module that can hook into GCC's compilation process to add new passes, diagnostics, or inspect internal representations.
- SSA representation
- Static Single Assignment form is an intermediate representation used in compilers where every variable is assigned exactly once. It simplifies many optimizations and analyses.
- RTL
- Register Transfer Language is an intermediate representation in GCC that is closer to machine code than SSA, describing operations on registers.