Class DeadCodeElimination

  • All Implemented Interfaces:
    IRTransform

    public class DeadCodeElimination
    extends Object
    implements IRTransform
    Removes dead code (definitions with no uses).
    • Constructor Detail

      • DeadCodeElimination

        public DeadCodeElimination()
    • Method Detail

      • getName

        public String getName()
        Gets the name of this transformation.
        Specified by:
        getName in interface IRTransform
        Returns:
        the transformation name
      • run

        public boolean run​(IRMethod method)
        Runs the dead code elimination transformation on the specified method.
        Specified by:
        run in interface IRTransform
        Parameters:
        method - the method to transform
        Returns:
        true if the method was modified
      • removeUnreachableBlocks

        public static void removeUnreachableBlocks​(IRMethod method)
        Removes blocks not reachable from the method entry or any exception handler.
        Parameters:
        method - the method whose unreachable blocks to remove