|
MLIR 22.0.0git
|
A dense forward data-flow analysis for propagating lattices before and after the execution of every operation across the IR by implementing transfer functions for operations. More...
#include "mlir/Analysis/DataFlow/DenseAnalysis.h"
Public Member Functions | |
| virtual LogicalResult | visitOperation (Operation *op, const LatticeT &before, LatticeT *after)=0 |
| Visit an operation with the dense lattice before its execution. | |
| virtual void | visitCallControlFlowTransfer (CallOpInterface call, CallControlFlowAction action, const LatticeT &before, LatticeT *after) |
| Hook for customizing the behavior of lattice propagation along the call control flow edges. | |
| virtual void | visitRegionBranchControlFlowTransfer (RegionBranchOpInterface branch, std::optional< unsigned > regionFrom, std::optional< unsigned > regionTo, const LatticeT &before, LatticeT *after) |
| 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 *predecessor, const LatticeT &before, LatticeT *after) |
| Hook for customizing the behavior of lattice propagation along the control flow edges between blocks. | |
| Public Member Functions inherited from mlir::dataflow::AbstractDenseForwardDataFlowAnalysis | |
| 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. | |
| DataFlowAnalysis (DataFlowSolver &solver) | |
| Create an analysis with a reference to the parent solver. | |
| 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 on this lattice anchor. | |
| 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 | setToEntryState (LatticeT *lattice)=0 |
| Set the dense lattice at control flow entry point and propagate an update if it changed. | |
| void | setToEntryState (AbstractDenseLattice *lattice) override |
| Set the dense lattice at control flow entry point and propagate an update if it changed. | |
| LogicalResult | visitOperationImpl (Operation *op, const AbstractDenseLattice &before, AbstractDenseLattice *after) 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 &before, AbstractDenseLattice *after) final |
| Propagate the dense lattice forward along the call control flow edge, which can be either entering or exiting the callee. | |
| void | visitRegionBranchControlFlowTransfer (RegionBranchOpInterface branch, std::optional< unsigned > regionFrom, std::optional< unsigned > regionTo, const AbstractDenseLattice &before, AbstractDenseLattice *after) final |
| Propagate the dense lattice forward along the control flow edge from regionFrom to regionTo regions of the branch operation. | |
| void | visitBlockTransfer (Block *block, ProgramPoint *point, Block *predecessor, const AbstractDenseLattice &before, AbstractDenseLattice *after) final |
| Visit a block and propagate the dense lattice forward along the control flow edge from predecessor to block. | |
| Protected Member Functions inherited from mlir::dataflow::AbstractDenseForwardDataFlowAnalysis | |
| void | join (AbstractDenseLattice *lhs, const AbstractDenseLattice &rhs) |
| Join a lattice with another and propagate an update if it changed. | |
| virtual LogicalResult | processOperation (Operation *op) |
| Visit an operation. | |
| virtual void | buildOperationEquivalentLatticeAnchor (Operation *op) |
| Visit an operation. | |
| void | visitRegionBranchOperation (ProgramPoint *point, RegionBranchOpInterface branch, AbstractDenseLattice *after) |
| Visit a program point within a region branch operation with predecessors in it. | |
| 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 forward data-flow analysis for propagating lattices before and after the execution of every operation across the IR by implementing transfer functions for operations.
LatticeT is expected to be a subclass of AbstractDenseLattice.
Definition at line 204 of file DenseAnalysis.h.
|
inlineoverrideprotectedvirtual |
Get the dense lattice on this lattice anchor.
Implements mlir::dataflow::AbstractDenseForwardDataFlowAnalysis.
Definition at line 292 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 on dependent.
Implements mlir::dataflow::AbstractDenseForwardDataFlowAnalysis.
Definition at line 300 of file DenseAnalysis.h.
References mlir::DataFlowAnalysis::getOrCreateFor().
|
inlineoverrideprotectedvirtual |
Set the dense lattice at control flow entry point and propagate an update if it changed.
Implements mlir::dataflow::AbstractDenseForwardDataFlowAnalysis.
Definition at line 308 of file DenseAnalysis.h.
References setToEntryState().
|
protectedpure virtual |
Set the dense lattice at control flow entry point and propagate an update if it changed.
Referenced by setToEntryState().
|
inlinefinalprotectedvirtual |
Visit a block and propagate the dense lattice forward along the control flow edge from predecessor to block.
point corresponds to the program point before block. The default implementation merges in the state from the predecessor's terminator.
Reimplemented from mlir::dataflow::AbstractDenseForwardDataFlowAnalysis.
Definition at line 337 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 predecessor to block. The lattice is propagated forward along this edge. The lattices are as follows:
Definition at line 283 of file DenseAnalysis.h.
References mlir::dataflow::AbstractDenseForwardDataFlowAnalysis::visitBlockTransfer().
Referenced by visitBlockTransfer().
|
inlinefinalprotectedvirtual |
Propagate the dense lattice forward along the call control flow edge, which can be either entering or exiting the callee.
Default implementation for enter and exit callee actions 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 the external callee action additionally sets the "after" lattice to the entry state.
Reimplemented from mlir::dataflow::AbstractDenseForwardDataFlowAnalysis.
Definition at line 320 of file DenseAnalysis.h.
References visitCallControlFlowTransfer().
|
inlinevirtual |
Hook for customizing the behavior of lattice propagation along the call control flow edges.
Two types of (forward) propagation are possible here:
Definition at line 235 of file DenseAnalysis.h.
References mlir::dataflow::AbstractDenseForwardDataFlowAnalysis::visitCallControlFlowTransfer().
Referenced by visitCallControlFlowTransfer().
|
pure virtual |
Visit an operation with the dense lattice before its execution.
This function is expected to set the dense lattice after its execution and trigger change 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::AbstractDenseForwardDataFlowAnalysis.
Definition at line 314 of file DenseAnalysis.h.
References visitOperation().
|
inlinefinalprotectedvirtual |
Propagate the dense lattice forward 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 joins 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::AbstractDenseForwardDataFlowAnalysis.
Definition at line 328 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 forward along this edge. The lattices are as follows:
Definition at line 266 of file DenseAnalysis.h.
References mlir::dataflow::AbstractDenseForwardDataFlowAnalysis::visitRegionBranchControlFlowTransfer().
Referenced by visitRegionBranchControlFlowTransfer().