harpoon.Analysis.Quads.SCC
Class SCCAnalysis

java.lang.Object
  extended by harpoon.Analysis.Quads.SCC.SCCAnalysis
All Implemented Interfaces:
ConstMap, ExactTypeMap, ExecMap, TypeMap

public class SCCAnalysis
extends Object
implements ExactTypeMap, ConstMap, ExecMap

SCCAnalysis implements Sparse Conditional Constant Propagation, with extensions to allow type and bitwidth analysis. Fun, fun, fun.

Only works with quads in SSI form.

Version:
$Id: SCCAnalysis.java,v 1.8 2005/09/29 04:03:25 salcianu Exp $
Author:
C. Scott Ananian <cananian@alumni.princeton.edu>

Nested Class Summary
 
Nested classes/interfaces inherited from interface harpoon.Analysis.Maps.ExactTypeMap
ExactTypeMap.ExactType
 
Nested classes/interfaces inherited from interface harpoon.Analysis.Maps.TypeMap
TypeMap.TypeNotKnownException
 
Constructor Summary
SCCAnalysis(HCode hc)
          Creates a SCC, and uses UseDef for the UseDefMap.
SCCAnalysis(HCode hc, UseDefMap usedef)
          Creates a SCC.
 
Method Summary
 Object constMap(HCodeElement hce, Temp t)
          Determine the constant value of Temp t.
 boolean execMap(HCodeEdge edge)
          Determine whether Edge e is executable.
 boolean execMap(HCodeElement quad)
          Determine whether Quad q is executable.
 boolean isConst(HCodeElement hce, Temp t)
          Determine whether Temp t has a constant value.
 boolean isExactType(HCodeElement hce, Temp t)
          Determine whether the static type of Temp t defined at hce is exact (or whether the runtime type could be a subclass of the static type).
 boolean isPossiblyNull(HCodeElement hce, Temp t)
          Determine whether the given Temp can possibly be null.
 int minusWidthMap(HCodeElement hce, Temp t)
          Determine the negative bit width of Temp t.
 int plusWidthMap(HCodeElement hce, Temp t)
          Determine the positive bit width of Temp t.
 HClass typeMap(HCodeElement hce, Temp t)
          Determine the static type of Temp t in HMethod m.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SCCAnalysis

public SCCAnalysis(HCode hc,
                   UseDefMap usedef)
Creates a SCC.


SCCAnalysis

public SCCAnalysis(HCode hc)
Creates a SCC, and uses UseDef for the UseDefMap.

Method Detail

execMap

public boolean execMap(HCodeElement quad)
Determine whether Quad q is executable.

Specified by:
execMap in interface ExecMap
Parameters:
quad - The HCodeElement to examine.
Returns:
true if it is possible to execute this HCodeElement; or false if it can be proved that this HCodeElement will never be executed.

execMap

public boolean execMap(HCodeEdge edge)
Determine whether Edge e is executable.

Specified by:
execMap in interface ExecMap
Parameters:
edge - An edge between two HCodeElements in some HCode.
Returns:
true if it is possible to traverse this edge during execution, or false if it can be proved that this edge will never be followed.

typeMap

public HClass typeMap(HCodeElement hce,
                      Temp t)
Determine the static type of Temp t in HMethod m.

Specified by:
typeMap in interface TypeMap
Parameters:
hce - The HCodeElement defining t.
t - The temporary to examine.
Returns:
the static type of t.

isExactType

public boolean isExactType(HCodeElement hce,
                           Temp t)
Determine whether the static type of Temp t defined at hce is exact (or whether the runtime type could be a subclass of the static type).

Specified by:
isExactType in interface ExactTypeMap
Parameters:
hce - The HCodeElement defining t for this request.
t - The Temp to examine.
Returns:
true if t's type is exact, false otherwise.

isPossiblyNull

public boolean isPossiblyNull(HCodeElement hce,
                              Temp t)
Determine whether the given Temp can possibly be null.


isConst

public boolean isConst(HCodeElement hce,
                       Temp t)
Determine whether Temp t has a constant value.

Specified by:
isConst in interface ConstMap
Parameters:
hce - the definition point.
t - the Temp to be examined.
Returns:
true is the given definition point can be proven to give the specified Temp a constant value, false otherwise.

constMap

public Object constMap(HCodeElement hce,
                       Temp t)
Determine the constant value of Temp t.

Specified by:
constMap in interface ConstMap
Parameters:
hce - the definition point.
t - the temporary to be examined.
Returns:
an object corresponding to the constant value of this temporary defined at this point. Values of base types get wrapped in objects in the standard way.
Throws:
Error - if Temp t is not a constant.

plusWidthMap

public int plusWidthMap(HCodeElement hce,
                        Temp t)
Determine the positive bit width of Temp t.


minusWidthMap

public int minusWidthMap(HCodeElement hce,
                         Temp t)
Determine the negative bit width of Temp t.