pic icon indicating copy to clipboard operation
pic copied to clipboard

Introducing the dead code elimination phase

Open takagi opened this issue 9 years ago • 2 comments

The dead code elimination phase is to be introduced within the compiler phases for optimization.

takagi avatar Feb 28 '15 04:02 takagi

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)

takagi avatar Mar 06 '15 09:03 takagi

Now, on ad6f4e503d20668b29d3b3151a402bbd76a2e258, indirectly dead codes in top-level function definitions are eliminated.

takagi avatar Mar 08 '15 05:03 takagi