scale.score.trans
Class SCC

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

public class SCC
extends Optimization

This class performs the sparse conditional constant propagation.

$Id: SCC.java,v 1.111 2007-10-04 19:58:37 burrill Exp $

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

See Constant Propagation with Conditional Branches by Mark N. Wegman and F. Kenneth Zadeck in ACM Transactions on Programming Languages and Systems, Vol 13, No. 2, April 1991, Pages 181-210.

This optimization attempts to do two things:

It it can be proved that an expression's value is always the same, then that expression may be replaced by \a literal of that value. If the predicate of a decision node is a constant, then un-selected edges out of that node may be eliminated. If only one edge remains, the the decision node may also be eliminated.

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
SCC(Scribble scribble)
          Perform sparse conditional constant propagation.
 
Method Summary
static int deadCFGNodes()
          Return the number of dead nodes removed.
static int newCFGNodes()
          Return the number of new nodes created.
 void perform()
          Propagate constants through the Scribble graph.
static int propagations()
          Return the number of times copy propagation was performed.
static int uselessDecisions()
          Return the number of DecisionChords deleted.
 
Methods inherited from class scale.score.trans.Optimization
assertTrace, assertTrace, assertTrace, assertTrace, assertTrace, genTemp, insertStores, requiresSSA, 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

SCC

public SCC(Scribble scribble)
Perform sparse conditional constant propagation.

Parameters:
scribble - the Scribble graph to be transformed
Method Detail

deadCFGNodes

public static int deadCFGNodes()
Return the number of dead nodes removed.


propagations

public static int propagations()
Return the number of times copy propagation was performed.


newCFGNodes

public static int newCFGNodes()
Return the number of new nodes created.


uselessDecisions

public static int uselessDecisions()
Return the number of DecisionChords deleted.


perform

public void perform()
Propagate constants through the Scribble graph. Eliminate any CFG nodes that are not executable because of the constant values deterining the control flow.

Specified by:
perform in class Optimization