sysprog21 / shecc

A self-hosting and educational C optimizing compiler
BSD 2-Clause "Simplified" License
1.11k stars 118 forks source link

Implement basic optimizations #88

Closed jserv closed 1 month ago

jserv commented 10 months ago

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 commented 7 months ago

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.

vacantron commented 7 months ago

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 ?

jserv commented 7 months ago

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 commented 1 month ago

So far, we have implemented a few optimizations:

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