MLIR
16.0.0git

The general dataflow analysis solver. More...
#include "mlir/Analysis/DataFlowFramework.h"
Public Types  
using  WorkItem = std::pair< ProgramPoint, DataFlowAnalysis * > 
A work item on the solver queue is a program point, child analysis pair. More...  
Public Member Functions  
template<typename AnalysisT , typename... Args>  
AnalysisT *  load (Args &&...args) 
Load an analysis into the solver. Return the analysis instance. More...  
LogicalResult  initializeAndRun (Operation *top) 
Initialize the children analyses starting from the provided toplevel operation and run the analysis until fixpoint. More...  
template<typename StateT , typename PointT >  
const StateT *  lookupState (PointT point) const 
Lookup an analysis state for the given program point. More...  
template<typename PointT , typename... Args>  
PointT *  getProgramPoint (Args &&...args) 
Get a uniqued program point instance. More...  
void  enqueue (WorkItem item) 
Push a work item onto the worklist. More...  
template<typename StateT , typename PointT >  
StateT *  getOrCreateState (PointT point) 
Get the state associated with the given program point. More...  
void  propagateIfChanged (AnalysisState *state, ChangeResult changed) 
Propagate an update to an analysis state if it changed by pushing dependent work items to the back of the queue. More...  
void  addDependency (AnalysisState *state, DataFlowAnalysis *analysis, ProgramPoint point) 
Add a dependency to an analysis state on a child analysis and program point. More...  
Friends  
class  DataFlowAnalysis 
Allow the base child analysis class to access the internals of the solver. More...  
The general dataflow analysis solver.
This class is responsible for orchestrating child dataflow analyses, running the fixedpoint iteration algorithm, managing analysis state and program point memory, and tracking dependencies beteen analyses, program points, and analysis states.
Steps to run a dataflow analysis:
TODO: Optimize the internal implementation of the solver.
Definition at line 195 of file DataFlowFramework.h.
using mlir::DataFlowSolver::WorkItem = std::pair<ProgramPoint, DataFlowAnalysis *> 
A work item on the solver queue is a program point, child analysis pair.
Each item is processed by invoking the child analysis at the program point.
Definition at line 225 of file DataFlowFramework.h.
void DataFlowSolver::addDependency  (  AnalysisState *  state, 
DataFlowAnalysis *  analysis,  
ProgramPoint  point  
) 
Add a dependency to an analysis state on a child analysis and program point.
If the state is updated, the child analysis must be invoked on the given program point again.
Definition at line 106 of file DataFlowFramework.cpp.
References DATAFLOW_DEBUG, mlir::AnalysisState::dependents, mlir::AnalysisState::point, and mlir::DataFlowAnalysis::~DataFlowAnalysis().
Referenced by mlir::DataFlowAnalysis::addDependency().
Push a work item onto the worklist.
Definition at line 227 of file DataFlowFramework.h.
Referenced by mlir::dataflow::AbstractSparseLattice::onUpdate(), and mlir::dataflow::Executable::onUpdate().
StateT * mlir::DataFlowSolver::getOrCreateState  (  PointT  point  ) 
Get the state associated with the given program point.
If it does not exist, create an uninitialized state.
Definition at line 444 of file DataFlowFramework.h.
Referenced by mlir::DataFlowAnalysis::getOrCreate(), and mlir::dataflow::IntegerValueRangeLattice::onUpdate().

inline 
Get a uniqued program point instance.
If one is not present, it is created with the provided arguments.
Definition at line 218 of file DataFlowFramework.h.
Referenced by mlir::DataFlowAnalysis::getProgramPoint().
LogicalResult DataFlowSolver::initializeAndRun  (  Operation *  top  ) 
Initialize the children analyses starting from the provided toplevel operation and run the analysis until fixpoint.
Definition at line 65 of file DataFlowFramework.cpp.
References DATAFLOW_DEBUG, mlir::failed(), mlir::failure(), and mlir::success().
Referenced by toUnsignedPred().
AnalysisT * mlir::DataFlowSolver::load  (  Args &&...  args  ) 
Load an analysis into the solver. Return the analysis instance.
Definition at line 435 of file DataFlowFramework.h.
Referenced by toUnsignedPred().

inline 
Lookup an analysis state for the given program point.
Returns null if one does not exist.
Definition at line 208 of file DataFlowFramework.h.
Referenced by replaceWithConstant(), and staticallyNonNegative().
void DataFlowSolver::propagateIfChanged  (  AnalysisState *  state, 
ChangeResult  changed  
) 
Propagate an update to an analysis state if it changed by pushing dependent work items to the back of the queue.
Definition at line 94 of file DataFlowFramework.cpp.
References mlir::Change, DATAFLOW_DEBUG, mlir::AnalysisState::dependents, mlir::AnalysisState::onUpdate(), and mlir::AnalysisState::point.
Referenced by mlir::dataflow::IntegerValueRangeLattice::onUpdate(), and mlir::DataFlowAnalysis::propagateIfChanged().

friend 
Allow the base child analysis class to access the internals of the solver.
Definition at line 263 of file DataFlowFramework.h.