LLZK 3.0.0
An open-source IR for Zero Knowledge (ZK) circuits
Loading...
Searching...
No Matches
OpInterfaces.h.inc
Go to the documentation of this file.
1/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
2|* *|
3|* Interface Declarations *|
4|* *|
5|* Automatically generated file, do not edit! *|
6|* *|
7\*===----------------------------------------------------------------------===*/
8
9namespace llzk::array {
10
13
14} // namespace llzk::array
15namespace llzk::array {
16
19
20} // namespace llzk::array
21namespace llzk::array {
22
24namespace detail {
26 struct Concept {
28 ::mlir::TypedValue<::llzk::array::ArrayType> (*getArrRef)(const Concept *impl, ::mlir::Operation *);
29 ::mlir::OpOperand &(*getArrRefMutable)(const Concept *impl, ::mlir::Operation *);
30 };
31 template<typename ConcreteOp>
32 class Model : public Concept {
33 public:
36
37 static inline ::mlir::TypedValue<::llzk::array::ArrayType> getArrRef(const Concept *impl, ::mlir::Operation *tablegen_opaque_val);
38 static inline ::mlir::OpOperand &getArrRefMutable(const Concept *impl, ::mlir::Operation *tablegen_opaque_val);
39 };
40 template<typename ConcreteOp>
41 class FallbackModel : public Concept {
42 public:
45
46 static inline ::mlir::TypedValue<::llzk::array::ArrayType> getArrRef(const Concept *impl, ::mlir::Operation *tablegen_opaque_val);
47 static inline ::mlir::OpOperand &getArrRefMutable(const Concept *impl, ::mlir::Operation *tablegen_opaque_val);
48 };
49 template<typename ConcreteModel, typename ConcreteOp>
50 class ExternalModel : public FallbackModel<ConcreteModel> {
51 public:
52 using ConcreteEntity = ConcreteOp;
53 };
54};
55template <typename ConcreteOp>
57
58} // namespace detail
59class ArrayRefOpInterface : public ::mlir::OpInterface<ArrayRefOpInterface, detail::ArrayRefOpInterfaceInterfaceTraits> {
60public:
61 using ::mlir::OpInterface<ArrayRefOpInterface, detail::ArrayRefOpInterfaceInterfaceTraits>::OpInterface;
62 template <typename ConcreteOp>
63 struct Trait : public detail::ArrayRefOpInterfaceTrait<ConcreteOp> {};
64
66 ::mlir::TypedValue<::llzk::array::ArrayType> getArrRef();
67
69 ::mlir::OpOperand &getArrRefMutable();
70
72 inline ::llzk::array::ArrayType getArrRefType() { return getArrRef().getType(); }
73};
74
75} // namespace llzk::array
76namespace llzk::array {
77
79namespace detail {
81 struct Concept {
83 ::mlir::Operation::operand_range (*getIndices)(const Concept *impl, ::mlir::Operation *);
84 ::mlir::MutableOperandRange (*getIndicesMutable)(const Concept *impl, ::mlir::Operation *);
85 bool (*isRead)(const Concept *impl, ::mlir::Operation *);
87 const ::llzk::array::ArrayRefOpInterface::Concept *implArrayRefOpInterface = nullptr;
88
89 void initializeInterfaceConcept(::mlir::detail::InterfaceMap &interfaceMap) {
91 assert(implArrayRefOpInterface && "`::llzk::array::ArrayAccessOpInterface` expected its base interface `::llzk::array::ArrayRefOpInterface` to be registered");
92 }
93 };
94 template<typename ConcreteOp>
95 class Model : public Concept {
96 public:
99
100 static inline ::mlir::Operation::operand_range getIndices(const Concept *impl, ::mlir::Operation *tablegen_opaque_val);
101 static inline ::mlir::MutableOperandRange getIndicesMutable(const Concept *impl, ::mlir::Operation *tablegen_opaque_val);
102 static inline bool isRead(const Concept *impl, ::mlir::Operation *tablegen_opaque_val);
103 };
104 template<typename ConcreteOp>
105 class FallbackModel : public Concept {
106 public:
109
110 static inline ::mlir::Operation::operand_range getIndices(const Concept *impl, ::mlir::Operation *tablegen_opaque_val);
111 static inline ::mlir::MutableOperandRange getIndicesMutable(const Concept *impl, ::mlir::Operation *tablegen_opaque_val);
112 static inline bool isRead(const Concept *impl, ::mlir::Operation *tablegen_opaque_val);
113 };
114 template<typename ConcreteModel, typename ConcreteOp>
115 class ExternalModel : public FallbackModel<ConcreteModel> {
116 public:
117 using ConcreteEntity = ConcreteOp;
118 };
119};
120template <typename ConcreteOp>
122
123} // namespace detail
124class ArrayAccessOpInterface : public ::mlir::OpInterface<ArrayAccessOpInterface, detail::ArrayAccessOpInterfaceInterfaceTraits> {
125public:
126 using ::mlir::OpInterface<ArrayAccessOpInterface, detail::ArrayAccessOpInterfaceInterfaceTraits>::OpInterface;
127 template <typename ConcreteOp>
128 struct Trait : public detail::ArrayAccessOpInterfaceTrait<ConcreteOp> {};
129
131 ::mlir::Operation::operand_range getIndices();
132
134 ::mlir::MutableOperandRange getIndicesMutable();
135
137 bool isRead();
138
142 inline ::mlir::ArrayRef<::mlir::Attribute> getValueOperandDims() {
143 return getArrRefType().getDimensionSizes().drop_front(getIndices().size());
144 }
145
148 ::mlir::ArrayAttr indexOperandsToAttributeArray();
149
151 bool canRewire(const ::mlir::DestructurableMemorySlot &slot,
152 ::llvm::SmallPtrSetImpl<::mlir::Attribute> &usedIndices,
153 ::mlir::SmallVectorImpl<::mlir::MemorySlot> &mustBeSafelyUsed,
154 const ::mlir::DataLayout &dataLayout);
155
157 ::mlir::DeletionKind rewire(const ::mlir::DestructurableMemorySlot &slot,
158 ::llvm::DenseMap<::mlir::Attribute, ::mlir::MemorySlot> &subslots,
159 ::mlir::OpBuilder &builder, const ::mlir::DataLayout &dataLayout);
160
162 static ::llvm::SmallVector<::mlir::Value>
163 genIndexConstants(::mlir::OpBuilder &bldr, ::mlir::Location loc, ::mlir::ArrayAttr index);
164
166 static ::mlir::Value
167 genRead(::mlir::OpBuilder &bldr, ::mlir::Location loc, ::mlir::Value arrayRef,
168 ::mlir::ValueRange indices);
169
171 static ::mlir::Value
172 genRead(::mlir::OpBuilder &bldr, ::mlir::Location loc, ::mlir::Value arrayRef,
173 ::mlir::ArrayAttr index);
174
176 static void genWrite(::mlir::OpBuilder &bldr, ::mlir::Location loc, ::mlir::Value arrayRef,
177 ::mlir::ValueRange indices, ::mlir::Value value);
178
180 static void genWrite(::mlir::OpBuilder &bldr, ::mlir::Location loc, ::mlir::Value arrayRef,
181 ::mlir::ArrayAttr index, ::mlir::Value value);
182 //===----------------------------------------------------------------===//
183 // Inherited from ::llzk::array::ArrayRefOpInterface
184 //===----------------------------------------------------------------===//
185
186 operator ::llzk::array::ArrayRefOpInterface () const {
187 if (!*this) return nullptr;
188 return ::llzk::array::ArrayRefOpInterface(*this, getImpl()->implArrayRefOpInterface);
189 }
190
191
193 ::mlir::TypedValue<::llzk::array::ArrayType> getArrRef();
194
196 ::mlir::OpOperand &getArrRefMutable();
197
199 inline ::llzk::array::ArrayType getArrRefType() { return getArrRef().getType(); }
200};
201
202} // namespace llzk::array
203namespace llzk::array::detail {
204
205 template <typename ConcreteOp>
206 struct ArrayRefOpInterfaceTrait : public ::mlir::OpInterface<ArrayRefOpInterface, detail::ArrayRefOpInterfaceInterfaceTraits>::Trait<ConcreteOp> {
207 };
208
209} // namespace llzk::array::detail
210namespace llzk::array::detail {
211
212 template <typename ConcreteOp>
213 struct ArrayAccessOpInterfaceTrait : public ::mlir::OpInterface<ArrayAccessOpInterface, detail::ArrayAccessOpInterfaceInterfaceTraits>::Trait<ConcreteOp> {
214 };
215
216} // namespace llzk::array::detail
217namespace llzk::array {
218
219template<typename ConcreteOp>
220::mlir::TypedValue<::llzk::array::ArrayType> detail::ArrayRefOpInterfaceInterfaceTraits::Model<ConcreteOp>::getArrRef(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) {
221 return (llvm::cast<ConcreteOp>(tablegen_opaque_val)).getArrRef();
222}
223template<typename ConcreteOp>
224::mlir::OpOperand &detail::ArrayRefOpInterfaceInterfaceTraits::Model<ConcreteOp>::getArrRefMutable(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) {
225 return (llvm::cast<ConcreteOp>(tablegen_opaque_val)).getArrRefMutable();
226}
227template<typename ConcreteOp>
228::mlir::TypedValue<::llzk::array::ArrayType> detail::ArrayRefOpInterfaceInterfaceTraits::FallbackModel<ConcreteOp>::getArrRef(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) {
229 return static_cast<const ConcreteOp *>(impl)->getArrRef(tablegen_opaque_val);
230}
231template<typename ConcreteOp>
232::mlir::OpOperand &detail::ArrayRefOpInterfaceInterfaceTraits::FallbackModel<ConcreteOp>::getArrRefMutable(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) {
233 return static_cast<const ConcreteOp *>(impl)->getArrRefMutable(tablegen_opaque_val);
234}
235
236} // namespace llzk::array
237namespace llzk::array {
238
239template<typename ConcreteOp>
240::mlir::Operation::operand_range detail::ArrayAccessOpInterfaceInterfaceTraits::Model<ConcreteOp>::getIndices(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) {
241 return (llvm::cast<ConcreteOp>(tablegen_opaque_val)).getIndices();
242}
243template<typename ConcreteOp>
244::mlir::MutableOperandRange detail::ArrayAccessOpInterfaceInterfaceTraits::Model<ConcreteOp>::getIndicesMutable(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) {
245 return (llvm::cast<ConcreteOp>(tablegen_opaque_val)).getIndicesMutable();
246}
247template<typename ConcreteOp>
249 return (llvm::cast<ConcreteOp>(tablegen_opaque_val)).isRead();
250}
251template<typename ConcreteOp>
252::mlir::Operation::operand_range detail::ArrayAccessOpInterfaceInterfaceTraits::FallbackModel<ConcreteOp>::getIndices(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) {
253 return static_cast<const ConcreteOp *>(impl)->getIndices(tablegen_opaque_val);
254}
255template<typename ConcreteOp>
256::mlir::MutableOperandRange detail::ArrayAccessOpInterfaceInterfaceTraits::FallbackModel<ConcreteOp>::getIndicesMutable(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) {
257 return static_cast<const ConcreteOp *>(impl)->getIndicesMutable(tablegen_opaque_val);
258}
259template<typename ConcreteOp>
261 return static_cast<const ConcreteOp *>(impl)->isRead(tablegen_opaque_val);
262}
263
264} // namespace llzk::array
::mlir::DeletionKind rewire(const ::mlir::DestructurableMemorySlot &slot, ::llvm::DenseMap<::mlir::Attribute, ::mlir::MemorySlot > &subslots, ::mlir::OpBuilder &builder, const ::mlir::DataLayout &dataLayout)
Required by companion interface DestructurableAccessorOpInterface / SROA pass.
Definition Ops.cpp:304
static void genWrite(::mlir::OpBuilder &bldr, ::mlir::Location loc, ::mlir::Value arrayRef, ::mlir::ValueRange indices, ::mlir::Value value)
Create an array.write or array.insert for one concrete element or subarray.
::mlir::Operation::operand_range getIndices()
Gets the operand range containing the index for each dimension.
::mlir::Value genRead(::mlir::OpBuilder &bldr, ::mlir::Location loc, ::mlir::Value arrayRef, ::mlir::ArrayAttr index)
Create an array.read or array.extract for one concrete element or subarray.
::mlir::OpOperand & getArrRefMutable()
Gets the mutable operand slot holding the SSA Value for the referenced array.
::mlir::Value genRead(::mlir::OpBuilder &bldr, ::mlir::Location loc, ::mlir::Value arrayRef, ::mlir::ValueRange indices)
Create an array.read or array.extract for one concrete element or subarray.
bool isRead()
Return true if the op is a read, false if it's a write.
static void genWrite(::mlir::OpBuilder &bldr, ::mlir::Location loc, ::mlir::Value arrayRef, ::mlir::ArrayAttr index, ::mlir::Value value)
Create an array.write or array.insert for one concrete element or subarray.
inline ::mlir::ArrayRef<::mlir::Attribute > getValueOperandDims()
Compute the dimensions of the read/write value.
::mlir::ArrayAttr indexOperandsToAttributeArray()
Returns the multi-dimensional indices of the array access as an Attribute array or a null pointer if ...
Definition Ops.cpp:216
static ::llvm::SmallVector<::mlir::Value > genIndexConstants(::mlir::OpBuilder &bldr, ::mlir::Location loc, ::mlir::ArrayAttr index)
Generate arith.constant indices for one static array element position.
Definition Ops.cpp:228
::mlir::TypedValue<::llzk::array::ArrayType > getArrRef()
Gets the SSA Value for the referenced array.
bool canRewire(const ::mlir::DestructurableMemorySlot &slot, ::llvm::SmallPtrSetImpl<::mlir::Attribute > &usedIndices, ::mlir::SmallVectorImpl<::mlir::MemorySlot > &mustBeSafelyUsed, const ::mlir::DataLayout &dataLayout)
Required by companion interface DestructurableAccessorOpInterface / SROA pass.
Definition Ops.cpp:280
inline ::llzk::array::ArrayType getArrRefType()
Gets the type of the referenced array.
::mlir::MutableOperandRange getIndicesMutable()
Gets the mutable operand range containing the index for each dimension.
::mlir::OpOperand & getArrRefMutable()
Gets the mutable operand slot holding the SSA Value for the referenced array.
::mlir::TypedValue<::llzk::array::ArrayType > getArrRef()
Gets the SSA Value for the referenced array.
inline ::llzk::array::ArrayType getArrRefType()
Gets the type of the referenced array.
::llvm::ArrayRef<::mlir::Attribute > getDimensionSizes() const
static bool isRead(const Concept *impl, ::mlir::Operation *tablegen_opaque_val)
static inline ::mlir::MutableOperandRange getIndicesMutable(const Concept *impl, ::mlir::Operation *tablegen_opaque_val)
static inline ::mlir::Operation::operand_range getIndices(const Concept *impl, ::mlir::Operation *tablegen_opaque_val)
static inline ::mlir::MutableOperandRange getIndicesMutable(const Concept *impl, ::mlir::Operation *tablegen_opaque_val)
static inline ::mlir::Operation::operand_range getIndices(const Concept *impl, ::mlir::Operation *tablegen_opaque_val)
static bool isRead(const Concept *impl, ::mlir::Operation *tablegen_opaque_val)
static inline ::mlir::OpOperand & getArrRefMutable(const Concept *impl, ::mlir::Operation *tablegen_opaque_val)
static inline ::mlir::TypedValue<::llzk::array::ArrayType > getArrRef(const Concept *impl, ::mlir::Operation *tablegen_opaque_val)
static inline ::mlir::OpOperand & getArrRefMutable(const Concept *impl, ::mlir::Operation *tablegen_opaque_val)
static inline ::mlir::TypedValue<::llzk::array::ArrayType > getArrRef(const Concept *impl, ::mlir::Operation *tablegen_opaque_val)
Common interface for operations that reference an array value.
void initializeInterfaceConcept(::mlir::detail::InterfaceMap &interfaceMap)
bool(* isRead)(const Concept *impl, ::mlir::Operation *)
::mlir::Operation::operand_range(* getIndices)(const Concept *impl, ::mlir::Operation *)
The methods defined by the interface.
::mlir::MutableOperandRange(* getIndicesMutable)(const Concept *impl, ::mlir::Operation *)
const ::llzk::array::ArrayRefOpInterface::Concept * implArrayRefOpInterface
The base classes of this interface.
::mlir::TypedValue<::llzk::array::ArrayType >(* getArrRef)(const Concept *impl, ::mlir::Operation *)
The methods defined by the interface.
::mlir::OpOperand &(* getArrRefMutable)(const Concept *impl, ::mlir::Operation *)