dk.brics.xact.analysis.dataflow
Class VariableAnalysis<VariableElementType>

java.lang.Object
  extended by dk.brics.xact.analysis.dataflow.VariableAnalysis<VariableElementType>
All Implemented Interfaces:
AnalysisInterface<VariableAnalysisElement<VariableElementType>>

public class VariableAnalysis<VariableElementType>
extends Object
implements AnalysisInterface<VariableAnalysisElement<VariableElementType>>

Lattice and transfer functions for a dataflow analysis that tracks values for program variables.


Constructor Summary
VariableAnalysis(VariableAnalysisInterface<VariableElementType> val)
          Constructs a new variable analysis using the given lattice.
 
Method Summary
 Set<Statement> getInitial(FlowGraph g)
          Returns the set of statements to start the analysis at.
 boolean isForward()
          Returns true if this is a forwards analysis, and false if it is a backwards analysis.
 boolean merge(VariableAnalysisElement<VariableElementType> source, VariableFilter filter, VariableAnalysisElement<VariableElementType> dest)
          Computes the least upper bound of two lattice elements.
 VariableAnalysisElement<VariableElementType> newBottomElement()
          Constructs a new lattice bottom element.
 boolean transfer(VariableAnalysisElement<VariableElementType> in, Statement s, VariableAnalysisElement<VariableElementType> out)
          Computes the lattice element resulting from flowing through the given statement.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VariableAnalysis

public VariableAnalysis(VariableAnalysisInterface<VariableElementType> val)
Constructs a new variable analysis using the given lattice.

Method Detail

getInitial

public Set<Statement> getInitial(FlowGraph g)
Description copied from interface: AnalysisInterface
Returns the set of statements to start the analysis at. For forwards analyses, the graph's entry points are usually the correct return value.

Specified by:
getInitial in interface AnalysisInterface<VariableAnalysisElement<VariableElementType>>
Parameters:
g - the flow graph about to be analyzed
Returns:
an unmodifiable set of statements.

isForward

public boolean isForward()
Description copied from interface: AnalysisInterface
Returns true if this is a forwards analysis, and false if it is a backwards analysis.

Specified by:
isForward in interface AnalysisInterface<VariableAnalysisElement<VariableElementType>>

merge

public boolean merge(VariableAnalysisElement<VariableElementType> source,
                     VariableFilter filter,
                     VariableAnalysisElement<VariableElementType> dest)
Description copied from interface: AnalysisInterface
Computes the least upper bound of two lattice elements.

Specified by:
merge in interface AnalysisInterface<VariableAnalysisElement<VariableElementType>>
Parameters:
source - the first element
filter - the filter to merge through
dest - the second element and destination for the result
Returns:
true if the new value of dest is changed

newBottomElement

public VariableAnalysisElement<VariableElementType> newBottomElement()
Description copied from interface: AnalysisInterface
Constructs a new lattice bottom element.

Specified by:
newBottomElement in interface AnalysisInterface<VariableAnalysisElement<VariableElementType>>

transfer

public boolean transfer(VariableAnalysisElement<VariableElementType> in,
                        Statement s,
                        VariableAnalysisElement<VariableElementType> out)
Description copied from interface: AnalysisInterface
Computes the lattice element resulting from flowing through the given statement.

Specified by:
transfer in interface AnalysisInterface<VariableAnalysisElement<VariableElementType>>
Parameters:
in - the flow before the statement
out - destination for the result
Returns:
true if the new value of out is changed


Copyright © 2005-2011 Aarhus University.