Class AbstractFlowAnalysis<F>

java.lang.Object
sootup.analysis.intraprocedural.AbstractFlowAnalysis<F>
Type Parameters:
F - abstraction type for the Facts
Direct Known Subclasses:
FlowAnalysis

public abstract class AbstractFlowAnalysis<F> extends Object
An abstract class providing a meta-framework for carrying out dataflow analysis. This class provides common methods and fields required by the BranchedFlowAnalysis and FlowAnalysis abstract classes.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final StmtGraph<? extends BasicBlock<?>>
    The graph being analysed.
    protected final Map<Stmt,F>
    Maps graph nodes to IN sets.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a flow analysis on the given StmtGraph.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected abstract void
    copy(F source, F dest)
    Creates a copy of the source flow object in dest.
    protected F
    Returns the initial flow value for entry/ exit graph nodes.
    protected abstract void
    Carries out the actual flow analysis.
    Accessor function returning value of IN set for s.
    protected abstract boolean
    Returns true if this analysis is forwards.
    protected abstract void
    merge(F in1, F in2, F out)
    Compute the merge of the in1 and in2 sets, putting the result into out.
    protected void
    merge(Stmt succNode, F in1, F in2, F out)
    Merges in1 and in2 into out, just before node succNode.
    protected void
    mergeInto(Stmt succNode, F inout, F in)
    Merges in into inout, just before node succNode.
    protected abstract F
    Returns the flow object corresponding to the initial values for each graph node.
    protected boolean
    Determines whether entryInitialFlow() is applied to trap handlers.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • graph

      protected final StmtGraph<? extends BasicBlock<?>> graph
      The graph being analysed.
    • stmtToBeforeFlow

      protected final Map<Stmt,F> stmtToBeforeFlow
      Maps graph nodes to IN sets.
  • Constructor Details

    • AbstractFlowAnalysis

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

    • newInitialFlow

      @Nonnull protected abstract F newInitialFlow()
      Returns the flow object corresponding to the initial values for each graph node.
    • entryInitialFlow

      protected F entryInitialFlow()
      Returns the initial flow value for entry/ exit graph nodes.
    • treatTrapHandlersAsEntries

      protected boolean treatTrapHandlersAsEntries()
      Determines whether entryInitialFlow() is applied to trap handlers.
    • isForward

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

      protected abstract void merge(@Nonnull F in1, @Nonnull F in2, @Nonnull F 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.
    • merge

      protected void merge(@Nonnull Stmt succNode, @Nonnull F in1, @Nonnull F in2, @Nonnull F out)
      Merges in1 and in2 into out, just before node succNode. By default, this method just calls merge(A,A,A), ignoring the node.
    • copy

      protected abstract void copy(@Nonnull F source, @Nonnull F dest)
      Creates a copy of the source flow object in dest.
    • execute

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

      @Nonnull public F getFlowBefore(@Nonnull Stmt s)
      Accessor function returning value of IN set for s.
    • mergeInto

      protected void mergeInto(@Nonnull Stmt succNode, @Nonnull F inout, @Nonnull F in)
      Merges in into inout, just before node succNode.