ROSE  0.11.98.0
Public Types | Public Member Functions | List of all members
Rose::BinaryAnalysis::DataFlow::Engine< CFG, State, TransferFunction, MergeFunction, PathFeasibility > Class Template Reference

Description

template<class CFG, class State, class TransferFunction, class MergeFunction, class PathFeasibility = PathAlwaysFeasible<CFG, State>>
class Rose::BinaryAnalysis::DataFlow::Engine< CFG, State, TransferFunction, MergeFunction, PathFeasibility >

Data-flow engine.

The data-flow engine traverses the supplied control flow graph, runs the transfer function at each vertex, and merges data state objects as necessary.

The template arguments are:

A common configuration for an engine is to use a control-flow graph whose vertices are basic blocks, whose State is a pointer to an instruction semantics state, whose TransferFunction calls Dispatcher::processInstruction, and whose MergeFunction calls the state's merge method.

The control flow graph and transfer function are specified in the engine's constructor. The starting CFG vertex and its initial state are supplied when the engine starts to run.

Definition at line 312 of file DataFlow.h.

#include <Rose/BinaryAnalysis/DataFlow.h>

Public Types

typedef std::vector< State > VertexStates
 Data-flow states indexed by vertex ID. More...
 

Public Member Functions

 Engine (const CFG &cfg, TransferFunction &xfer, MergeFunction merge=MergeFunction(), PathFeasibility isFeasible=PathFeasibility())
 Constructor. More...
 
const CFG & cfg () const
 Data-flow control flow graph. More...
 
void reset (State initialState=State())
 Reset engine to initial state. More...
 
std::string prefix () const
 Line prefix for debugging. More...
 
size_t nIterations () const
 Number of iterations run. More...
 
bool runOneIteration ()
 Runs one iteration. More...
 
void insertStartingVertex (size_t startVertexId, const State &initialState)
 Add a starting vertex. More...
 
void runToFixedPoint ()
 Run data-flow until it reaches a fixed point. More...
 
void runToFixedPoint (size_t startVertexId, const State &initialState)
 Add starting point and run to fixed point. More...
 
State getInitialState (size_t cfgVertexId) const
 Return the incoming state for the specified CFG vertex. More...
 
void setInitialState (size_t cfgVertexId, State state)
 Set the initial state for the specified CFG vertex. More...
 
State getFinalState (size_t cfgVertexId) const
 Return the outgoing state for the specified CFG vertex. More...
 
const VertexStatesgetInitialStates () const
 All incoming states. More...
 
const VertexStatesgetFinalStates () const
 All outgoing states. More...
 
const std::string & name () const
 Property: Name for debugging. More...
 
void name (const std::string &s)
 Property: Name for debugging. More...
 
size_t maxIterations () const
 Max number of iterations to allow. More...
 
void maxIterations (size_t n)
 Max number of iterations to allow. More...
 

Member Typedef Documentation

template<class CFG, class State, class TransferFunction, class MergeFunction, class PathFeasibility = PathAlwaysFeasible<CFG, State>>
typedef std::vector<State> Rose::BinaryAnalysis::DataFlow::Engine< CFG, State, TransferFunction, MergeFunction, PathFeasibility >::VertexStates

Data-flow states indexed by vertex ID.

Definition at line 314 of file DataFlow.h.

Constructor & Destructor Documentation

template<class CFG, class State, class TransferFunction, class MergeFunction, class PathFeasibility = PathAlwaysFeasible<CFG, State>>
Rose::BinaryAnalysis::DataFlow::Engine< CFG, State, TransferFunction, MergeFunction, PathFeasibility >::Engine ( const CFG &  cfg,
TransferFunction &  xfer,
MergeFunction  merge = MergeFunction(),
PathFeasibility  isFeasible = PathFeasibility() 
)
inline

Constructor.

Constructs a new data-flow engine that will operate over the specified control flow graph using the specified transfer function. The control flow graph is incorporated into the engine by reference; the transfer functor is copied.

Definition at line 335 of file DataFlow.h.

References Rose::BinaryAnalysis::DataFlow::Engine< CFG, State, TransferFunction, MergeFunction, PathFeasibility >::reset().

