21 std::unordered_map<ConstrainRef, ConstrainRefLatticeValue, ConstrainRef::Hash>;
36 using ArrayTy = std::vector<std::unique_ptr<ConstrainRefLatticeValue>>;
58 std::pair<ConstrainRefLatticeValue, mlir::ChangeResult>
67 std::pair<ConstrainRefLatticeValue, mlir::ChangeResult>
72 std::pair<ConstrainRefLatticeValue, mlir::ChangeResult>
73 extract(
const std::vector<ConstrainRefIndex> &indices)
const;
82 virtual std::pair<ConstrainRefLatticeValue, mlir::ChangeResult>
89 using ValueMap = mlir::DenseMap<mlir::Value, ConstrainRefLatticeValue>;
90 using AbstractDenseLattice::AbstractDenseLattice;
98 static mlir::FailureOr<ConstrainRef>
getSourceRef(mlir::Value val);
103 mlir::ChangeResult
join(
const AbstractDenseLattice &rhs)
override {
107 llvm::report_fatal_error(
"invalid join lattice type");
108 return mlir::ChangeResult::NoChange;
112 virtual mlir::ChangeResult
meet(
const AbstractDenseLattice &rhs)
override {
113 llvm::report_fatal_error(
"meet operation is not supported for ConstrainRefLattice");
114 return mlir::ChangeResult::NoChange;
117 void print(mlir::raw_ostream &os)
const override;
124 return valMap[v].setValue(rhs);
135 size_t size()
const {
return valMap.size(); }
139 ValueMap::iterator
begin() {
return valMap.begin(); }
140 ValueMap::iterator
end() {
return valMap.end(); }
141 ValueMap::const_iterator
begin()
const {
return valMap.begin(); }
142 ValueMap::const_iterator
end()
const {
return valMap.end(); }
This file implements (LLZK-tailored) dense data-flow analysis using the data-flow analysis framework.
A value at a given point of the ConstrainRefLattice.
mlir::ChangeResult insert(const ConstrainRef &rhs)
Directly insert the ref into this value.
ConstrainRefLatticeValue(ScalarTy s)
std::pair< ConstrainRefLatticeValue, mlir::ChangeResult > extract(const std::vector< ConstrainRefIndex > &indices) const
Perform an array.extract or array.read operation, depending on how many indices are provided.
mlir::ChangeResult translateScalar(const TranslationMap &translation)
Translate this value using the translation map, assuming this value is a scalar.
const ConstrainRef & getSingleValue() const
ConstrainRefLatticeValue(ConstrainRef r)
std::pair< ConstrainRefLatticeValue, mlir::ChangeResult > referenceField(SymbolLookupResult< component::FieldDefOp > fieldRef) const
Add the given fieldRef to the constrain refs contained within this value.
ConstrainRefLatticeValue()
std::pair< ConstrainRefLatticeValue, mlir::ChangeResult > translate(const TranslationMap &translation) const
For the refs contained in this value, translate them given the translation map and return the transfo...
ConstrainRefLatticeValue(mlir::ArrayRef< int64_t > shape)
virtual std::pair< ConstrainRefLatticeValue, mlir::ChangeResult > elementwiseTransform(llvm::function_ref< ConstrainRef(const ConstrainRef &)> transform) const
Perform a recursive transformation over all elements of this value and return a new value with the mo...
A lattice for use in dense analysis.
mlir::ChangeResult join(const AbstractDenseLattice &rhs) override
Maximum upper bound.
virtual mlir::ChangeResult meet(const AbstractDenseLattice &rhs) override
Minimum lower bound.
ValueMap::const_iterator begin() const
mlir::ChangeResult setValue(mlir::Value v, const ConstrainRef &ref)
ConstrainRefLatticeValue getOrDefault(mlir::Value v) const
ConstrainRefLatticeValue getReturnValue(unsigned i) const
mlir::DenseMap< mlir::Value, ConstrainRefLatticeValue > ValueMap
static mlir::FailureOr< ConstrainRef > getSourceRef(mlir::Value val)
If val is the source of other values (i.e., a block argument from the function args or a constant),...
mlir::ChangeResult setValues(const ValueMap &rhs)
ValueMap::const_iterator end() const
void print(mlir::raw_ostream &os) const override
ValueMap::iterator begin()
friend mlir::raw_ostream & operator<<(mlir::raw_ostream &os, const ConstrainRefLattice &v)
mlir::ChangeResult setValue(mlir::Value v, const ConstrainRefLatticeValue &rhs)
const ValueMap & getMap() const
Defines a reference to a llzk object within a constrain function call.
bool isSingleValue() const
const ScalarTy & getScalarValue() const
mlir::dataflow::AbstractDenseLattice AbstractDenseLattice
void ensure(bool condition, llvm::Twine errMsg)
std::unordered_map< ConstrainRef, ConstrainRefLatticeValue, ConstrainRef::Hash > TranslationMap