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

Base class for dense backward dataflow analyses. More...

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

+ Inheritance diagram for mlir::dataflow::AbstractDenseBackwardDataFlowAnalysis:

Public Member Functions

 AbstractDenseBackwardDataFlowAnalysis (DataFlowSolver &solver, SymbolTableCollection &symbolTable)
 Construct the analysis in the given solver. More...
 
LogicalResult initialize (Operation *top) override
 Initialize the analysis by visiting every program point whose execution may modify the program state; that is, every operation and block. More...
 
LogicalResult visit (ProgramPoint *point) override
 Visit a program point that modifies the state of the program. 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

virtual LogicalResult visitOperationImpl (Operation *op, const AbstractDenseLattice &after, AbstractDenseLattice *before)=0
 Propagate the dense lattice after the execution of an operation to the lattice before its execution. More...
 
virtual AbstractDenseLatticegetLattice (LatticeAnchor anchor)=0
 Get the dense lattice before the execution of the lattice anchor. More...
 
const AbstractDenseLatticegetLatticeFor (ProgramPoint *dependent, LatticeAnchor anchor)
 Get the dense lattice on the given lattice anchor and add dependent as its dependency. More...
 
virtual void setToExitState (AbstractDenseLattice *lattice)=0
 Set the dense lattice before at the control flow exit point and propagate the update if it changed. More...
 
void meet (AbstractDenseLattice *lhs, const AbstractDenseLattice &rhs)
 Meet a lattice with another lattice and propagate an update if it changed. More...
 
virtual LogicalResult processOperation (Operation *op)
 Visit an operation. More...
 
virtual void visitRegionBranchControlFlowTransfer (RegionBranchOpInterface branch, RegionBranchPoint regionFrom, RegionBranchPoint regionTo, const AbstractDenseLattice &after, AbstractDenseLattice *before)
 Propagate the dense lattice backwards along the control flow edge from regionFrom to regionTo regions of the branch operation. More...
 
virtual void visitCallControlFlowTransfer (CallOpInterface call, CallControlFlowAction action, const AbstractDenseLattice &after, AbstractDenseLattice *before)
 Propagate the dense lattice backwards along the call control flow edge, which can be either entering or exiting the callee. 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 >
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 dense backward dataflow analyses.

Such analyses attach a lattice to program point and implement a transfer function from the lattice after the operation to the lattice before it, thus propagating backward.

Visit a program point in dense backward data-flow analysis will invoke the transfer function of the operation following the program point iterator. Visit a program point at the end of block will visit the block itself.

Definition at line 300 of file DenseAnalysis.h.

Constructor & Destructor Documentation

◆ AbstractDenseBackwardDataFlowAnalysis()

mlir::dataflow::AbstractDenseBackwardDataFlowAnalysis::AbstractDenseBackwardDataFlowAnalysis ( DataFlowSolver solver,
SymbolTableCollection symbolTable 
)
inline

Construct the analysis in the given solver.

Takes a symbol table collection that is used to cache symbol resolution in interprocedural part of the analysis. The symbol table need not be prefilled.

Definition at line 305 of file DenseAnalysis.h.

Member Function Documentation

◆ getLattice()

virtual AbstractDenseLattice* mlir::dataflow::AbstractDenseBackwardDataFlowAnalysis::getLattice ( LatticeAnchor  anchor)
protectedpure virtual

Get the dense lattice before the execution of the lattice anchor.

That is, before the execution of the given operation or after the execution of the block.

Implemented in mlir::dataflow::DenseBackwardDataFlowAnalysis< LatticeT >.

◆ getLatticeFor()

const AbstractDenseLattice * AbstractDenseBackwardDataFlowAnalysis::getLatticeFor ( ProgramPoint dependent,
LatticeAnchor  anchor 
)
protected

Get the dense lattice on the given lattice anchor and add dependent as its dependency.

That is, every time the lattice after anchor is updated, the dependent program point must be visited, and the newly triggered visit might update the lattice before dependent.

Definition at line 460 of file DenseAnalysis.cpp.

◆ initialize()

LogicalResult AbstractDenseBackwardDataFlowAnalysis::initialize ( Operation top)
overridevirtual

Initialize the analysis by visiting every program point whose execution may modify the program state; that is, every operation and block.

Implements mlir::DataFlowAnalysis.

Definition at line 256 of file DenseAnalysis.cpp.

References mlir::Operation::getRegions(), and processOperation().

◆ meet()

