MLIR
18.0.0git
|
This analysis implements sparse constant propagation, which attempts to determine constant-valued results for operations using constant-valued operands, by speculatively folding operations. More...
#include "mlir/Analysis/DataFlow/ConstantPropagationAnalysis.h"
Public Member Functions | |
void | visitOperation (Operation *op, ArrayRef< const Lattice< ConstantValue > * > operands, ArrayRef< Lattice< ConstantValue > * > results) override |
Visit an operation with the lattices of its operands. More... | |
void | setToEntryState (Lattice< ConstantValue > *lattice) override |
Set the given lattice element(s) at control flow entry point(s). More... | |
SparseForwardDataFlowAnalysis (DataFlowSolver &solver) | |
![]() | |
SparseForwardDataFlowAnalysis (DataFlowSolver &solver) | |
virtual void | visitNonControlFlowArguments (Operation *op, const RegionSuccessor &successor, ArrayRef< Lattice< ConstantValue > * > argLattices, unsigned firstIndex) |
Given an operation with possible 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... | |
![]() | |
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... | |
![]() | |
virtual | ~DataFlowAnalysis () |
DataFlowAnalysis (DataFlowSolver &solver) | |
Create an analysis with a reference to the parent solver. More... | |
Additional Inherited Members | |
![]() | |
Lattice< ConstantValue > * | getLatticeElement (Value value) override |
Get the lattice element for a value. More... | |
const Lattice< ConstantValue > * | getLatticeElementFor (ProgramPoint point, Value value) |
Get the lattice element for a value and create a dependency on the provided program point. More... | |
void | setAllToEntryStates (ArrayRef< Lattice< ConstantValue > * > lattices) |
![]() | |
AbstractSparseForwardDataFlowAnalysis (DataFlowSolver &solver) | |
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... | |
void | setAllToEntryStates (ArrayRef< AbstractSparseLattice * > lattices) |
void | join (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 program point on this analysis. More... | |
void | propagateIfChanged (AnalysisState *state, ChangeResult changed) |
Propagate an update to a state if it changed. More... | |
template<typename PointT > | |
void | registerPointKind () |
Register a custom program point class. More... | |
template<typename PointT , typename... Args> | |
PointT * | getProgramPoint (Args &&...args) |
Get or create a custom program point. More... | |
template<typename StateT , typename PointT > | |
StateT * | getOrCreate (PointT point) |
Get the analysis state associated with the program point. More... | |
template<typename StateT , typename PointT > | |
const StateT * | getOrCreateFor (ProgramPoint dependent, PointT point) |
Get a read-only analysis state for the given point and create a dependency on dependent . More... | |
This analysis implements sparse constant propagation, which attempts to determine constant-valued results for operations using constant-valued operands, by speculatively folding operations.
When combined with dead-code analysis, this becomes sparse conditional constant propagation (SCCP).
Definition at line 99 of file ConstantPropagationAnalysis.h.
|
overridevirtual |
Set the given lattice element(s) at control flow entry point(s).
Implements mlir::dataflow::SparseForwardDataFlowAnalysis< Lattice< ConstantValue > >.
Definition at line 114 of file ConstantPropagationAnalysis.cpp.
References mlir::dataflow::ConstantValue::getUnknownConstant(), mlir::dataflow::Lattice< ValueT >::join(), and mlir::DataFlowAnalysis::propagateIfChanged().
|
inlineexplicit |
Definition at line 266 of file SparseAnalysis.h.
|
overridevirtual |
Visit an operation with the lattices of its operands.
This function is expected to set the lattices of the operation's results.
Implements mlir::dataflow::SparseForwardDataFlowAnalysis< Lattice< ConstantValue > >.
Definition at line 47 of file ConstantPropagationAnalysis.cpp.