MLIR
21.0.0git
|
Base class for sparse backward data-flow analyses. More...
#include "mlir/Analysis/DataFlow/SparseAnalysis.h"
Public Member Functions | |
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... | |
virtual void | initializeEquivalentLatticeAnchor (Operation *top) |
Initialize lattice anchor equivalence class from the provided top-level operation. More... | |
Protected Member Functions | |
AbstractSparseBackwardDataFlowAnalysis (DataFlowSolver &solver, SymbolTableCollection &symbolTable) | |
virtual LogicalResult | visitOperationImpl (Operation *op, ArrayRef< AbstractSparseLattice * > operandLattices, ArrayRef< const AbstractSparseLattice * > resultLattices)=0 |
The operation transfer function. More... | |
virtual void | visitExternalCallImpl (CallOpInterface call, ArrayRef< AbstractSparseLattice * > operandLattices, ArrayRef< const AbstractSparseLattice * > resultLattices)=0 |
The transfer function for calls to external functions. More... | |
virtual void | visitBranchOperand (OpOperand &operand)=0 |
virtual void | visitCallOperand (OpOperand &operand)=0 |
virtual void | setToExitState (AbstractSparseLattice *lattice)=0 |
Set the given lattice element(s) at control flow exit point(s) and propagate the update if it chaned. More... | |
void | setAllToExitStates (ArrayRef< AbstractSparseLattice * > lattices) |
Set the given lattice element(s) at control flow exit point(s) and propagate the update if it chaned. More... | |
virtual AbstractSparseLattice * | getLatticeElement (Value value)=0 |
Get the lattice element for a value. 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... | |
virtual LogicalResult | visitCallableOperation (Operation *op, CallableOpInterface callable, ArrayRef< AbstractSparseLattice * > operandLattices) |
Visits a callable operation. 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 > | |
void | unionLatticeAnchors (AnchorT anchor, AnchorT other) |
Union input anchors under the given state. 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... | |
Base class for sparse backward data-flow analyses.
Similar to AbstractSparseForwardDataFlowAnalysis, but walks bottom to top.
Definition at line 408 of file SparseAnalysis.h.
|
explicitprotected |
Definition at line 341 of file SparseAnalysis.cpp.
|
protectedpure virtual |
Get the lattice element for a value.
Implemented in mlir::dataflow::SparseBackwardDataFlowAnalysis< StateT >, and mlir::dataflow::SparseBackwardDataFlowAnalysis< Liveness >.
Referenced by getLatticeElements().
|
protected |
Get the lattice elements for a range of values.
Definition at line 384 of file SparseAnalysis.cpp.
References getLatticeElement().
|
overridevirtual |
Initialize the analysis by visiting the operation and everything nested under it.
Implements mlir::DataFlowAnalysis.
Definition at line 348 of file SparseAnalysis.cpp.
|
protected |
Join the lattice element and propagate and update if it changed.
Definition at line 631 of file SparseAnalysis.cpp.
References mlir::dataflow::AbstractSparseLattice::meet(), and mlir::DataFlowAnalysis::propagateIfChanged().
Referenced by visitCallableOperation().
|
protected |
Set the given lattice element(s) at control flow exit point(s) and propagate the update if it chaned.
Definition at line 625 of file SparseAnalysis.cpp.
References setToExitState().
Referenced by mlir::dataflow::SparseBackwardDataFlowAnalysis< StateT >::setAllToExitStates(), and visitCallableOperation().
|
protectedpure virtual |
Set the given lattice element(s) at control flow exit point(s) and propagate the update if it chaned.
Implemented in mlir::dataflow::SparseBackwardDataFlowAnalysis< StateT >, and mlir::dataflow::SparseBackwardDataFlowAnalysis< Liveness >.
Referenced by setAllToExitStates().
|
overridevirtual |
Visit a program point.
If it is after call operation or an operation with block or region control-flow, then operand lattices are set accordingly. Otherwise, invokes the operation transfer function (visitOperationImpl
).
Implements mlir::DataFlowAnalysis.
Definition at line 373 of file SparseAnalysis.cpp.
References mlir::ProgramPoint::getPrevOp(), and mlir::ProgramPoint::isBlockStart().
|
protectedpure virtual |
Implemented in mlir::dataflow::LivenessAnalysis.
|
protectedvirtual |
Visits a callable operation.
If all the call sites are known computes the operand lattices of op
from the result lattices of all the call sites; otherwise, conservatively marks them as having reached their pessimistic fixpoints. This method can be overridden to, for example, be less conservative and propagate the information even if some call sites are unknown.
Definition at line 533 of file SparseAnalysis.cpp.
References mlir::dataflow::PredecessorState::allPredecessorsKnown(), mlir::dataflow::PredecessorState::getKnownPredecessors(), mlir::DataFlowAnalysis::getProgramPointAfter(), meet(), and setAllToExitStates().
|
protectedpure virtual |
Implemented in mlir::dataflow::LivenessAnalysis.
Referenced by mlir::dataflow::SparseBackwardDataFlowAnalysis< StateT >::visitExternalCall().
|
protectedpure virtual |
The transfer function for calls to external functions.
|
protectedpure virtual |
The operation transfer function.
Given the result lattices, this function is expected to set the operand lattices.