This project is read-only.

MOSA Compiler Design

The MOSA Compiler Framework is based on the idea of a pipeline. Every method is compiled by a method compiler, that specifies the pipeline to use for compilation. Such a pipeline may consist of any number of compilation stages. These stages can be grouped into various kinds:
  • Compiler Frontends - Create an instruction stream from a source specific representation, such as CIL or Java byte code
  • Transformations - Transform the instruction stream between various representations
  • Optimization Stages - Various stages intended to optimize the code to execute faster
  • Register Allocation - Allocate architecture specific registers to operands used in the instruction stream
  • Compiler Backends - Generate code from the intermediate and partially architecture specific representations
The compiler framework provides predefined pieces of this pipeline. Some parts, especially the code generation are provided by MOSA Platform Backends, such as the x86 backend included in the MOSA Framework.

Intermediate representation(s)

The compiler framework uses a linear intermediate representation to transform the source program text into machine code. There are several levels of intermediate representations before code generation. These are:
  • IL - Intermediate Language
  • IR - Intermediate Representation
  • MIR - Machine specific Intermediate Representation
During compilation of an CIL method the instructions are represented by IL instruction classes and moving forward, the linear instruction stream is modified to use instructions from the intermediate representation. In some cases an instruction from the intermediate representation can not be emitted directly to machine code and it is replaced by a sequence of machine specific instruction objects. The machine specific instruction classes are provided by the appropriate platform. There are other uses for machine specific instruction classes, but the main use is effective code generation.

Last edited Nov 21, 2008 at 6:23 AM by tgiphil, version 1


No comments yet.