Intermediate Code Generation ...
. Front end translates a source program into an intermediate representation
. Back end generates target code from intermediate representation
. Benefits
- Retargeting is possible
- Machine independent code optimization is possible
In the analysis-synthesis model of a compiler, the front end translates a source program into an intermediate representation from which the back end generates target code. Details of the target language are confined to the back end, as far as possible. Although a source program can be translated directly into the target language, some benefits of using a machine-independent intermediate form are:
1. Retargeting is facilitated: a compiler for a different machine can be created by attaching a back-end for the new machine to an existing front-end.
2. A machine-independent code optimizer can be applied to the intermediate representation.
|