TC-S, Static Single Assignment

2027-TC-S is a part of the TC Back End option.

2027-TC-S is an additional assignment.

At the end of this stage, the compiler performs various optimizations on the LIR code.

Those optimizations are made using the Static Single Assignment (SSA) form. It is an abstract form which forbids static variable redefinitions.

This does not prevent variables from being updated at runtime. For instance, loop variables, that may get re-assigned on each iteration, are represented as a sequence of SSA variables. All of these are tied together with Phi-Nodes. It differs from Dynamic Single Assignment (SSA) where a memory location can be only written once.

Note

This step requires TC-E, Computing the Escaping Variables to work, as only temporaries count for variable redefinition. Escaped variables are put on the stack and do not use temporaries.

Currently, only optimization done during this step is:
  • Dead code Elimination, triggered with the --dead-code-elimination option.

Feel free to implement other optimizations, quite a few interesting ones are described in the book. However, they will not be tested nor graded.