MLIR
20.0.0git
|
Base class for sparse forward data-flow analyses. More...
#include "mlir/Analysis/DataFlow/SparseAnalysis.h"
Public Member Functions | |
LogicalResult | initialize (Operation *top) override |
Initialize the analysis by visiting every owner of an SSA value: all operations and blocks. 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... | |
Protected Member Functions | |
AbstractSparseForwardDataFlowAnalysis (DataFlowSolver &solver) | |
virtual LogicalResult | visitOperationImpl (Operation *op, ArrayRef< const AbstractSparseLattice * > operandLattices, ArrayRef< AbstractSparseLattice * > resultLattices)=0 |
The operation transfer function. More... | |
virtual void | visitExternalCallImpl (CallOpInterface call, ArrayRef< const AbstractSparseLattice * > argumentLattices, ArrayRef< AbstractSparseLattice * > resultLattices)=0 |
The transfer function for calls to external functions. More... | |
virtual void | visitNonControlFlowArgumentsImpl (Operation *op, const RegionSuccessor &successor, ArrayRef< AbstractSparseLattice * > argLattices, unsigned firstIndex)=0 |
Given an operation with region control-flow, the lattices of the operands, and a region successor, compute the lattice values for block arguments that are not accounted for by the branching control flow (ex. More... | |
virtual AbstractSparseLattice * | getLatticeElement (Value value)=0 |
Get the lattice element of a value. More... | |
const AbstractSparseLattice * | getLatticeElementFor (ProgramPoint *point, Value value) |
Get a read-only lattice element for a value and add it as a dependency to a program point. More... | |
virtual void | setToEntryState (AbstractSparseLattice *lattice)=0 |
Set the given lattice element(s) at control flow entry point(s). More... | |
void | setAllToEntryStates (ArrayRef< AbstractSparseLattice * > lattices) |
void | join (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... | |
Base class for sparse forward data-flow analyses.
A sparse analysis implements a transfer function on operations from the lattices of the operands to the lattices of the results. This analysis will propagate lattices across control-flow edges and the callgraph using liveness information.
Visit a program point in sparse forward 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 186 of file SparseAnalysis.h.
|
explicitprotected |
Definition at line 46 of file SparseAnalysis.cpp.
|
protectedpure virtual |
Get the lattice element of a value.
Implemented in mlir::dataflow::SparseForwardDataFlowAnalysis< StateT >, mlir::dataflow::SparseForwardDataFlowAnalysis< IntegerValueRangeLattice >, and mlir::dataflow::SparseForwardDataFlowAnalysis< Lattice< ConstantValue > >.
Referenced by initialize().
|
protected |
Get a read-only lattice element for a value and add it as a dependency to a program point.
Definition at line 308 of file SparseAnalysis.cpp.
Referenced by mlir::dataflow::SparseForwardDataFlowAnalysis< StateT >::getLatticeElementFor().
|
overridevirtual |
Initialize the analysis by visiting every owner of an SSA value: all operations and blocks.
Implements mlir::DataFlowAnalysis.
Definition at line 53 of file SparseAnalysis.cpp.
References getLatticeElement(), mlir::Operation::getRegions(), and setToEntryState().
|
protected |
Join the lattice element and propagate and update if it changed.
Definition at line 321 of file SparseAnalysis.cpp.
References mlir::dataflow::AbstractSparseLattice::join(), and mlir::DataFlowAnalysis::propagateIfChanged().
Referenced by mlir::dataflow::SparseConstantPropagation::visitOperation().
|
protected |
Definition at line 315 of file SparseAnalysis.cpp.
References setToEntryState().
Referenced by mlir::dataflow::SparseForwardDataFlowAnalysis< StateT >::setAllToEntryStates().
|
protectedpure virtual |
Set the given lattice element(s) at control flow entry point(s).
Referenced by initialize(), and setAllToEntryStates().
|
overridevirtual |
Visit a program point.
If this is at beginning of block and all control-flow predecessors or callsites are known, then the arguments lattices are propagated from them. If this is after call operation or an operation with region control-flow, then its result lattices are set accordingly. Otherwise, the operation transfer function is invoked.
Implements mlir::DataFlowAnalysis.
Definition at line 88 of file SparseAnalysis.cpp.
References mlir::ProgramPoint::getBlock(), mlir::ProgramPoint::getPrevOp(), and mlir::ProgramPoint::isBlockStart().
|
protectedpure virtual |
The transfer function for calls to external functions.
|
protectedpure virtual |
Given an operation with region control-flow, the lattices of the operands, and a region successor, compute the lattice values for block arguments that are not accounted for by the branching control flow (ex.
the bounds of loops).
|
protectedpure virtual |
The operation transfer function.
Given the operand lattices, this function is expected to set the result lattices.