soot.jimple.toolkits.scalar.pre
Class EarliestnessComputation

java.lang.Object
  extended by soot.jimple.toolkits.scalar.pre.EarliestnessComputation

public class EarliestnessComputation
extends Object

Computes the earliest points for the given expressions.
This basicly finds the highest point in the flow-graph where we can put each computation, without introducing new computations on any path.
More technically: A computation is earliest, if at the current point the computation is down-safe, and if either:


Intuitively: If the one predecessor is not transparent, we can't push the computation further up. If one of the predecessor is not safe, we would introduce a new computation on its path. Hence we can't push further up.

Note that this computation is linear in the number of units, as we don't need to find any fixed-point.

See Also:
UpSafetyAnalysis, DownSafetyAnalysis

Constructor Summary
EarliestnessComputation(UnitGraph unitGraph, UpSafetyAnalysis upSafe, DownSafetyAnalysis downSafe, SideEffectTester sideEffect)
          given an UpSafetyAnalysis and a DownSafetyAnalysis, performs the earliest-computation.
EarliestnessComputation(UnitGraph unitGraph, UpSafetyAnalysis upSafe, DownSafetyAnalysis downSafe, SideEffectTester sideEffect, FlowSet set)
          given an UpSafetyAnalysis and a DownSafetyAnalysis, performs the earliest-computation.
allows to share sets over multiple analyses (set-operations are usually more efficient, if the sets come from the same source).
 
Method Summary
 Object getFlowBefore(Object node)
          returns the FlowSet of expressions, that have their earliest computation just before node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EarliestnessComputation

public EarliestnessComputation(UnitGraph unitGraph,
                               UpSafetyAnalysis upSafe,
                               DownSafetyAnalysis downSafe,
                               SideEffectTester sideEffect)
given an UpSafetyAnalysis and a DownSafetyAnalysis, performs the earliest-computation.

Parameters:
unitGraph - the Unitgraph we'll work on.
upSafe - a UpSafetyAnalysis of unitGraph
downSafe - a DownSafetyAnalysis of unitGraph
sideEffect - the SideEffectTester that will tell if a node is transparent or not.

EarliestnessComputation

public EarliestnessComputation(UnitGraph unitGraph,
                               UpSafetyAnalysis upSafe,
                               DownSafetyAnalysis downSafe,
                               SideEffectTester sideEffect,
                               FlowSet set)
given an UpSafetyAnalysis and a DownSafetyAnalysis, performs the earliest-computation.
allows to share sets over multiple analyses (set-operations are usually more efficient, if the sets come from the same source).

Parameters:
unitGraph - the Unitgraph we'll work on.
upSafe - a UpSafetyAnalysis of unitGraph
downSafe - a DownSafetyAnalysis of unitGraph
sideEffect - the SideEffectTester that will tell if a node is transparent or not.
set - the shared set.
Method Detail

getFlowBefore

public Object getFlowBefore(Object node)
returns the FlowSet of expressions, that have their earliest computation just before node.

Parameters:
node - a Object of the flow-graph (in our case always a unit).
Returns:
a FlowSet containing the expressions.