LLZK 2.0.0
An open-source IR for Zero Knowledge (ZK) circuits
Loading...
Searching...
No Matches
Ops.h.inc
Go to the documentation of this file.
1/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
2|* *|
3|* Op Declarations *|
4|* *|
5|* Automatically generated file, do not edit! *|
6|* From: Ops.td *|
7|* *|
8\*===----------------------------------------------------------------------===*/
9
10namespace llzk {
11namespace ram {
12class LoadOp;
13} // namespace ram
14} // namespace llzk
15namespace llzk {
16namespace ram {
17class StoreOp;
18} // namespace ram
19} // namespace llzk
20#ifdef GET_OP_CLASSES
21#undef GET_OP_CLASSES
22
23namespace llzk {
24namespace ram {
25
26//===----------------------------------------------------------------------===//
27// ::llzk::ram::LoadOp declarations
28//===----------------------------------------------------------------------===//
29
30namespace detail {
32public:
33protected:
34 ::mlir::DictionaryAttr odsAttrs;
35 ::std::optional<::mlir::OperationName> odsOpName;
36 ::mlir::RegionRange odsRegions;
37public:
38 LoadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = {}, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs)
39 odsOpName.emplace("ram.load", odsAttrs.getContext());
40 }
41
42 LoadOpGenericAdaptorBase(::mlir::Operation *op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), odsRegions(op->getRegions()) {}
43
44 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
45 return {index, 1};
46 }
47
48 ::mlir::DictionaryAttr getAttributes() {
49 return odsAttrs;
50 }
51
52};
53} // namespace detail
54template <typename RangeT>
56 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
58public:
59 LoadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = {}, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
60
61 LoadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LoadOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {}
62
63 LoadOpGenericAdaptor(RangeT values, const LoadOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
64
65 template <typename LateInst = LoadOp, typename = std::enable_if_t<std::is_same_v<LateInst, LoadOp>>>
66 LoadOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
67
68 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
69 return Base::getODSOperandIndexAndLength(index, odsOperands.size());
70 }
71
72 RangeT getODSOperands(unsigned index) {
73 auto valueRange = getODSOperandIndexAndLength(index);
74 return {std::next(odsOperands.begin(), valueRange.first),
75 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
76 }
77
78 ValueT getAddr() {
79 return (*getODSOperands(0).begin());
80 }
81
82 RangeT getOperands() {
83 return odsOperands;
84 }
85
86private:
87 RangeT odsOperands;
88};
89class LoadOpAdaptor : public LoadOpGenericAdaptor<::mlir::ValueRange> {
90public:
93
94 ::llvm::LogicalResult verify(::mlir::Location loc);
95};
96class LoadOp : public ::mlir::Op<LoadOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::llzk::felt::FeltType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::llzk::function::WitnessGen, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> {
97public:
98 using Op::Op;
99 using Op::print;
101 template <typename RangeT>
104 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
105 return {};
106 }
107
108 static constexpr ::llvm::StringLiteral getOperationName() {
109 return ::llvm::StringLiteral("ram.load");
110 }
111
112 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
113 return {index, 1};
114 }
115
116 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
117 auto valueRange = getODSOperandIndexAndLength(index);
118 return {std::next(getOperation()->operand_begin(), valueRange.first),
119 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
120 }
121
122 ::mlir::TypedValue<::mlir::IndexType> getAddr() {
123 return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(0).begin());
124 }
125
126 ::mlir::OpOperand &getAddrMutable() {
127 auto range = getODSOperandIndexAndLength(0);
128 return getOperation()->getOpOperand(range.first);
129 }
130
131 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
132 return {index, 1};
133 }
134
135 ::mlir::Operation::result_range getODSResults(unsigned index) {
136 auto valueRange = getODSResultIndexAndLength(index);
137 return {std::next(getOperation()->result_begin(), valueRange.first),
138 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
139 }
140
141 ::mlir::TypedValue<::llzk::felt::FeltType> getVal() {
142 return ::llvm::cast<::mlir::TypedValue<::llzk::felt::FeltType>>(*getODSResults(0).begin());
143 }
144
145 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type val, ::mlir::Value addr);
146 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value addr);
147 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
148 ::llvm::LogicalResult verifyInvariantsImpl();
149 ::llvm::LogicalResult verifyInvariants();
150 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
151 void print(::mlir::OpAsmPrinter &_odsPrinter);
152 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
153public:
154};
155} // namespace ram
156} // namespace llzk
157MLIR_DECLARE_EXPLICIT_TYPE_ID(::llzk::ram::LoadOp)
158
159namespace llzk {
160namespace ram {
161
162//===----------------------------------------------------------------------===//
163// ::llzk::ram::StoreOp declarations
164//===----------------------------------------------------------------------===//
165
166namespace detail {
168public:
169protected:
170 ::mlir::DictionaryAttr odsAttrs;
171 ::std::optional<::mlir::OperationName> odsOpName;
172 ::mlir::RegionRange odsRegions;
173public:
174 StoreOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = {}, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs)
175 odsOpName.emplace("ram.store", odsAttrs.getContext());
176 }
177
178 StoreOpGenericAdaptorBase(::mlir::Operation *op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), odsRegions(op->getRegions()) {}
179
180 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
181 return {index, 1};
182 }
183
184 ::mlir::DictionaryAttr getAttributes() {
185 return odsAttrs;
186 }
187
188};
189} // namespace detail
190template <typename RangeT>
192 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
194public:
195 StoreOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = {}, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
196
197 StoreOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StoreOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {}
198
199 StoreOpGenericAdaptor(RangeT values, const StoreOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
200
201 template <typename LateInst = StoreOp, typename = std::enable_if_t<std::is_same_v<LateInst, StoreOp>>>
202 StoreOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
203
204 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
205 return Base::getODSOperandIndexAndLength(index, odsOperands.size());
206 }
207
208 RangeT getODSOperands(unsigned index) {
209 auto valueRange = getODSOperandIndexAndLength(index);
210 return {std::next(odsOperands.begin(), valueRange.first),
211 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
212 }
213
214 ValueT getAddr() {
215 return (*getODSOperands(0).begin());
216 }
217
218 ValueT getVal() {
219 return (*getODSOperands(1).begin());
220 }
221
222 RangeT getOperands() {
223 return odsOperands;
224 }
225
226private:
227 RangeT odsOperands;
228};
229class StoreOpAdaptor : public StoreOpGenericAdaptor<::mlir::ValueRange> {
230public:
233
234 ::llvm::LogicalResult verify(::mlir::Location loc);
235};
236class StoreOp : public ::mlir::Op<StoreOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::ZeroResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::llzk::function::WitnessGen, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> {
237public:
238 using Op::Op;
239 using Op::print;
241 template <typename RangeT>
244 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
245 return {};
246 }
247
248 static constexpr ::llvm::StringLiteral getOperationName() {
249 return ::llvm::StringLiteral("ram.store");
250 }
251
252 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
253 return {index, 1};
254 }
255
256 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
257 auto valueRange = getODSOperandIndexAndLength(index);
258 return {std::next(getOperation()->operand_begin(), valueRange.first),
259 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
260 }
261
262 ::mlir::TypedValue<::mlir::IndexType> getAddr() {
263 return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSOperands(0).begin());
264 }
265
266 ::mlir::TypedValue<::llzk::felt::FeltType> getVal() {
267 return ::llvm::cast<::mlir::TypedValue<::llzk::felt::FeltType>>(*getODSOperands(1).begin());
268 }
269
270 ::mlir::OpOperand &getAddrMutable() {
271 auto range = getODSOperandIndexAndLength(0);
272 return getOperation()->getOpOperand(range.first);
273 }
274
275 ::mlir::OpOperand &getValMutable() {
276 auto range = getODSOperandIndexAndLength(1);
277 return getOperation()->getOpOperand(range.first);
278 }
279
280 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
281 return {index, 1};
282 }
283
284 ::mlir::Operation::result_range getODSResults(unsigned index) {
285 auto valueRange = getODSResultIndexAndLength(index);
286 return {std::next(getOperation()->result_begin(), valueRange.first),
287 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
288 }
289
290 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value addr, ::mlir::Value val);
291 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value addr, ::mlir::Value val);
292 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
293 ::llvm::LogicalResult verifyInvariantsImpl();
294 ::llvm::LogicalResult verifyInvariants();
295 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
296 void print(::mlir::OpAsmPrinter &_odsPrinter);
297 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
298public:
299};
300} // namespace ram
301} // namespace llzk
302MLIR_DECLARE_EXPLICIT_TYPE_ID(::llzk::ram::StoreOp)
303
304
305#endif // GET_OP_CLASSES
306
::llvm::LogicalResult verify(::mlir::Location loc)
Definition Ops.cpp.inc:60
LoadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs={}, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
Definition Ops.h.inc:59
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index)
Definition Ops.h.inc:68
RangeT getODSOperands(unsigned index)
Definition Ops.h.inc:72
LoadOpGenericAdaptor(RangeT values, LateInst op)
Definition Ops.h.inc:66
LoadOpGenericAdaptor(RangeT values, const LoadOpGenericAdaptorBase &base)
Definition Ops.h.inc:63
LoadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions={})
Definition Ops.h.inc:61
LoadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs={}, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
Definition Ops.h.inc:59
LoadOpGenericAdaptor< RangeT > GenericAdaptor
Definition Ops.h.inc:102
::llvm::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:105
GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute > > FoldAdaptor
Definition Ops.h.inc:103
::llvm::LogicalResult verifyInvariantsImpl()
Definition Ops.cpp.inc:83
void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect > > &effects)
Definition Ops.cpp.inc:156
::mlir::OpOperand & getAddrMutable()
Definition Ops.h.inc:126
void print(::mlir::OpAsmPrinter &_odsPrinter)
Definition Ops.cpp.inc:140
static ::llvm::ArrayRef<::llvm::StringRef > getAttributeNames()
Definition Ops.h.inc:104
static constexpr ::llvm::StringLiteral getOperationName()
Definition Ops.h.inc:108
::mlir::Operation::result_range getODSResults(unsigned index)
Definition Ops.h.inc:135
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
Definition Ops.cpp.inc:109
std::pair< unsigned, unsigned > getODSResultIndexAndLength(unsigned index)
Definition Ops.h.inc:131
::mlir::TypedValue<::llzk::felt::FeltType > getVal()
Definition Ops.h.inc:141
LoadOpAdaptor Adaptor
Definition Ops.h.inc:100
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index)
Definition Ops.h.inc:112
::mlir::TypedValue<::mlir::IndexType > getAddr()
Definition Ops.h.inc:122
::mlir::Operation::operand_range getODSOperands(unsigned index)
Definition Ops.h.inc:116
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type val, ::mlir::Value addr)
Definition Ops.cpp.inc:64
StoreOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs={}, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
Definition Ops.h.inc:195
::llvm::LogicalResult verify(::mlir::Location loc)
Definition Ops.cpp.inc:175
StoreOpGenericAdaptor(RangeT values, LateInst op)
Definition Ops.h.inc:202
StoreOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs={}, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
Definition Ops.h.inc:195
StoreOpGenericAdaptor(RangeT values, const StoreOpGenericAdaptorBase &base)
Definition Ops.h.inc:199
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index)
Definition Ops.h.inc:204
StoreOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions={})
Definition Ops.h.inc:197
RangeT getODSOperands(unsigned index)
Definition Ops.h.inc:208
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value addr, ::mlir::Value val)
Definition Ops.cpp.inc:179
static ::llvm::ArrayRef<::llvm::StringRef > getAttributeNames()
Definition Ops.h.inc:244
std::pair< unsigned, unsigned > getODSResultIndexAndLength(unsigned index)
Definition Ops.h.inc:280
::mlir::TypedValue<::llzk::felt::FeltType > getVal()
Definition Ops.h.inc:266
static constexpr ::llvm::StringLiteral getOperationName()
Definition Ops.h.inc:248
StoreOpGenericAdaptor< RangeT > GenericAdaptor
Definition Ops.h.inc:242
::mlir::OpOperand & getAddrMutable()
Definition Ops.h.inc:270
::mlir::Operation::operand_range getODSOperands(unsigned index)
Definition Ops.h.inc:256
void print(::mlir::OpAsmPrinter &_odsPrinter)
Definition Ops.cpp.inc:263
::mlir::OpOperand & getValMutable()
Definition Ops.h.inc:275
GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute > > FoldAdaptor
Definition Ops.h.inc:243
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
Definition Ops.cpp.inc:222
::mlir::TypedValue<::mlir::IndexType > getAddr()
Definition Ops.h.inc:262
::llvm::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:218
void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect > > &effects)
Definition Ops.cpp.inc:282
::llvm::LogicalResult verifyInvariantsImpl()
Definition Ops.cpp.inc:199
StoreOpAdaptor Adaptor
Definition Ops.h.inc:240
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index)
Definition Ops.h.inc:252
::mlir::Operation::result_range getODSResults(unsigned index)
Definition Ops.h.inc:284
::mlir::DictionaryAttr getAttributes()
Definition Ops.h.inc:48
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize)
Definition Ops.h.inc:44
LoadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs={}, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
Definition Ops.h.inc:38
LoadOpGenericAdaptorBase(::mlir::Operation *op)
Definition Ops.h.inc:42
::std::optional<::mlir::OperationName > odsOpName
Definition Ops.h.inc:35
StoreOpGenericAdaptorBase(::mlir::Operation *op)
Definition Ops.h.inc:178
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize)
Definition Ops.h.inc:180
StoreOpGenericAdaptorBase(::mlir::DictionaryAttr attrs={}, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
Definition Ops.h.inc:174
::mlir::DictionaryAttr getAttributes()
Definition Ops.h.inc:184
::std::optional<::mlir::OperationName > odsOpName
Definition Ops.h.inc:171