ROSE 0.11.145.147
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 315 of file DataFlow.h.

#include <Rose/BinaryAnalysis/DataFlow.h>

Public Types

using Cfg = Cfg_
 Type of the data-flow control flow graph.
 
using State = State_
 Type of the states stored at each CFG vertex.
 
using TransferFunction = TransferFunction_
 Type of the transfer function that creates new states.
 
using MergeFunction = MergeFunction_
 Type of the function that merges two states into a single state.
 
using PathFeasibility = PathFeasibility_
 Predicate testing whether certain CFG edges should be followed.
 
using VertexStates = std::vector< State >
 Vector of states per vertex.
 
using CFG = Cfg_
 

Public Member Functions

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

Member Typedef Documentation

◆ Cfg

template<class Cfg_ , class State_ , class TransferFunction_ , class MergeFunction_ , class PathFeasibility_ = PathAlwaysFeasible<Cfg_, State_>>
using Rose::BinaryAnalysis::DataFlow::Engine< Cfg_, State_, TransferFunction_, MergeFunction_, PathFeasibility_ >::Cfg = Cfg_

Type of the data-flow control flow graph.

Definition at line 317 of file DataFlow.h.

◆ State

template<class Cfg_ , class State_ , class TransferFunction_ , class MergeFunction_ , class PathFeasibility_ = PathAlwaysFeasible<Cfg_, State_>>
using Rose::BinaryAnalysis::DataFlow::Engine< Cfg_, State_, TransferFunction_, MergeFunction_, PathFeasibility_ >::State = State_

Type of the states stored at each CFG vertex.

Definition at line 318 of file DataFlow.h.

◆ TransferFunction

template<class Cfg_ , class State_ , class TransferFunction_ , class MergeFunction_ , class PathFeasibility_ = PathAlwaysFeasible<Cfg_, State_>>
using Rose::BinaryAnalysis::DataFlow::Engine< Cfg_, State_, TransferFunction_, MergeFunction_, PathFeasibility_ >::TransferFunction = TransferFunction_

Type of the transfer function that creates new states.

Definition at line 319 of file DataFlow.h.

◆ MergeFunction

template<class Cfg_ , class State_ , class TransferFunction_ , class MergeFunction_ , class PathFeasibility_ = PathAlwaysFeasible<Cfg_, State_>>
using Rose::BinaryAnalysis::DataFlow::Engine< Cfg_, State_, TransferFunction_, MergeFunction_, PathFeasibility_ >::MergeFunction = MergeFunction_

Type of the function that merges two states into a single state.

Definition at line 320 of file DataFlow.h.

◆ PathFeasibility

template<class Cfg_ , class State_ , class TransferFunction_ , class MergeFunction_ , class PathFeasibility_ = PathAlwaysFeasible<Cfg_, State_>>
using Rose::BinaryAnalysis::DataFlow::Engine< Cfg_, State_, TransferFunction_, MergeFunction_, PathFeasibility_ >::PathFeasibility = PathFeasibility_

Predicate testing whether certain CFG edges should be followed.

Definition at line 321 of file DataFlow.h.

◆ VertexStates

template<class Cfg_ , class State_ , class TransferFunction_ , class MergeFunction_ , class PathFeasibility_ = PathAlwaysFeasible<Cfg_, State_>>
using Rose::BinaryAnalysis::DataFlow::Engine< Cfg_, State_, TransferFunction_, MergeFunction_, PathFeasibility_ >::VertexStates = std::vector<State>

Vector of states per vertex.

Definition at line 322 of file DataFlow.h.

◆ CFG

template<class Cfg_ , class State_ , class TransferFunction_ , class MergeFunction_ , class PathFeasibility_ = PathAlwaysFeasible<Cfg_, State_>>
using Rose::BinaryAnalysis::DataFlow::Engine< Cfg_, State_, TransferFunction_, MergeFunction_, PathFeasibility_ >::CFG = Cfg_

Definition at line 324 of file DataFlow.h.

Constructor & Destructor Documentation

◆ Engine()

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 345 of file DataFlow.h.

References Rose::BinaryAnalysis::DataFlow::Engine< Cfg_, State_, TransferFunction_, MergeFunction_, PathFeasibility_ >::reset().

Member Function Documentation

◆ cfg()

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 355 of file DataFlow.h.

◆ reset()

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

◆ name() [1/2]

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 375 of file DataFlow.h.

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

◆ name() [2/2]

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 376 of file DataFlow.h.

◆ prefix()

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

◆ maxIterations() [1/2]

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 394 of file DataFlow.h.

◆ maxIterations() [2/2]

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 395 of file DataFlow.h.

◆ nIterations()

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 401 of file DataFlow.h.

◆ runOneIteration()

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

◆ insertStartingVertex()

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

◆ runToFixedPoint() [1/2]

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 474 of file DataFlow.h.

References Rose::BinaryAnalysis::DataFlow::Engine< Cfg_, State_, TransferFunction_, MergeFunction_, PathFeasibility_ >::runOneIteration().

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

◆ runToFixedPoint() [2/2]

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

◆ getInitialState()

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 491 of file DataFlow.h.

◆ setInitialState()

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 496 of file DataFlow.h.

◆ getFinalState()

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 504 of file DataFlow.h.

◆ getInitialStates()

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 512 of file DataFlow.h.

◆ getFinalStates()

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 520 of file DataFlow.h.

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


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