scale.score.trans
Class SFIR

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

public class SFIR
extends Optimization

This class replaces references to fields of C structures with references to local variables.

$Id: SFIR.java,v 1.25 2007-08-10 14:35:19 burrill Exp $

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

This optimization attempts to replace multiple references to a field of a struct variable with a reference to a surrogate variable (allocated to a register) in the hopes of eliminating references to memory.

If the variable is used just within one function, the variable is never referenced as a whole, no aliases are created for any field, and it is not possible for any of the fields of the variable to be referenced outside of the function, each field of the variable may be replaced with a new variable that may be allocted to memory. In these circumstances, the struct is eliminated all together.

Register pressure is always increased because a new variable is introduced that has a live range that is always greater than the live range of the reference to the struct field it represents.

A transformation is legal if:

It is beneficial if:


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
SFIR(Scribble scribble)
           
 
Method Summary
static int newCFGNodes()
          Return the number of new nodes created.
static int outOfLoops()
          Return the current number of loads placed outside of loops.
 void perform()
          Perform the optimization.
static int replacedLoads()
          Return the current number of array loads replaced.
 int requiresSSA()
          Specify that this optimization requires that the CFG NOT be in SSA form.
static int varsEliminated()
          Return the number of struct variables eliminated..
 
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

SFIR

public SFIR(Scribble scribble)
Method Detail

replacedLoads

public static int replacedLoads()
Return the current number of array loads replaced.


outOfLoops

public static int outOfLoops()
Return the current number of loads placed outside of loops.


newCFGNodes

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


varsEliminated

public static int varsEliminated()
Return the number of struct variables eliminated..


perform

public void perform()
Description copied from class: Optimization
Perform the optimization. Each optimization must specify after it completes. The Scribble class provides methods that may be used to sepcify this information.

Specified by:
perform in class Optimization

requiresSSA

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

Overrides:
requiresSSA in class Optimization