dk.brics.xact.analysis.transformations
Class ReachingDefinitionsAnalysis

java.lang.Object
  extended by dk.brics.xact.analysis.transformations.ReachingDefinitionsAnalysis
All Implemented Interfaces:
AnalysisInterface<Map<Variable,Set<Assignment>>>

public class ReachingDefinitionsAnalysis
extends Object
implements AnalysisInterface<Map<Variable,Set<Assignment>>>

Lattice and transfer functions for reaching definitions analysis. Maps each variable to a set of all statements that may assign to that variable.


Constructor Summary
ReachingDefinitionsAnalysis()
          Constructs a new analysis object.
 
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(Map<Variable,Set<Assignment>> source, VariableFilter filter, Map<Variable,Set<Assignment>> dest)
          Computes the least upper bound of two lattice elements.
 Map<Variable,Set<Assignment>> newBottomElement()
          Constructs a new lattice bottom element.
 boolean transfer(Map<Variable,Set<Assignment>> in, Statement s, Map<Variable,Set<Assignment>> 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

ReachingDefinitionsAnalysis

public ReachingDefinitionsAnalysis()
Constructs a new analysis object.

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<Map<Variable,Set<Assignment>>>
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<Map<Variable,Set<Assignment>>>

merge

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

Specified by:
merge in interface AnalysisInterface<Map<Variable,Set<Assignment>>>
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 Map<Variable,Set<Assignment>> newBottomElement()
Description copied from interface: AnalysisInterface
Constructs a new lattice bottom element.

Specified by:
newBottomElement in interface AnalysisInterface<Map<Variable,Set<Assignment>>>

transfer

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

Specified by:
transfer in interface AnalysisInterface<Map<Variable,Set<Assignment>>>
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.