Hpc Canonicalization Of IR

Tiger in Stratego -- Compilation by Program Transformation
Canonicalization of IR Programs

This is the third set of HpcExercises. The final goal of this set of exercises is the definition of a transformation that brings IR expressions in a canonical form.

  1. Setup module IR-Canonicalize.r in directory trans/ with as start an identity transformation. Extend the Makefile.am with appropriate rules for compiling this new component. Compile, install and test by transforming some programs in xmpl/ using the target %.cir (for canonicalized ir).

  1. Define a RecursivePattern? that describes IR expressions in canonical form in module sig/CIR-Format.r. Compile it and define an appropriate target in xmpl/make-rules to check %.cir files.

  1. Extend IR-Canonicalize with transformation rules for linearizing an IR expression.

  1. Define a strategy to apply the linearization rules.

  1. Define a strategy for extracting basic blocks.

  1. Define a strategy for covering the program with traces.


Notes

You can pretty-print the IR tree with the program PP-IR (target %.ir.txt), which can also be used for canonicalized IR trees (target %.cir.txt).