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

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

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

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

Public Member Functions

 SparseForwardDataFlowAnalysis (DataFlowSolver &solver)
 
virtual void visitOperation (Operation *op, ArrayRef< const StateT * > operands, ArrayRef< StateT * > results)=0
 Visit an operation with the lattices of its operands. More...
 
virtual void visitExternalCall (CallOpInterface call, ArrayRef< const StateT * > argumentLattices, ArrayRef< StateT * > resultLattices)
 Visit a call operation to an externally defined function given the lattices of its arguments. More...
 
virtual void visitNonControlFlowArguments (Operation *op, const RegionSuccessor &successor, ArrayRef< StateT * > argLattices, unsigned firstIndex)
 Given an operation with possible region control-flow, the lattices of the operands, and a region successor, compute the lattice values for block arguments that are not accounted for by the branching control flow (ex. More...
 
- Public Member Functions inherited from mlir::dataflow::AbstractSparseForwardDataFlowAnalysis
LogicalResult initialize (Operation *top) override
 Initialize the analysis by visiting every owner of an SSA value: all operations and blocks. 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...
 
const StateT * getLatticeElementFor (ProgramPoint point, Value value)
 Get the lattice element for a value and create a dependency on the provided program point. More...
 
virtual void setToEntryState (StateT *lattice)=0
 Set the given lattice element(s) at control flow entry point(s). More...
 
void setAllToEntryStates (ArrayRef< StateT * > lattices)
 
- Protected Member Functions inherited from mlir::dataflow::AbstractSparseForwardDataFlowAnalysis
 AbstractSparseForwardDataFlowAnalysis (DataFlowSolver &solver)
 
const AbstractSparseLatticegetLatticeElementFor (ProgramPoint point, Value value)
 Get a read-only lattice element for a value and add it as a dependency to a program point. More...
 
void setAllToEntryStates (ArrayRef< AbstractSparseLattice * > lattices)
 
void join (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::SparseForwardDataFlowAnalysis< StateT >

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

StateT is expected to be a subclass of AbstractSparseLattice.

Definition at line 266 of file SparseAnalysis.h.

Constructor & Destructor Documentation

◆ SparseForwardDataFlowAnalysis()

template<typename StateT >
mlir::dataflow::SparseForwardDataFlowAnalysis< StateT >::SparseForwardDataFlowAnalysis ( DataFlowSolver solver)
inlineexplicit

Definition at line 273 of file SparseAnalysis.h.

Member Function Documentation

◆ getLatticeElement()

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

Get the lattice element for a value.

Implements mlir::dataflow::AbstractSparseForwardDataFlowAnalysis.

Definition at line 306 of file SparseAnalysis.h.

◆ getLatticeElementFor()

template<typename StateT >
const StateT* mlir::dataflow::SparseForwardDataFlowAnalysis< StateT >::getLatticeElementFor ( ProgramPoint  point,
Value  value 
)
inlineprotected

Get the lattice element for a value and create a dependency on the provided program point.

Definition at line 312 of file SparseAnalysis.h.

References mlir::dataflow::AbstractSparseForwardDataFlowAnalysis::getLatticeElementFor().

◆ setAllToEntryStates()

template<typename StateT >
void mlir::dataflow::SparseForwardDataFlowAnalysis< StateT >::setAllToEntryStates ( ArrayRef< StateT * >  lattices)
inlineprotected

◆ setToEntryState()

template<typename StateT >
virtual void mlir::dataflow::SparseForwardDataFlowAnalysis< StateT >::setToEntryState ( StateT *  lattice)
protectedpure virtual

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

Implemented in mlir::dataflow::SparseConstantPropagation, and mlir::dataflow::IntegerRangeAnalysis.

◆ visitExternalCall()

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

Visit a call operation to an externally defined function given the lattices of its arguments.

Definition at line 283 of file SparseAnalysis.h.

References mlir::dataflow::SparseForwardDataFlowAnalysis< StateT >::setAllToEntryStates().

◆ visitNonControlFlowArguments()

template<typename StateT >
virtual void mlir::dataflow::SparseForwardDataFlowAnalysis< StateT >::visitNonControlFlowArguments ( Operation op,
const RegionSuccessor successor,
ArrayRef< StateT * >  argLattices,
unsigned  firstIndex 
)
inlinevirtual

Given an operation with possible region control-flow, the lattices of the operands, and a region successor, compute the lattice values for block arguments that are not accounted for by the branching control flow (ex.

the bounds of loops). By default, this method marks all such lattice elements as having reached a pessimistic fixpoint. firstIndex is the index of the first element of argLattices that is set by control-flow.

Reimplemented in mlir::dataflow::IntegerRangeAnalysis.

Definition at line 295 of file SparseAnalysis.h.

◆ visitOperation()

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

Visit an operation with the lattices of its operands.

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

Implemented in mlir::dataflow::SparseConstantPropagation, and mlir::dataflow::IntegerRangeAnalysis.


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