MLIR  19.0.0git
Public Member Functions | Protected Member Functions | List of all members
mlir::dataflow::AbstractSparseForwardDataFlowAnalysis Class Referenceabstract

Base class for sparse forward data-flow analyses. More...

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

+ Inheritance diagram for mlir::dataflow::AbstractSparseForwardDataFlowAnalysis:

Public Member Functions

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

 AbstractSparseForwardDataFlowAnalysis (DataFlowSolver &solver)
 
virtual void visitOperationImpl (Operation *op, ArrayRef< const AbstractSparseLattice * > operandLattices, ArrayRef< AbstractSparseLattice * > resultLattices)=0
 The operation transfer function. More...
 
virtual void visitExternalCallImpl (CallOpInterface call, ArrayRef< const AbstractSparseLattice * > argumentLattices, ArrayRef< AbstractSparseLattice * > resultLattices)=0
 The transfer function for calls to external functions. More...
 
virtual void visitNonControlFlowArgumentsImpl (Operation *op, const RegionSuccessor &successor, ArrayRef< AbstractSparseLattice * > argLattices, unsigned firstIndex)=0
 Given an operation with 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...
 
virtual AbstractSparseLatticegetLatticeElement (Value value)=0
 Get the lattice element of a value. More...
 
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...
 
virtual void setToEntryState (AbstractSparseLattice *lattice)=0
 Set the given lattice element(s) at control flow entry point(s). 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

Base class for sparse forward data-flow analyses.

A sparse analysis implements a transfer function on operations from the lattices of the operands to the lattices of the results. This analysis will propagate lattices across control-flow edges and the callgraph using liveness information.

Definition at line 182 of file SparseAnalysis.h.

Constructor & Destructor Documentation

◆ AbstractSparseForwardDataFlowAnalysis()

AbstractSparseForwardDataFlowAnalysis::AbstractSparseForwardDataFlowAnalysis ( DataFlowSolver solver)
explicitprotected

Definition at line 47 of file SparseAnalysis.cpp.

Member Function Documentation

◆ getLatticeElement()

virtual AbstractSparseLattice* mlir::dataflow::AbstractSparseForwardDataFlowAnalysis::getLatticeElement ( Value  value)
protectedpure virtual

◆ getLatticeElementFor()

const AbstractSparseLattice * AbstractSparseForwardDataFlowAnalysis::getLatticeElementFor ( ProgramPoint  point,
Value  value 
)
protected

Get a read-only lattice element for a value and add it as a dependency to a program point.

Definition at line 295 of file SparseAnalysis.cpp.

Referenced by mlir::dataflow::SparseForwardDataFlowAnalysis< StateT >::getLatticeElementFor().

◆ initialize()

LogicalResult AbstractSparseForwardDataFlowAnalysis::initialize ( Operation top)
overridevirtual

Initialize the analysis by visiting every owner of an SSA value: all operations and blocks.

Implements mlir::DataFlowAnalysis.

Definition at line 54 of file SparseAnalysis.cpp.

References getLatticeElement(), mlir::Operation::getRegions(), and setToEntryState().

◆ join()

void AbstractSparseForwardDataFlowAnalysis::join ( AbstractSparseLattice lhs,
const AbstractSparseLattice rhs 
)
protected

Join the lattice element and propagate and update if it changed.

Definition at line 308 of file SparseAnalysis.cpp.

References mlir::dataflow::AbstractSparseLattice::join(), and mlir::DataFlowAnalysis::propagateIfChanged().

◆ setAllToEntryStates()

void AbstractSparseForwardDataFlowAnalysis::setAllToEntryStates ( ArrayRef< AbstractSparseLattice * >  lattices)
protected

◆ setToEntryState()

virtual void mlir::dataflow::AbstractSparseForwardDataFlowAnalysis::setToEntryState ( AbstractSparseLattice lattice)
protectedpure virtual

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

Referenced by initialize(), and setAllToEntryStates().

◆ visit()

LogicalResult AbstractSparseForwardDataFlowAnalysis::visit ( ProgramPoint  point)
overridevirtual

Visit a program point.

If this is a block and all control-flow predecessors or callsites are known, then the arguments lattices are propagated from them. If this is a call operation or an operation with region control-flow, then its result lattices are set accordingly. Otherwise, the operation transfer function is invoked.

Implements mlir::DataFlowAnalysis.

Definition at line 85 of file SparseAnalysis.cpp.

◆ visitExternalCallImpl()

virtual void mlir::dataflow::AbstractSparseForwardDataFlowAnalysis::visitExternalCallImpl ( CallOpInterface  call,
ArrayRef< const AbstractSparseLattice * >  argumentLattices,
ArrayRef< AbstractSparseLattice * >  resultLattices 
)
protectedpure virtual

The transfer function for calls to external functions.

◆ visitNonControlFlowArgumentsImpl()

virtual void mlir::dataflow::AbstractSparseForwardDataFlowAnalysis::visitNonControlFlowArgumentsImpl ( Operation op,
const RegionSuccessor successor,
ArrayRef< AbstractSparseLattice * >  argLattices,
unsigned  firstIndex 
)
protectedpure virtual

Given an operation with 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).

◆ visitOperationImpl()

virtual void mlir::dataflow::AbstractSparseForwardDataFlowAnalysis::visitOperationImpl ( Operation op,
ArrayRef< const AbstractSparseLattice * >  operandLattices,
ArrayRef< AbstractSparseLattice * >  resultLattices 
)
protectedpure virtual

The operation transfer function.

Given the operand lattices, this function is expected to set the result lattices.


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