16 #ifndef MLIR_ANALYSIS_DATAFLOW_CONSTANTPROPAGATIONANALYSIS_H
17 #define MLIR_ANALYSIS_DATAFLOW_CONSTANTPROPAGATIONANALYSIS_H
37 : constant(constant), dialect(dialect) {}
53 return constant == rhs.constant;
57 void print(raw_ostream &os)
const;
86 std::optional<Attribute> constant;
Attributes are known-constant values of operations.
Dialects are groups of MLIR operations, types and attributes, as well as behavior associated with the...
Operation is the basic unit of execution within MLIR.
This lattice value represents a known constant value of a lattice.
bool operator==(const ConstantValue &rhs) const
Compare the constant values.
ConstantValue()=default
Construct a constant value as uninitialized.
ConstantValue(Attribute constant, Dialect *dialect)
Construct a constant value with a known constant.
Attribute getConstantValue() const
Get the constant value. Returns null if no value was determined.
Dialect * getConstantDialect() const
Get the dialect instance that can be used to materialize the constant.
static ConstantValue join(const ConstantValue &lhs, const ConstantValue &rhs)
The union with another constant value is null if they are different, and the same if they are the sam...
bool isUninitialized() const
Whether the state is uninitialized.
void print(raw_ostream &os) const
Print the constant value.
static ConstantValue getUninitialized()
The state where the constant value is uninitialized.
static ConstantValue getUnknownConstant()
The state where the constant value is unknown.
This class represents a lattice holding a specific value of type ValueT.
This analysis implements sparse constant propagation, which attempts to determine constant-valued res...
void setToEntryState(Lattice< ConstantValue > *lattice) override
Set the given lattice element(s) at control flow entry point(s).
LogicalResult visitOperation(Operation *op, ArrayRef< const Lattice< ConstantValue > * > operands, ArrayRef< Lattice< ConstantValue > * > results) override
Visit an operation with the lattices of its operands.
A sparse forward data-flow analysis for propagating SSA value lattices across the IR by implementing ...
SparseForwardDataFlowAnalysis(DataFlowSolver &solver)
Include the generated interface declarations.