soot.toolkits.scalar
Class FlowAnalysis

java.lang.Object
  |
  +--soot.toolkits.scalar.FlowAnalysis
Direct Known Subclasses:
BackwardFlowAnalysis, ForwardFlowAnalysis

public abstract class FlowAnalysis
extends java.lang.Object

An abstract class providing a framework for carrying out dataflow analysis. Subclassing either BackwardFlowAnalysis or ForwardFlowAnalysis and providing implementations for the abstract methods will allow Soot to compute the corresponding flow analysis.


Field Summary
protected  DirectedGraph graph
          The graph being analysed.
protected  java.util.Map unitToAfterFlow
          Maps graph nodes to OUT sets.
protected  java.util.Map unitToBeforeFlow
          Maps graph nodes to IN sets.
 
Constructor Summary
FlowAnalysis(DirectedGraph graph)
          Constructs a flow analysis on the given DirectedGraph.
 
Method Summary
protected abstract  void copy(java.lang.Object source, java.lang.Object dest)
          Creates a copy of the source flow object in dest.
protected  void customizeInitialFlowGraph()
          Customize the initial flow graph.
protected abstract  void doAnalysis()
          Carries out the actual flow analysis.
protected abstract  void flowThrough(java.lang.Object in, java.lang.Object d, java.lang.Object out)
          Given the merge of the out sets, compute the in set for s.
 java.lang.Object getFlowAfter(java.lang.Object s)
          Accessor function returning value of OUT set for s.
 java.lang.Object getFlowBefore(java.lang.Object s)
          Accessor function returning value of IN set for s.
protected abstract  boolean isForward()
          Returns true if this analysis is forwards.
protected abstract  void merge(java.lang.Object in1, java.lang.Object in2, java.lang.Object out)
          Compute the merge of the in1 and in2 sets, putting the result into out.
protected abstract  java.lang.Object newInitialFlow()
          Returns the flow object corresponding to the initial values for each graph node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

unitToBeforeFlow

protected java.util.Map unitToBeforeFlow
Maps graph nodes to IN sets.

unitToAfterFlow

protected java.util.Map unitToAfterFlow
Maps graph nodes to OUT sets.

graph

protected DirectedGraph graph
The graph being analysed.
Constructor Detail

FlowAnalysis

public FlowAnalysis(DirectedGraph graph)
Constructs a flow analysis on the given DirectedGraph.
Method Detail

newInitialFlow

protected abstract java.lang.Object newInitialFlow()
Returns the flow object corresponding to the initial values for each graph node.

isForward

protected abstract boolean isForward()
Returns true if this analysis is forwards.

flowThrough

protected abstract void flowThrough(java.lang.Object in,
                                    java.lang.Object d,
                                    java.lang.Object out)
Given the merge of the out sets, compute the in set for s.

merge

protected abstract void merge(java.lang.Object in1,
                              java.lang.Object in2,
                              java.lang.Object out)
Compute the merge of the in1 and in2 sets, putting the result into out. The behavior of this function depends on the implementation ( it may be necessary to check whether in1 and in2 are equal or aliased ). Used by the doAnalysis method.

copy

protected abstract void copy(java.lang.Object source,
                             java.lang.Object dest)
Creates a copy of the source flow object in dest.

doAnalysis

protected abstract void doAnalysis()
Carries out the actual flow analysis. Typically called from a concrete FlowAnalysis's constructor.

customizeInitialFlowGraph

protected void customizeInitialFlowGraph()
Customize the initial flow graph. May be called from a concrete FlowAnalysis constructor to adjust, for instance, the value for the initial node.

getFlowAfter

public java.lang.Object getFlowAfter(java.lang.Object s)
Accessor function returning value of OUT set for s.

getFlowBefore

public java.lang.Object getFlowBefore(java.lang.Object s)
Accessor function returning value of IN set for s.