scale.score.trans
Class DeadVarElimination

java.lang.Object
  extended by scale.score.trans.Optimization
      extended by scale.score.trans.DeadVarElimination

public class DeadVarElimination
extends Optimization

This class performs dead variable elimination.

$Id: DeadVarElimination.java,v 1.9 2007-02-28 18:00:36 burrill Exp $

Copyright 2007 by the Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.

A variable is dead if

Unlike most optimizations this optimization never increases register pressure. Consequently, there is never a case where a legal transformation is not also beneficial.


Field Summary
static boolean classTrace
          True if traces are to be performed.
static boolean useHeuristics
          If true, use heuristics that prune the cases where the optimization is applied.
 
Fields inherited from class scale.score.trans.Optimization
dChanged, fpReorder, hasDummyAliases, IN_SSA, minimumExecutionCost, NA_SSA, NO_SSA, rChanged, scribble, signedIntsWrapOnOverflow, trace, un, unsafe, unsignedIntsWrapOnOverflow, VALID_SSA
 
Constructor Summary
DeadVarElimination(Scribble scribble)
           
 
Method Summary
 void perform()
          Removes statements that set the value of a variable that is not used.
 int requiresSSA()
          Return whether this optimization requires that the CFG be in SSA form.
 
Methods inherited from class scale.score.trans.Optimization
assertTrace, assertTrace, assertTrace, assertTrace, assertTrace, genTemp, insertStores, setTrace, sort
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

classTrace

public static boolean classTrace
True if traces are to be performed.


useHeuristics

public static boolean useHeuristics
If true, use heuristics that prune the cases where the optimization is applied.

Constructor Detail

DeadVarElimination

public DeadVarElimination(Scribble scribble)
Method Detail

perform

public void perform()
Removes statements that set the value of a variable that is not used. See Algorithm 19.12 in "Modern Compiler Implementation in Java" by Appel.

Specified by:
perform in class Optimization
See Also:
SSA.coalesceVariables()

requiresSSA

public int requiresSSA()
Return whether this optimization requires that the CFG be in SSA form.

Overrides:
requiresSSA in class Optimization