Class FlowAnalysis<A>

java.lang.Object
sootup.analysis.intraprocedural.AbstractFlowAnalysis<A>
sootup.analysis.intraprocedural.FlowAnalysis<A>
Direct Known Subclasses:
BackwardFlowAnalysis, ForwardFlowAnalysis

public abstract class FlowAnalysis<A> extends AbstractFlowAnalysis<A>
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 Details

    • stmtToAfterFlow

      @Nonnull protected final Map<Stmt,A> stmtToAfterFlow
      Maps graph nodes to OUT sets.
    • filterStmtToAfterFlow

      @Nonnull protected Map<Stmt,A> filterStmtToAfterFlow
      Filtered: Maps graph nodes to OUT sets.
  • Constructor Details

    • FlowAnalysis

      public FlowAnalysis(@Nonnull StmtGraph<? extends BasicBlock<?>> graph)
      Constructs a flow analysis on the given DirectedGraph.
  • Method Details

    • flowThrough

      protected abstract void flowThrough(@Nonnull A in, Stmt d, @Nonnull A out)
      Given the merge of the out sets, compute the in set for s (or in to out, depending on direction).

      This function often causes confusion, because the same interface is used for both forward and backward flow analyses. The first parameter is always the argument to the flow function (i.e. it is the "in" set in a forward analysis and the "out" set in a backward analysis), and the third parameter is always the result of the flow function (i.e. it is the "out" set in a forward analysis and the "in" set in a backward analysis).

      Parameters:
      in - the input flow
      d - the current node
      out - the returned flow
    • getFlowAfter

      public A getFlowAfter(@Nonnull Stmt s)
      Accessor function returning value of OUT set for s.
    • getFlowBefore

      @Nonnull public A getFlowBefore(@Nonnull Stmt s)
      Description copied from class: AbstractFlowAnalysis
      Accessor function returning value of IN set for s.
      Overrides:
      getFlowBefore in class AbstractFlowAnalysis<A>
    • omissible

      protected boolean omissible(@Nonnull Stmt stmt)
      If a flow node can be omitted return true, otherwise false. There is no guarantee a node will be omitted. A omissible node does not influence the result of an analysis.

      If you are unsure, don't overwrite this method

      Parameters:
      stmt - the node to check
      Returns:
      false
    • getFlow

      protected FlowAnalysis.Flow getFlow(@Nonnull Stmt from, @Nonnull Stmt mergeNode)
      You can specify which flow set you would like to use of node from
      Parameters:
      from -
      mergeNode -
      Returns:
      Flow.OUT