Skip to content
wichtounet edited this page Jan 31, 2013 · 5 revisions

The backend is responsible of allocating the registers, optimize the LTAC intermediate representation and generate code for the target platform.

The back end operations are described in the src/NativeBackend.cpp file.

Here is a list of all the operations performed by the backend:

  • Allocate stack space for aggregates (structures and arrays)
  • Generate LTAC code from MTAC. Generates code using only pseudo registers
  • Perform some early optimizations to facilitate the task of the register allocation
  • Allocate pseudo registers in hard registers. Use a Chaitin's style register allocator
  • Generate the code for the prologue and epilogue of functions
  • If the option is set remove the base pointer and use only stack pointer
  • Optimize the LTAC Program
  • Generate assembly code for the target platform
  • Assemble and link the assembly into an executable

LTAC Optimizations

Here are all the optimizations that are performed on LTAC:

  • Peephole optimizations of the instructions
  • Constant propagation (local only)
  • Copy propagation (local only)
  • Dead Code Elimination (global)
  • Replace branches by conditional moves if possible

TODO

  • Add more global optimizations to the LTAC optimization engine.
  • Make Constant/Propagation global

Clone this wiki locally