Class DeadCodeElimination

java.lang.Object
EDU.purdue.cs.bloat.trans.DeadCodeElimination

public class DeadCodeElimination extends Object
DeadCodeElimination performs SSA-based dead code elimination as described in [Cytron, et. al. 91]. The idea behind dead code elimination is that there are some instructions that do not contribute anything useful to the result of the program. Most dead code is introduced by other optimizations. A program statement is live if one or more of the following holds:
  1. The statement effects program output. In Java this is a lot more than just I/O. We must be conservative and assume that exceptions and monitor expression are always live.
  2. The statement is an assignment statement whose target is used in a live statement.
  3. The statement is a conditional branch and there are live statements whose execution depend on the conditional branch.
      Basically, the algorithm proceeds by marking a number of statements as being pre-live and then uses a worklist to determine which statements must also be live by the above three conditions.
  • Field Details

    • DEBUG

      public static boolean DEBUG
  • Constructor Details

    • DeadCodeElimination

      public DeadCodeElimination(FlowGraph cfg)
      Constructor.
  • Method Details

    • transform

      public void transform()
      Performs dead code elimination.