sysprog21/shecc

Implement basic optimizations

jserv opened this issue · 4 comments

jserv commented

With the inclusion of SSA in the middle-end, it is now time to implement some common optimizations on the new SSA-based IR. These include constant folding, copy propagation, and dead code elimination.

After @vacantron implements the constant folding optimization, this task will be considered complete, signifying that shecc achieves the goal of implementing a minimal optimizing C compiler capable of compiling itself with typical optimizations.

Should we abjust the directory structure that making src/ssa.c focus on building the SSA and create another src/optimizer.c to include the existent src/peephole.c and the other optimizers ?

Should we abjust the directory structure that making src/ssa.c focus on building the SSA and create another src/optimizer.c to include the existent src/peephole.c and the other optimizers ?

Up to you. I expect the availability of basic optimizers existing with minimal efforts.

So far, we have implemented a few optimizations:

  • Common subexpression elimination
  • Constant optimization
  • Peephole optimization
  • Dead code elimination

With these optimizations complete, we consider this task concluded. Dedicated issues will be created for any additional optimizations as they are planned.