Member Function Documentation

template<class CFG, class State, class TransferFunction, class MergeFunction, class PathFeasibility = PathAlwaysFeasible<CFG, State>>
const CFG& Rose::BinaryAnalysis::DataFlow::Engine< CFG, State, TransferFunction, MergeFunction, PathFeasibility >::cfg ( ) const
inline

Data-flow control flow graph.

Returns a reference to the control flow graph that's being used for the data-flow analysis. The return value is the same control flow graph as which was supplied to the constructor.

Definition at line 345 of file DataFlow.h.

template<class CFG, class State, class TransferFunction, class MergeFunction, class PathFeasibility = PathAlwaysFeasible<CFG, State>>
void Rose::BinaryAnalysis::DataFlow::Engine< CFG, State, TransferFunction, MergeFunction, PathFeasibility >::reset ( State  initialState = State())
inline
template<class CFG, class State, class TransferFunction, class MergeFunction, class PathFeasibility = PathAlwaysFeasible<CFG, State>>
const std::string& Rose::BinaryAnalysis::DataFlow::Engine< CFG, State, TransferFunction, MergeFunction, PathFeasibility >::name ( ) const
inline

Property: Name for debugging.

This optional name will show up in debugging output.

Definition at line 365 of file DataFlow.h.

Referenced by Rose::BinaryAnalysis::TaintedFlow::runToFixedPoint().

template<class CFG, class State, class TransferFunction, class MergeFunction, class PathFeasibility = PathAlwaysFeasible<CFG, State>>
void Rose::BinaryAnalysis::DataFlow::Engine< CFG, State, TransferFunction, MergeFunction, PathFeasibility >::name ( const std::string &  s)
inline

Property: Name for debugging.

This optional name will show up in debugging output.

Definition at line 366 of file DataFlow.h.

template<class CFG, class State, class TransferFunction, class MergeFunction, class PathFeasibility = PathAlwaysFeasible<CFG, State>>
std::string Rose::BinaryAnalysis::DataFlow::Engine< CFG, State, TransferFunction, MergeFunction, PathFeasibility >::prefix ( ) const
inline
template<class CFG, class State, class TransferFunction, class MergeFunction, class PathFeasibility = PathAlwaysFeasible<CFG, State>>
size_t Rose::BinaryAnalysis::DataFlow::Engine< CFG, State, TransferFunction, MergeFunction, PathFeasibility >::maxIterations ( ) const
inline

Max number of iterations to allow.

Allow N number of calls to runOneIteration. When the limit is exceeded a NotConverging exception is thrown.

Definition at line 384 of file DataFlow.h.

template<class CFG, class State, class TransferFunction, class MergeFunction, class PathFeasibility = PathAlwaysFeasible<CFG, State>>
void Rose::BinaryAnalysis::DataFlow::Engine< CFG, State, TransferFunction, MergeFunction, PathFeasibility >::maxIterations ( size_t  n)
inline

Max number of iterations to allow.

Allow N number of calls to runOneIteration. When the limit is exceeded a NotConverging exception is thrown.

Definition at line 385 of file DataFlow.h.

template<class CFG, class State, class TransferFunction, class MergeFunction, class PathFeasibility = PathAlwaysFeasible<CFG, State>>
size_t Rose::BinaryAnalysis::DataFlow::Engine< CFG, State, TransferFunction, MergeFunction, PathFeasibility >::nIterations ( ) const
inline

Number of iterations run.

The number of times runOneIteration was called since the last reset.

Definition at line 391 of file DataFlow.h.

template<class CFG, class State, class TransferFunction, class MergeFunction, class PathFeasibility = PathAlwaysFeasible<CFG, State>>
bool Rose::BinaryAnalysis::DataFlow::Engine< CFG, State, TransferFunction, MergeFunction, PathFeasibility >::runOneIteration ( )
inline
template<class CFG, class State, class TransferFunction, class MergeFunction, class PathFeasibility = PathAlwaysFeasible<CFG, State>>
void Rose::BinaryAnalysis::DataFlow::Engine< CFG, State, TransferFunction, MergeFunction, PathFeasibility >::insertStartingVertex ( size_t  startVertexId,
const State &  initialState 
)
inline
template<class CFG, class State, class TransferFunction, class MergeFunction, class PathFeasibility = PathAlwaysFeasible<CFG, State>>
void Rose::BinaryAnalysis::DataFlow::Engine< CFG, State, TransferFunction, MergeFunction, PathFeasibility >::runToFixedPoint ( )
inline

