Operating Systems

The second phase translates the internal program representation from tree format into a second internal format called Register Transfer Language (RTL). The RTL format is already close to real Assembler code but doesn’t yet contain any machine-specific information. While translating the highly recursive syntax tree representation into RTL, this phase performs several machine-independent code optimization passes.

The third phase is called the backend. It translates the RTL representation into Assembler code. The back-end has information on the target machine’s instruction set and everything needed to perform machine-specific code optimization.

The three phases of the compiler communicate via two data structures for internal program representation, which are (almost) independent of the programming language used as input, and of the Assembler source code to be output. This modular approach allows front-ends for many different programming languages and code generators for many different target architectures to be combined (see Figure 3). The approach is beneficial because:


• Adding a new language only requires writing a new front-end.

• The code optimization and all existing back-ends can be reused, making the new language immediately available on a large variety of machines.

For example, IBM’s Firmware implementation language, PL8, was implemented this way and the existing back-end for System z could be reused. (For details, see W. Gellerich, T. Hendel, R. Land, H. Lehmann, M. Mueller, P.H. Oden, H. Penner: “The GNU 64-Bit PL8 Compiler: Toward an Open Standard Environment for Firmware Development,” IBM Journal of Research and Development, May/July 2004, Volume 48, Number 3/4, pages 543-555, www.research.ibm.com/journal/rd/483/gellerich.pdf.)

Developing a new code generator makes all languages supported by GCC available on the new architecture. This reduces the effort for supporting a new platform and has contributed to the growth of Linux.

Details of the internal structures of GCC are provided in a separate manual available on the GCC homepage. The machine instructions of System z are described in the Principles of Operation document. Refer to:

• ESA/390 Principles of Operation (SA22-7201-07, 2000) http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/dz9ar007

6 Pages