This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: From SSA back to GIMPLE
Jose . wrote:
> I understand that the whole process of compiling a C file involves
> GENERIC->GIMPLE->SSA->GIMPLE->RTL
Yes.
> If I'm not wrong, GCC currently cannot go from SSA to RTL directly.
It can, but it doesn't.
> What I don't understand is what happens with all versions of the same
> variable when doing the SSA->GIMPLE step. Are they mixed into a single
> variable declaration? Are they treated as separate variables and
> handled later by the register allocator?
Conceptually, what happens is that every SSA name becomes a separate
object and PHI nodes are converted to the corresponding set of
assignments to the same symbol, to model the multi-way assignment. This
is, of course, done so that new symbols are only created when
overlapping live ranges exist. The mechanism is described in Morgan's
book on compiler optimization (I don't have the exact reference handy,
sorry).
You will find the implementation of this mechanism in tree-outof-ssa.c
In the future, the plan is to go into RTL directly out of SSA. We are
also thinking about lowering GIMPLE a bit further and delay the
transition into RTL.