MLIR  19.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 void 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 (ProgramPoint point)=0
 Get the dense lattice before the execution of the program point. More...
 
const AbstractDenseLatticegetLatticeFor (ProgramPoint dependent, ProgramPoint point)
 Get the dense lattice before the execution of the program point point and declare that the dependent program point must be updated every time point is. 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 void 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 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 dense backward dataflow analyses.

Such analyses attach a lattice between the execution of operations and implement a transfer function from the lattice after the operation ot the lattice before it, thus propagating backward.

In this implementation, a lattice attached to an operation represents the state of the program before its execution, and a lattice attached to a block represents the state of the program before the end of the block, i.e., after its terminator.

Definition at line 303 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 308 of file DenseAnalysis.h.

Member Function Documentation

◆ getLattice()

virtual AbstractDenseLattice* mlir::dataflow::AbstractDenseBackwardDataFlowAnalysis::getLattice ( ProgramPoint  point)
protectedpure virtual

Get the dense lattice before the execution of the program point.

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,
ProgramPoint  point 
)
protected

Get the dense lattice before the execution of the program point point and declare that the dependent program point must be updated every time point is.

Definition at line 464 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 349 of file DenseAnalysis.h.

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

Referenced by visitCallControlFlowTransfer(), and visitRegionBranchControlFlowTransfer().

◆ processOperation()

void 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 327 of file DenseAnalysis.cpp.

Referenced by initialize().

◆ 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 for operations with region or call interface, but is invoked for block terminators.

Implements mlir::DataFlowAnalysis.

Definition at line 271 of file DenseAnalysis.cpp.

◆ 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 379 of file DenseAnalysis.h.

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

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

◆ visitOperationImpl()

virtual void 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 365 of file DenseAnalysis.h.

References meet().

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


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