Optimization Stages

The Mosa Compiler contains several optimization stages that can be easily extended if necessary. They operate either on IL code for general optimizations or on MIR code for architecture specific optimizations. A list of some pre-implemented optimizationstages follows.

Pre-Implemented stages

Peephole optimization

Peephole optimization looks for unnecessary instructions like:

mov eax, eax
     jmp L_x
L_x: mov eax, edx

Parallel computing

If this stage encounters loops with mathematical computations it unrolls the loop and replaces the single computations by parallel SSE SIMD instructions if possible. This way up to 4 computations can be computed in 1 step.