This project is read-only.


The CilToIrTransformationStage transforms the IL representation of a method to its identical representation in IR form. The translation performed by the CilToIrTransformationStage handles some specific properties of IL instructions, such as the sign extension, zero extension or truncation in appropriate cases. The CilToIrTransformationStage works on BasicBlocks provided by a previous compilation stage.

Transformation specialties

The intermediate representation used by the compiler works as much as possible without temporary moves, load or store instructions. This is done in order to reduce the instruction count required to represent a method implementation. To achieve this goal, the CilToIrTransformationStage removes load and store instructions and replaces all uses of these temporaries in the depending instructions. It is the responsibility of a register allocator to introduce the right load/store instructions in a later stage.

There is one exemption to the above rule: CIL requires automatic zero- or sign-expansion on loads and appropriate truncation on stores. If the CilToIrTransformationStage determines such a load or store, it will replace the appropriate load/store instruction by the right IR instruction and keep the temporary operands worked on. This is done to ensure the extension/truncation properties remain, because it can not be assumed that arithmetic or other operations can operate directly on memory without violating the truncation/expansion rules.

Last edited Nov 21, 2008 at 6:48 AM by tgiphil, version 2


No comments yet.