Class Peephole

java.lang.Object
EDU.purdue.cs.bloat.trans.Peephole
All Implemented Interfaces:
Opcode

public class Peephole extends Object implements Opcode
Performs some peephole optimizations such as loads and stores and removes unreachable instructions.
  • Field Details

    • DEBUG

      public static boolean DEBUG
  • Constructor Details

    • Peephole

      public Peephole()
  • Method Details

    • transform

      public static void transform(MethodEditor method)
      Perform peephole optimizations on the bytecodes in a method. Peephole optimizations look at two consecutive instructions and try to perform some simple optimization. For instance, a push followed by a pop is uninteresting, so both of those instructions can be removed.

      After the peephole optimizations are performed a final phase removes instructions that are not reachable. These instructions reside in basic blocks whose starting label is never jumped to.