pic
pic copied to clipboard
Introducing the dead code elimination phase
The dead code elimination phase is to be introduced within the compiler phases for optimization.
For now, dead code elimination is introduced on 5e41949cad77cdaa0ea663d9f90401be004fc140 and b7dde69a53e42c4616b0d52bb669cf2a5be43629.
This eliminates the following kinds of dead codes:
- local function definitions
- variable definitions
- top-level function definitions
Currently, top-level functions' dead code elimination is imcomplete because indirect dead codes are not eliminated. For example, foo
, called by bar
that is not called anywhere, is not eliminated.
foo -> bar -> x
Currently the following forms are supposed to be with side effects:
- SETREG forms
- function applications (because no ways to know if being with side effects)
Now, on ad6f4e503d20668b29d3b3151a402bbd76a2e258, indirectly dead codes in top-level function definitions are eliminated.