MLIR
21.0.0git
|
A sparse (backward) data-flow analysis for propagating SSA value lattices backwards across the IR by implementing transfer functions for operations. More...
#include "mlir/Analysis/DataFlow/SparseAnalysis.h"
Public Member Functions | |
SparseBackwardDataFlowAnalysis (DataFlowSolver &solver, SymbolTableCollection &symbolTable) | |
virtual LogicalResult | visitOperation (Operation *op, ArrayRef< StateT * > operands, ArrayRef< const StateT * > results)=0 |
Visit an operation with the lattices of its results. More... | |
virtual void | visitExternalCall (CallOpInterface call, ArrayRef< StateT * > argumentLattices, ArrayRef< const StateT * > resultLattices) |
Visit a call to an external function. More... | |
![]() | |
LogicalResult | initialize (Operation *top) override |
Initialize the analysis by visiting the operation and everything nested under it. More... | |
LogicalResult | visit (ProgramPoint *point) override |
Visit a program point. More... | |
![]() | |
virtual | ~DataFlowAnalysis () |
DataFlowAnalysis (DataFlowSolver &solver) | |
Create an analysis with a reference to the parent solver. More... | |
Protected Member Functions | |
StateT * | getLatticeElement (Value value) override |
Get the lattice element for a value. More... | |
virtual void | setToExitState (StateT *lattice)=0 |
Set the given lattice element(s) at control flow exit point(s). More... | |
void | setToExitState (AbstractSparseLattice *lattice) override |
Set the given lattice element(s) at control flow exit point(s). More... | |
void | setAllToExitStates (ArrayRef< StateT * > lattices) |
![]() | |
AbstractSparseBackwardDataFlowAnalysis (DataFlowSolver &solver, SymbolTableCollection &symbolTable) | |
virtual void | visitBranchOperand (OpOperand &operand)=0 |
virtual void | visitCallOperand (OpOperand &operand)=0 |
void | setAllToExitStates (ArrayRef< AbstractSparseLattice * > lattices) |
Set the given lattice element(s) at control flow exit point(s). More... | |
SmallVector< AbstractSparseLattice * > | getLatticeElements (ValueRange values) |
Get the lattice elements for a range of values. More... | |
void | meet (AbstractSparseLattice *lhs, const AbstractSparseLattice &rhs) |
Join the lattice element and propagate and update if it changed. More... | |
![]() | |
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... | |
ProgramPoint * | getProgramPointBefore (Operation *op) |
Get a uniqued program point instance. More... | |
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. More... | |
A sparse (backward) data-flow analysis for propagating SSA value lattices backwards across the IR by implementing transfer functions for operations.
StateT
is expected to be a subclass of AbstractSparseLattice
.
Visit a program point in sparse backward data-flow analysis will invoke the transfer function of the operation preceding the program point iterator. Visit a program point at the begining of block will visit the block itself.
Definition at line 483 of file SparseAnalysis.h.
|
inlineexplicit |
Definition at line 486 of file SparseAnalysis.h.
|
inlineoverrideprotectedvirtual |
Get the lattice element for a value.
Implements mlir::dataflow::AbstractSparseBackwardDataFlowAnalysis.
Definition at line 511 of file SparseAnalysis.h.
|
inlineprotected |
Definition at line 520 of file SparseAnalysis.h.
References mlir::dataflow::AbstractSparseBackwardDataFlowAnalysis::setAllToExitStates().
|
inlineoverrideprotectedvirtual |
Set the given lattice element(s) at control flow exit point(s).
Implements mlir::dataflow::AbstractSparseBackwardDataFlowAnalysis.
Definition at line 517 of file SparseAnalysis.h.
References mlir::dataflow::SparseBackwardDataFlowAnalysis< StateT >::setToExitState().
|
protectedpure virtual |
Set the given lattice element(s) at control flow exit point(s).
Implemented in mlir::dataflow::LivenessAnalysis.
Referenced by mlir::dataflow::SparseBackwardDataFlowAnalysis< StateT >::setToExitState().
|
inlinevirtual |
Visit a call to an external function.
This function is expected to set lattice values of the call operands. By default, calls visitCallOperand
for all operands.
Definition at line 499 of file SparseAnalysis.h.
References mlir::dataflow::AbstractSparseBackwardDataFlowAnalysis::visitCallOperand().
|
pure virtual |
Visit an operation with the lattices of its results.
This function is expected to set the lattices of the operation's operands.
Implemented in mlir::dataflow::LivenessAnalysis.