Next: Annotations, Previous: GENERIC, Up: Tree SSA
10.2 GIMPLE
GIMPLE is a simplified subset of GENERIC for use in optimization. The
particular subset chosen (and the name) was heavily influenced by the
SIMPLE IL used by the McCAT compiler project at McGill University,
though we have made some different choices. For one thing, SIMPLE
doesn't support goto
; a production compiler can't afford that
kind of restriction.
GIMPLE retains much of the structure of the parse trees: lexical scopes are represented as containers, rather than markers. However, expressions are broken down into a 3-address form, using temporary variables to hold intermediate values. Also, control structures are lowered to gotos.
In GIMPLE no container node is ever used for its value; if a
COND_EXPR
or BIND_EXPR
has a value, it is stored into a
temporary within the controlled blocks, and that temporary is used in
place of the container.
The compiler pass which lowers GENERIC to GIMPLE is referred to as the `gimplifier'. The gimplifier works recursively, replacing complex statements with sequences of simple statements.