|
MLIR 22.0.0git
|
A dense backward dataflow analysis propagating lattices after and before the execution of every operation across the IR by implementing transfer functions for opreations. More...
#include "mlir/Analysis/DataFlow/DenseAnalysis.h"
Public Member Functions | |
| virtual LogicalResult | visitOperation (Operation *op, const LatticeT &after, LatticeT *before)=0 |
| Transfer function. | |
| virtual void | visitCallControlFlowTransfer (CallOpInterface call, CallControlFlowAction action, const LatticeT &after, LatticeT *before) |
| Hook for customizing the behavior of lattice propagation along the call control flow edges. | |
| virtual void | visitRegionBranchControlFlowTransfer (RegionBranchOpInterface branch, RegionBranchPoint regionFrom, RegionSuccessor regionTo, const LatticeT &after, LatticeT *before) |
| Hook for customizing the behavior of lattice propagation along the control flow edges between regions and their parent op. | |
| virtual void | visitBlockTransfer (Block *block, ProgramPoint *point, Block *successor, const LatticeT &after, LatticeT *before) |
| Hook for customizing the behavior of lattice propagation along the control flow edges between blocks. | |
| Public Member Functions inherited from mlir::dataflow::AbstractDenseBackwardDataFlowAnalysis | |
| AbstractDenseBackwardDataFlowAnalysis (DataFlowSolver &solver, SymbolTableCollection &symbolTable) | |
| Construct the analysis in the given solver. | |
| 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. | |
| virtual void | initializeEquivalentLatticeAnchor (Operation *top) override |
| Initialize lattice anchor equivalence class from the provided top-level operation. | |
| LogicalResult | visit (ProgramPoint *point) override |
| Visit a program point that modifies the state of the program. | |
| Public Member Functions inherited from mlir::DataFlowAnalysis | |
| virtual | ~DataFlowAnalysis () |
| DataFlowAnalysis (DataFlowSolver &solver) | |
| Create an analysis with a reference to the parent solver. | |
Protected Member Functions | |
| LatticeT * | getLattice (LatticeAnchor anchor) override |
| Get the dense lattice at the given lattice anchor. | |
| virtual const AbstractDenseLattice * | getLatticeFor (ProgramPoint *dependent, LatticeAnchor anchor) override |
| Get the dense lattice on the given lattice anchor and add dependent as its dependency. | |
| virtual void | setToExitState (LatticeT *lattice)=0 |
| Set the dense lattice at control flow exit point (after the terminator) and propagate an update if it changed. | |
| void | setToExitState (AbstractDenseLattice *lattice) final |
| Set the dense lattice before at the control flow exit point and propagate the update if it changed. | |
| LogicalResult | visitOperationImpl (Operation *op, const AbstractDenseLattice &after, AbstractDenseLattice *before) final |
| Type-erased wrappers that convert the abstract dense lattice to a derived lattice and invoke the virtual hooks operating on the derived lattice. | |
| void | visitCallControlFlowTransfer (CallOpInterface call, CallControlFlowAction action, const AbstractDenseLattice &after, AbstractDenseLattice *before) final |
| Propagate the dense lattice backwards along the call control flow edge, which can be either entering or exiting the callee. | |
| void | visitRegionBranchControlFlowTransfer (RegionBranchOpInterface branch, RegionBranchPoint regionForm, RegionSuccessor regionTo, const AbstractDenseLattice &after, AbstractDenseLattice *before) final |
| Propagate the dense lattice backwards along the control flow edge from regionFrom to regionTo regions of the branch operation. | |
| void | visitBlockTransfer (Block *block, ProgramPoint *point, Block *successor, const AbstractDenseLattice &after, AbstractDenseLattice *before) final |
| Visit a block and propagate the dense lattice backward along the control flow edge from successor to block. | |
| Protected Member Functions inherited from mlir::dataflow::AbstractDenseBackwardDataFlowAnalysis | |
| void | meet (AbstractDenseLattice *lhs, const AbstractDenseLattice &rhs) |
| Meet a lattice with another lattice and propagate an update if it changed. | |
| virtual LogicalResult | processOperation (Operation *op) |
| Visit an operation. | |
| virtual void | buildOperationEquivalentLatticeAnchor (Operation *op) |
| Visit an operation. | |
| 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. | |
| void | propagateIfChanged (AnalysisState *state, ChangeResult changed) |
| Propagate an update to a state if it changed. | |
| template<typename AnchorT> | |
| void | registerAnchorKind () |
| Register a custom lattice anchor class. | |
| template<typename AnchorT, typename... Args> | |
| AnchorT * | getLatticeAnchor (Args &&...args) |
| Get or create a custom lattice anchor. | |
| template<typename StateT, typename AnchorT> | |
| void | unionLatticeAnchors (AnchorT anchor, AnchorT other) |
| Union input anchors under the given state. | |
| template<typename StateT, typename AnchorT> | |
| StateT * | getOrCreate (AnchorT anchor) |
| Get the analysis state associated with the lattice anchor. | |
| 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. | |
| ProgramPoint * | getProgramPointBefore (Operation *op) |
| Get a uniqued program point instance. | |
| ProgramPoint * | getProgramPointBefore (Block *block) |
| ProgramPoint * | getProgramPointAfter (Operation *op) |
| ProgramPoint * | getProgramPointAfter (Block *block) |
| const DataFlowConfig & | getSolverConfig () const |
| Return the configuration of the solver used for this analysis. | |
A dense backward dataflow analysis propagating lattices after and before the execution of every operation across the IR by implementing transfer functions for opreations.
LatticeT is expected to be a subclass of AbstractDenseLattice.
Definition at line 512 of file DenseAnalysis.h.
|
inlineoverrideprotectedvirtual |
Get the dense lattice at the given lattice anchor.
Implements mlir::dataflow::AbstractDenseBackwardDataFlowAnalysis.
Definition at line 598 of file DenseAnalysis.h.
References mlir::DataFlowAnalysis::getOrCreate().
|
inlineoverrideprotectedvirtual |
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.
Implements mlir::dataflow::AbstractDenseBackwardDataFlowAnalysis.
Definition at line 607 of file DenseAnalysis.h.
References mlir::DataFlowAnalysis::getOrCreateFor().
|
inlinefinalprotectedvirtual |
Set the dense lattice before at the control flow exit point and propagate the update if it changed.
Implements mlir::dataflow::AbstractDenseBackwardDataFlowAnalysis.
Definition at line 614 of file DenseAnalysis.h.
References setToExitState().
|
protectedpure virtual |
Set the dense lattice at control flow exit point (after the terminator) and propagate an update if it changed.
Referenced by setToExitState().
|
inlinefinalprotectedvirtual |
Visit a block and propagate the dense lattice backward along the control flow edge from successor to block.
point corresponds to the program point after block. The default implementation merges in the state from the successor's first operation or the block itself when empty.
Reimplemented from mlir::dataflow::AbstractDenseBackwardDataFlowAnalysis.
Definition at line 642 of file DenseAnalysis.h.
References visitBlockTransfer().
|
inlinevirtual |
Hook for customizing the behavior of lattice propagation along the control flow edges between blocks.
The control flows from successor to block. The lattice is propagated back along this edge. The lattices are as follows:
Definition at line 589 of file DenseAnalysis.h.
References mlir::dataflow::AbstractDenseBackwardDataFlowAnalysis::visitBlockTransfer().
Referenced by visitBlockTransfer().
|
inlinefinalprotectedvirtual |
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 from mlir::dataflow::AbstractDenseBackwardDataFlowAnalysis.
Definition at line 626 of file DenseAnalysis.h.
References visitCallControlFlowTransfer().
|
inlinevirtual |
Hook for customizing the behavior of lattice propagation along the call control flow edges.
Two types of (back) propagation are possible here:
Definition at line 542 of file DenseAnalysis.h.
References mlir::dataflow::AbstractDenseBackwardDataFlowAnalysis::visitCallControlFlowTransfer().
Referenced by visitCallControlFlowTransfer().
|
pure virtual |
Transfer function.
Visits an operation with the dense lattice after its execution. This function is expected to set the dense lattice before its execution and trigger propagation in case of change.
Referenced by visitOperationImpl().
|
inlinefinalprotectedvirtual |
Type-erased wrappers that convert the abstract dense lattice to a derived lattice and invoke the virtual hooks operating on the derived lattice.
Implements mlir::dataflow::AbstractDenseBackwardDataFlowAnalysis.
Definition at line 620 of file DenseAnalysis.h.
References visitOperation().
|
inlinefinalprotectedvirtual |
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 from mlir::dataflow::AbstractDenseBackwardDataFlowAnalysis.
Definition at line 634 of file DenseAnalysis.h.
References visitRegionBranchControlFlowTransfer().
|
inlinevirtual |
Hook for customizing the behavior of lattice propagation along the control flow edges between regions and their parent op.
The control flows from regionFrom to regionTo, both of which may be nullopt to indicate the parent op. The lattice is propagated back along this edge. The lattices are as follows:
Definition at line 573 of file DenseAnalysis.h.
References mlir::dataflow::AbstractDenseBackwardDataFlowAnalysis::visitRegionBranchControlFlowTransfer().
Referenced by visitRegionBranchControlFlowTransfer().