Run data-flow until it reaches a fixed point.

Run data-flow starting at the specified control flow vertex with the specified initial state until the state converges to a fixed point or the maximum number of iterations is reached (in which case a NotConverging exception is thrown).

Definition at line 464 of file DataFlow.h.

References Rose::BinaryAnalysis::DataFlow::Engine< CFG, State, TransferFunction, MergeFunction, PathFeasibility >::runOneIteration().

Referenced by Rose::BinaryAnalysis::TaintedFlow::runToFixedPoint().

template<class CFG, class State, class TransferFunction, class MergeFunction, class PathFeasibility = PathAlwaysFeasible<CFG, State>>
void Rose::BinaryAnalysis::DataFlow::Engine< CFG, State, TransferFunction, MergeFunction, PathFeasibility >::runToFixedPoint ( size_t  startVertexId,
const State &  initialState 
)
inline
template<class CFG, class State, class TransferFunction, class MergeFunction, class PathFeasibility = PathAlwaysFeasible<CFG, State>>
State Rose::BinaryAnalysis::DataFlow::Engine< CFG, State, TransferFunction, MergeFunction, PathFeasibility >::getInitialState ( size_t  cfgVertexId) const
inline

Return the incoming state for the specified CFG vertex.

This is a pointer to the incoming state for the vertex as of the latest data-flow iteration. If the data-flow has not reached this vertex then it is likely to be a null pointer.

Definition at line 481 of file DataFlow.h.

template<class CFG, class State, class TransferFunction, class MergeFunction, class PathFeasibility = PathAlwaysFeasible<CFG, State>>
void Rose::BinaryAnalysis::DataFlow::Engine< CFG, State, TransferFunction, MergeFunction, PathFeasibility >::setInitialState ( size_t  cfgVertexId,
State  state 
)
inline

Set the initial state for the specified CFG vertex.

Definition at line 486 of file DataFlow.h.

template<class CFG, class State, class TransferFunction, class MergeFunction, class PathFeasibility = PathAlwaysFeasible<CFG, State>>
State Rose::BinaryAnalysis::DataFlow::Engine< CFG, State, TransferFunction, MergeFunction, PathFeasibility >::getFinalState ( size_t  cfgVertexId) const
inline

Return the outgoing state for the specified CFG vertex.

This is a pointer to the outgoing state for the vertex as of the latest data-flow iteration. If the data-flow has not processed this vertex then it is likely to be a null pointer.

Definition at line 494 of file DataFlow.h.

template<class CFG, class State, class TransferFunction, class MergeFunction, class PathFeasibility = PathAlwaysFeasible<CFG, State>>
const VertexStates& Rose::BinaryAnalysis::DataFlow::Engine< CFG, State, TransferFunction, MergeFunction, PathFeasibility >::getInitialStates ( ) const
inline

All incoming states.

Returns a vector indexed by vertex ID for the incoming state of each vertex as of the latest data-flow iteration. States for vertices that have not yet been reached are null pointers.

Definition at line 502 of file DataFlow.h.

template<class CFG, class State, class TransferFunction, class MergeFunction, class PathFeasibility = PathAlwaysFeasible<CFG, State>>
const VertexStates& Rose::BinaryAnalysis::DataFlow::Engine< CFG, State, TransferFunction, MergeFunction, PathFeasibility >::getFinalStates ( ) const
inline

All outgoing states.

Returns a vector indexed by vertex ID for the outgoing state of each vertex as of the latest data-flow iteration. States for vertices that have not yet been processed are null pointers.

Definition at line 510 of file DataFlow.h.

Referenced by Rose::BinaryAnalysis::TaintedFlow::runToFixedPoint().


The documentation for this class was generated from the following file: