MLIR
18.0.0git
|
Base class for dense backward dataflow analyses. More...
#include "mlir/Analysis/DataFlow/DenseAnalysis.h"
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... | |
![]() | |
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 AbstractDenseLattice * | getLattice (ProgramPoint point)=0 |
Get the dense lattice before the execution of the program point. More... | |
const AbstractDenseLattice * | getLatticeFor (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... | |
![]() | |
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... | |
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 293 of file DenseAnalysis.h.
|
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 298 of file DenseAnalysis.h.
|
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 >.
|
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 442 of file DenseAnalysis.cpp.
|
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 244 of file DenseAnalysis.cpp.
References mlir::Operation::getRegions(), and processOperation().
|
inlineprotected |
Meet a lattice with another lattice and propagate an update if it changed.
Definition at line 339 of file DenseAnalysis.h.
References mlir::dataflow::AbstractDenseLattice::meet(), and mlir::DataFlowAnalysis::propagateIfChanged().
Referenced by visitCallControlFlowTransfer(), and visitRegionBranchControlFlowTransfer().
|
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 307 of file DenseAnalysis.cpp.
Referenced by initialize().
|
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 >.
|
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 259 of file DenseAnalysis.cpp.
|
inlineprotectedvirtual |
Propagate the dense lattice backwards along the call control flow edge, which can be either entering or exiting the callee.
Default implementation just meets the states, meaning that operations implementing CallOpInterface
don't have any effect on hte lattice that isn't already expressed by the interface itself.
Reimplemented in mlir::dataflow::DenseBackwardDataFlowAnalysis< LatticeT >.
Definition at line 367 of file DenseAnalysis.h.
References meet().
Referenced by mlir::dataflow::DenseBackwardDataFlowAnalysis< LatticeT >::visitCallControlFlowTransfer().
|
protectedpure virtual |
Propagate the dense lattice after the execution of an operation to the lattice before its execution.
Implemented in mlir::dataflow::DenseBackwardDataFlowAnalysis< LatticeT >.
|
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 355 of file DenseAnalysis.h.
References meet().
Referenced by mlir::dataflow::DenseBackwardDataFlowAnalysis< LatticeT >::visitRegionBranchControlFlowTransfer().