MLIR
20.0.0git
|
An analysis that, by going backwards along the dataflow graph, annotates each value with a boolean storing true iff it is "live". More...
#include "mlir/Analysis/DataFlow/LivenessAnalysis.h"
Public Member Functions | |
LogicalResult | visitOperation (Operation *op, ArrayRef< Liveness * > operands, ArrayRef< const Liveness * > results) override |
For every value, liveness analysis determines whether or not it is "live". More... | |
void | visitBranchOperand (OpOperand &operand) override |
void | visitCallOperand (OpOperand &operand) override |
void | setToExitState (Liveness *lattice) override |
Set the given lattice element(s) at control flow exit point(s). More... | |
SparseBackwardDataFlowAnalysis (DataFlowSolver &solver, SymbolTableCollection &symbolTable) | |
Public Member Functions inherited from mlir::dataflow::SparseBackwardDataFlowAnalysis< Liveness > | |
SparseBackwardDataFlowAnalysis (DataFlowSolver &solver, SymbolTableCollection &symbolTable) | |
virtual void | visitExternalCall (CallOpInterface call, ArrayRef< Liveness * > argumentLattices, ArrayRef< const Liveness * > resultLattices) |
Visit a call to an external function. More... | |
Public Member Functions inherited from mlir::dataflow::AbstractSparseBackwardDataFlowAnalysis | |
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... | |
Public Member Functions inherited from mlir::DataFlowAnalysis | |
virtual | ~DataFlowAnalysis () |
DataFlowAnalysis (DataFlowSolver &solver) | |
Create an analysis with a reference to the parent solver. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from mlir::dataflow::SparseBackwardDataFlowAnalysis< Liveness > | |
Liveness * | getLatticeElement (Value value) override |
Get the lattice element for a value. More... | |
void | setToExitState (AbstractSparseLattice *lattice) override |
Set the given lattice element(s) at control flow exit point(s). More... | |
void | setAllToExitStates (ArrayRef< Liveness * > lattices) |
Protected Member Functions inherited from mlir::dataflow::AbstractSparseBackwardDataFlowAnalysis | |
AbstractSparseBackwardDataFlowAnalysis (DataFlowSolver &solver, SymbolTableCollection &symbolTable) | |
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... | |
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. 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... | |
An analysis that, by going backwards along the dataflow graph, annotates each value with a boolean storing true iff it is "live".
Definition at line 78 of file LivenessAnalysis.h.
|
overridevirtual |
Set the given lattice element(s) at control flow exit point(s).
Implements mlir::dataflow::SparseBackwardDataFlowAnalysis< Liveness >.
Definition at line 193 of file LivenessAnalysis.cpp.
References mlir::dataflow::Liveness::markLive().
|
inlineexplicit |
Definition at line 481 of file SparseAnalysis.h.
|
overridevirtual |
Implements mlir::dataflow::AbstractSparseBackwardDataFlowAnalysis.
Definition at line 95 of file LivenessAnalysis.cpp.
|
overridevirtual |
Implements mlir::dataflow::AbstractSparseBackwardDataFlowAnalysis.
Definition at line 177 of file LivenessAnalysis.cpp.
References mlir::IROperand< DerivedT, IRValueT >::get(), mlir::dataflow::SparseBackwardDataFlowAnalysis< Liveness >::getLatticeElement(), mlir::detail::IROperandBase::getOwner(), mlir::dataflow::Liveness::markLive(), and mlir::DataFlowAnalysis::propagateIfChanged().
|
overridevirtual |
For every value, liveness analysis determines whether or not it is "live".
A value is considered "live" iff it: (1) has memory effects OR (2) is returned by a public function OR (3) is used to compute a value of type (1) or (2). It is also to be noted that a value could be of multiple types (1/2/3) at the same time.
A value "has memory effects" iff it: (1.a) is an operand of an op with memory effects OR (1.b) is a non-forwarded branch operand and its branch op could take the control to a block that has an op with memory effects OR (1.c) is a non-forwarded call operand.
A value A
is said to be "used to compute" value B
iff B
cannot be computed in the absence of A
. Thus, in this implementation, we say that value A
is used to compute value B
iff: (3.a) B
is a result of an op with operand A
OR (3.b) A
is used to compute some value C
and C
is used to compute B
.
Implements mlir::dataflow::SparseBackwardDataFlowAnalysis< Liveness >.
Definition at line 72 of file LivenessAnalysis.cpp.