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

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

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

+ Inheritance diagram for mlir::dataflow::AbstractSparseBackwardDataFlowAnalysis:

Public Member Functions

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...
 
virtual void initializeEquivalentLatticeAnchor (Operation *top)
 Initialize lattice anchor equivalence class from the provided top-level operation. More...
 

Protected Member Functions

 AbstractSparseBackwardDataFlowAnalysis (DataFlowSolver &solver, SymbolTableCollection &symbolTable)
 
virtual LogicalResult visitOperationImpl (Operation *op, ArrayRef< AbstractSparseLattice * > operandLattices, ArrayRef< const AbstractSparseLattice * > resultLattices)=0
 The operation transfer function. More...
 
virtual void visitExternalCallImpl (CallOpInterface call, ArrayRef< AbstractSparseLattice * > operandLattices, ArrayRef< const AbstractSparseLattice * > resultLattices)=0
 The transfer function for calls to external functions. More...
 
virtual void visitBranchOperand (OpOperand &operand)=0
 
virtual void visitCallOperand (OpOperand &operand)=0
 
virtual void setToExitState (AbstractSparseLattice *lattice)=0
 Set the given lattice element(s) at control flow exit point(s) and propagate the update if it chaned. More...
 
void setAllToExitStates (ArrayRef< AbstractSparseLattice * > lattices)
 Set the given lattice element(s) at control flow exit point(s) and propagate the update if it chaned. More...
 
virtual AbstractSparseLatticegetLatticeElement (Value value)=0
 Get the lattice element for a value. 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...
 
virtual LogicalResult visitCallableOperation (Operation *op, CallableOpInterface callable, ArrayRef< AbstractSparseLattice * > operandLattices)
 Visits a callable operation. More...
 
- Protected Member Functions inherited from mlir::DataFlowAnalysis
void addDependency (AnalysisState *state, ProgramPoint *point)
 Create a dependency between the given analysis state and lattice anchor on this analysis. More...
 
void propagateIfChanged (AnalysisState *state, ChangeResult changed)
 Propagate an update to a state if it changed. More...
 
template<typename AnchorT >
void registerAnchorKind ()
 Register a custom lattice anchor class. More...
 
template<typename AnchorT , typename... Args>
AnchorT * getLatticeAnchor (Args &&...args)
 Get or create a custom lattice anchor. More...
 
template<typename StateT , typename AnchorT >
void unionLatticeAnchors (AnchorT anchor, AnchorT other)
 Union input anchors under the given state. More...
 
template<typename StateT , typename AnchorT >
StateT * getOrCreate (AnchorT anchor)
 Get the analysis state associated with the lattice anchor. More...
 
template<typename StateT , typename AnchorT >
const StateT * getOrCreateFor (ProgramPoint *dependent, AnchorT anchor)
 Get a read-only analysis state for the given point and create a dependency on dependent. More...
 
ProgramPointgetProgramPointBefore (Operation *op)
 Get a uniqued program point instance. More...
 
ProgramPointgetProgramPointBefore (Block *block)
 
ProgramPointgetProgramPointAfter (Operation *op)
 
ProgramPointgetProgramPointAfter (Block *block)
 
const DataFlowConfiggetSolverConfig () const
 Return the configuration of the solver used for this analysis. More...
 

Detailed Description

Base class for sparse backward data-flow analyses.

Similar to AbstractSparseForwardDataFlowAnalysis, but walks bottom to top.

Definition at line 408 of file SparseAnalysis.h.

Constructor & Destructor Documentation

◆ AbstractSparseBackwardDataFlowAnalysis()

AbstractSparseBackwardDataFlowAnalysis::AbstractSparseBackwardDataFlowAnalysis ( DataFlowSolver solver,
SymbolTableCollection symbolTable 
)
explicitprotected

Definition at line 341 of file SparseAnalysis.cpp.

Member Function Documentation

◆ getLatticeElement()

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

◆ getLatticeElements()

SmallVector< AbstractSparseLattice * > AbstractSparseBackwardDataFlowAnalysis::getLatticeElements ( ValueRange  values)
protected

Get the lattice elements for a range of values.

Definition at line 384 of file SparseAnalysis.cpp.

References getLatticeElement().

◆ initialize()

LogicalResult AbstractSparseBackwardDataFlowAnalysis::initialize ( Operation top)
overridevirtual

Initialize the analysis by visiting the operation and everything nested under it.

Implements mlir::DataFlowAnalysis.

Definition at line 348 of file SparseAnalysis.cpp.

◆ meet()

void AbstractSparseBackwardDataFlowAnalysis::meet ( AbstractSparseLattice lhs,
const AbstractSparseLattice rhs 
)
protected

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

Definition at line 631 of file SparseAnalysis.cpp.

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

Referenced by visitCallableOperation().

◆ setAllToExitStates()

void AbstractSparseBackwardDataFlowAnalysis::setAllToExitStates ( ArrayRef< AbstractSparseLattice * >  lattices)
protected

Set the given lattice element(s) at control flow exit point(s) and propagate the update if it chaned.

Definition at line 625 of file SparseAnalysis.cpp.

References setToExitState().

Referenced by mlir::dataflow::SparseBackwardDataFlowAnalysis< StateT >::setAllToExitStates(), and visitCallableOperation().

◆ setToExitState()

virtual void mlir::dataflow::AbstractSparseBackwardDataFlowAnalysis::setToExitState ( AbstractSparseLattice lattice)
protectedpure virtual

Set the given lattice element(s) at control flow exit point(s) and propagate the update if it chaned.

Implemented in mlir::dataflow::SparseBackwardDataFlowAnalysis< StateT >, and mlir::dataflow::SparseBackwardDataFlowAnalysis< Liveness >.

Referenced by setAllToExitStates().

◆ visit()

LogicalResult AbstractSparseBackwardDataFlowAnalysis::visit ( ProgramPoint point)
overridevirtual

Visit a program point.

If it is after call operation or an operation with block or region control-flow, then operand lattices are set accordingly. Otherwise, invokes the operation transfer function (visitOperationImpl).

Implements mlir::DataFlowAnalysis.

Definition at line 373 of file SparseAnalysis.cpp.

References mlir::ProgramPoint::getPrevOp(), and mlir::ProgramPoint::isBlockStart().

◆ visitBranchOperand()

virtual void mlir::dataflow::AbstractSparseBackwardDataFlowAnalysis::visitBranchOperand ( OpOperand operand)
protectedpure virtual

◆ visitCallableOperation()

LogicalResult AbstractSparseBackwardDataFlowAnalysis::visitCallableOperation ( Operation op,
CallableOpInterface  callable,
ArrayRef< AbstractSparseLattice * >  operandLattices 
)
protectedvirtual

Visits a callable operation.

If all the call sites are known computes the operand lattices of op from the result lattices of all the call sites; otherwise, conservatively marks them as having reached their pessimistic fixpoints. This method can be overridden to, for example, be less conservative and propagate the information even if some call sites are unknown.

Definition at line 533 of file SparseAnalysis.cpp.

References mlir::dataflow::PredecessorState::allPredecessorsKnown(), mlir::dataflow::PredecessorState::getKnownPredecessors(), mlir::DataFlowAnalysis::getProgramPointAfter(), meet(), and setAllToExitStates().

◆ visitCallOperand()

virtual void mlir::dataflow::AbstractSparseBackwardDataFlowAnalysis::visitCallOperand ( OpOperand operand)
protectedpure virtual

◆ visitExternalCallImpl()

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

The transfer function for calls to external functions.

◆ visitOperationImpl()

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

The operation transfer function.

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


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