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
Peephole optimization looks for unnecessary instructions like:
mov eax, eax
L_x: mov eax, edx
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.