void mlir::dataflow::AbstractDenseBackwardDataFlowAnalysis::meet ( AbstractDenseLattice lhs,
const AbstractDenseLattice rhs 
)
inlineprotected

Meet a lattice with another lattice and propagate an update if it changed.

Definition at line 347 of file DenseAnalysis.h.

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

Referenced by visitCallControlFlowTransfer(), and visitRegionBranchControlFlowTransfer().

◆ processOperation()

LogicalResult AbstractDenseBackwardDataFlowAnalysis::processOperation ( Operation op)
protectedvirtual

Visit an operation.

Dispatches to specialized methods for call or region control-flow operations. Otherwise, this function invokes the operation transfer function.

Definition at line 326 of file DenseAnalysis.cpp.

Referenced by initialize(), and visit().

◆ setToExitState()

virtual void mlir::dataflow::AbstractDenseBackwardDataFlowAnalysis::setToExitState ( AbstractDenseLattice lattice)
protectedpure virtual

Set the dense lattice before at the control flow exit point and propagate the update if it changed.

Implemented in mlir::dataflow::DenseBackwardDataFlowAnalysis< LatticeT >.

Referenced by visitCallControlFlowTransfer().

◆ visit()

LogicalResult AbstractDenseBackwardDataFlowAnalysis::visit ( ProgramPoint point)
overridevirtual

Visit a program point that modifies the state of the program.

The state is propagated along control flow directions for branch-, region- and call-based control flow using the respective interfaces. For other operations, the state is propagated using the transfer function (visitOperation).

Note: the transfer function is currently not invoked before operations with region or call interface, but is invoked before block terminators.

Implements mlir::DataFlowAnalysis.

Definition at line 274 of file DenseAnalysis.cpp.

References mlir::ProgramPoint::getBlock(), mlir::ProgramPoint::getNextOp(), mlir::ProgramPoint::isBlockEnd(), and processOperation().

◆ visitCallControlFlowTransfer()

virtual void mlir::dataflow::AbstractDenseBackwardDataFlowAnalysis::visitCallControlFlowTransfer ( CallOpInterface  call,
CallControlFlowAction  action,
const AbstractDenseLattice after,
AbstractDenseLattice before 
)
inlineprotectedvirtual

Propagate the dense lattice backwards along the call control flow edge, which can be either entering or exiting the callee.

Default implementation for enter and exit callee action just meets the states, meaning that operations implementing CallOpInterface don't have any effect on the lattice that isn't already expressed by the interface itself. Default implementation for external callee action additional sets the result to the exit (fixpoint) state.

Reimplemented in mlir::dataflow::DenseBackwardDataFlowAnalysis< LatticeT >.

Definition at line 377 of file DenseAnalysis.h.

References mlir::dataflow::ExternalCallee, meet(), and setToExitState().

Referenced by mlir::dataflow::DenseBackwardDataFlowAnalysis< LatticeT >::visitCallControlFlowTransfer().

◆ visitOperationImpl()

virtual LogicalResult mlir::dataflow::AbstractDenseBackwardDataFlowAnalysis::visitOperationImpl ( Operation op,
const AbstractDenseLattice after,
AbstractDenseLattice before 
)
protectedpure virtual

Propagate the dense lattice after the execution of an operation to the lattice before its execution.

Implemented in mlir::dataflow::DenseBackwardDataFlowAnalysis< LatticeT >.

◆ visitRegionBranchControlFlowTransfer()

virtual void mlir::dataflow::AbstractDenseBackwardDataFlowAnalysis::visitRegionBranchControlFlowTransfer ( RegionBranchOpInterface  branch,
RegionBranchPoint  regionFrom,
RegionBranchPoint  regionTo,
const AbstractDenseLattice after,
AbstractDenseLattice before 
)
inlineprotectedvirtual

Propagate the dense lattice backwards along the control flow edge from regionFrom to regionTo regions of the branch operation.

nullopt values correspond to control flow branches originating at or targeting the branch operation itself. Default implementation just meets the states, meaning that operations implementing RegionBranchOpInterface don't have any effect on the lattice that isn't already expressed by the interface itself.

Reimplemented in mlir::dataflow::DenseBackwardDataFlowAnalysis< LatticeT >.

Definition at line 363 of file DenseAnalysis.h.

References meet().

Referenced by mlir::dataflow::DenseBackwardDataFlowAnalysis< LatticeT >::visitRegionBranchControlFlowTransfer().


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