shecc icon indicating copy to clipboard operation
shecc copied to clipboard

Implement basic optimizations

Open jserv opened this issue 1 year ago • 3 comments

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.

jserv avatar Dec 07 '23 02:12 jserv

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.

jserv avatar Mar 02 '24 07:03 jserv

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 ?

vacantron avatar Mar 03 '24 13:03 vacantron

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.

jserv avatar Mar 03 '24 15:03 jserv

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.

jserv avatar Aug 15 '24 08:08 jserv