MLIR  19.0.0git
Public Member Functions | Protected Member Functions | List of all members
mlir::dataflow::SparseBackwardDataFlowAnalysis< StateT > Class Template Referenceabstract

A sparse (backward) data-flow analysis for propagating SSA value lattices backwards across the IR by implementing transfer functions for operations. More...

#include "mlir/Analysis/DataFlow/SparseAnalysis.h"

+ Inheritance diagram for mlir::dataflow::SparseBackwardDataFlowAnalysis< StateT >:

Public Member Functions

 SparseBackwardDataFlowAnalysis (DataFlowSolver &solver, SymbolTableCollection &symbolTable)
 
virtual void visitOperation (Operation *op, ArrayRef< StateT * > operands, ArrayRef< const StateT * > results)=0
 Visit an operation with the lattices of its results. More...
 
virtual void visitExternalCall (CallOpInterface call, ArrayRef< StateT * > argumentLattices, ArrayRef< const StateT * > resultLattices)
 Visit a call to an external function. More...
 
- Public Member Functions inherited from mlir::dataflow::AbstractSparseBackwardDataFlowAnalysis
LogicalResult initialize (Operation *top) override
 Initialize the analysis by visiting the operation and everything nested under it. More...
 
LogicalResult visit (ProgramPoint point) override
 Visit a program point. More...
 
- Public Member Functions inherited from mlir::DataFlowAnalysis
virtual ~DataFlowAnalysis ()
 
 DataFlowAnalysis (DataFlowSolver &solver)
 Create an analysis with a reference to the parent solver. More...
 

Protected Member Functions

StateT * getLatticeElement (Value value) override
 Get the lattice element for a value. More...
 
virtual void setToExitState (StateT *lattice)=0
 Set the given lattice element(s) at control flow exit point(s). More...
 
void setToExitState (AbstractSparseLattice *lattice) override
 Set the given lattice element(s) at control flow exit point(s). More...
 
void setAllToExitStates (ArrayRef< StateT * > lattices)
 
- Protected Member Functions inherited from mlir::dataflow::AbstractSparseBackwardDataFlowAnalysis
 AbstractSparseBackwardDataFlowAnalysis (DataFlowSolver &solver, SymbolTableCollection &symbolTable)
 
virtual void visitBranchOperand (OpOperand &operand)=0
 
virtual void visitCallOperand (OpOperand &operand)=0
 
void setAllToExitStates (ArrayRef< AbstractSparseLattice * > lattices)
 Set the given lattice element(s) at control flow exit point(s). More...
 
SmallVector< AbstractSparseLattice * > getLatticeElements (ValueRange values)
 Get the lattice elements for a range of values. More...
 
void meet (AbstractSparseLattice *lhs, const AbstractSparseLattice &rhs)
 Join the lattice element and propagate and update if it changed. More...
 
- Protected Member Functions inherited from mlir::DataFlowAnalysis
void addDependency (AnalysisState *state, ProgramPoint point)
 Create a dependency between the given analysis state and program point on this analysis. More...
 
void propagateIfChanged (AnalysisState *state, ChangeResult changed)
 Propagate an update to a state if it changed. More...
 
template<typename PointT >
void registerPointKind ()
 Register a custom program point class. More...
 
template<typename PointT , typename... Args>
PointT * getProgramPoint (Args &&...args)
 Get or create a custom program point. More...
 
template<typename StateT , typename PointT >
StateT * getOrCreate (PointT point)
 Get the analysis state associated with the program point. More...
 
template<typename StateT , typename PointT >
const StateT * getOrCreateFor (ProgramPoint dependent, PointT point)
 Get a read-only analysis state for the given point and create a dependency on dependent. More...
 
const DataFlowConfiggetSolverConfig () const
 Return the configuration of the solver used for this analysis. More...
 

Detailed Description

template<typename StateT>
class mlir::dataflow::SparseBackwardDataFlowAnalysis< StateT >

A sparse (backward) data-flow analysis for propagating SSA value lattices backwards across the IR by implementing transfer functions for operations.

StateT is expected to be a subclass of AbstractSparseLattice.

Definition at line 468 of file SparseAnalysis.h.

Constructor & Destructor Documentation

◆ SparseBackwardDataFlowAnalysis()

template<typename StateT >
mlir::dataflow::SparseBackwardDataFlowAnalysis< StateT >::SparseBackwardDataFlowAnalysis ( DataFlowSolver solver,
SymbolTableCollection symbolTable 
)
inlineexplicit

Definition at line 471 of file SparseAnalysis.h.

Member Function Documentation

◆ getLatticeElement()

template<typename StateT >
StateT* mlir::dataflow::SparseBackwardDataFlowAnalysis< StateT >::getLatticeElement ( Value  value)
inlineoverrideprotectedvirtual

Get the lattice element for a value.

Implements mlir::dataflow::AbstractSparseBackwardDataFlowAnalysis.

Definition at line 495 of file SparseAnalysis.h.

◆ setAllToExitStates()

template<typename StateT >
void mlir::dataflow::SparseBackwardDataFlowAnalysis< StateT >::setAllToExitStates ( ArrayRef< StateT * >  lattices)
inlineprotected

◆ setToExitState() [1/2]

template<typename StateT >
void mlir::dataflow::SparseBackwardDataFlowAnalysis< StateT >::setToExitState ( AbstractSparseLattice lattice)
inlineoverrideprotectedvirtual

Set the given lattice element(s) at control flow exit point(s).

Implements mlir::dataflow::AbstractSparseBackwardDataFlowAnalysis.

Definition at line 501 of file SparseAnalysis.h.

References mlir::dataflow::SparseBackwardDataFlowAnalysis< StateT >::setToExitState().

◆ setToExitState() [2/2]

template<typename StateT >
virtual void mlir::dataflow::SparseBackwardDataFlowAnalysis< StateT >::setToExitState ( StateT *  lattice)
protectedpure virtual

Set the given lattice element(s) at control flow exit point(s).

Implemented in mlir::dataflow::LivenessAnalysis.

Referenced by mlir::dataflow::SparseBackwardDataFlowAnalysis< StateT >::setToExitState().

◆ visitExternalCall()

template<typename StateT >
virtual void mlir::dataflow::SparseBackwardDataFlowAnalysis< StateT >::visitExternalCall ( CallOpInterface  call,
ArrayRef< StateT * >  argumentLattices,
ArrayRef< const StateT * >  resultLattices 
)
inlinevirtual

Visit a call to an external function.

This function is expected to set lattice values of the call operands. By default, calls visitCallOperand for all operands.

Definition at line 483 of file SparseAnalysis.h.

References mlir::dataflow::AbstractSparseBackwardDataFlowAnalysis::visitCallOperand().

◆ visitOperation()

template<typename StateT >
virtual void mlir::dataflow::SparseBackwardDataFlowAnalysis< StateT >::visitOperation ( Operation op,
ArrayRef< StateT * >  operands,
ArrayRef< const StateT * >  results 
)
pure virtual

Visit an operation with the lattices of its results.

This function is expected to set the lattices of the operation's operands.

Implemented in mlir::dataflow::LivenessAnalysis.


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