LLZK 2.1.1
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 cast {
12class FeltToIndexOp;
13} // namespace cast
14} // namespace llzk
15namespace llzk {
16namespace cast {
17class IntToFeltOp;
18} // namespace cast
19} // namespace llzk
20#ifdef GET_OP_CLASSES
21#undef GET_OP_CLASSES
22
23namespace llzk {
24namespace cast {
25
26//===----------------------------------------------------------------------===//
27// ::llzk::cast::FeltToIndexOp declarations
28//===----------------------------------------------------------------------===//
29
30namespace detail {
32public:
33 struct Properties {
34 using overflowTy = ::llzk::cast::OverflowSemanticsAttr;
36
37 auto getOverflow() {
38 auto &propStorage = this->overflow;
39 return ::llvm::dyn_cast_or_null<::llzk::cast::OverflowSemanticsAttr>(propStorage);
40 }
41 void setOverflow(const ::llzk::cast::OverflowSemanticsAttr &propValue) {
42 this->overflow = propValue;
43 }
44 bool operator==(const Properties &rhs) const {
45 return
46 rhs.overflow == this->overflow &&
47 true;
48 }
49 bool operator!=(const Properties &rhs) const {
50 return !(*this == rhs);
51 }
52 };
53protected:
54 ::mlir::DictionaryAttr odsAttrs;
55 ::std::optional<::mlir::OperationName> odsOpName;
57 ::mlir::RegionRange odsRegions;
58public:
59 FeltToIndexOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
60 odsOpName.emplace("cast.toindex", odsAttrs.getContext());
61 }
62
64
65 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
66 return {index, 1};
67 }
68
70 return properties;
71 }
72
73 ::mlir::DictionaryAttr getAttributes() {
74 return odsAttrs;
75 }
76
77 ::llzk::cast::OverflowSemanticsAttr getOverflowAttr();
79};
80} // namespace detail
81template <typename RangeT>
83 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
85public:
86 FeltToIndexOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
87
88 FeltToIndexOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FeltToIndexOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
89
90 FeltToIndexOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : FeltToIndexOpGenericAdaptor(values, attrs, Properties{}, {}) {}
91
92 FeltToIndexOpGenericAdaptor(RangeT values, const FeltToIndexOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
93
94 template <typename LateInst = FeltToIndexOp, typename = std::enable_if_t<std::is_same_v<LateInst, FeltToIndexOp>>>
95 FeltToIndexOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
96
97 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
98 return Base::getODSOperandIndexAndLength(index, odsOperands.size());
99 }
100
101 RangeT getODSOperands(unsigned index) {
102 auto valueRange = getODSOperandIndexAndLength(index);
103 return {std::next(odsOperands.begin(), valueRange.first),
104 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
105 }
106
107 ValueT getValue() {
108 return (*getODSOperands(0).begin());
109 }
110
111 RangeT getOperands() {
112 return odsOperands;
113 }
114
115private:
116 RangeT odsOperands;
117};
118class FeltToIndexOpAdaptor : public FeltToIndexOpGenericAdaptor<::mlir::ValueRange> {
119public:
122
123 ::llvm::LogicalResult verify(::mlir::Location loc);
124};
125class FeltToIndexOp : public ::mlir::Op<FeltToIndexOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::IndexType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::llzk::function::NotFieldNative, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> {
126public:
127 using Op::Op;
128 using Op::print;
130 template <typename RangeT>
134 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
135 static ::llvm::StringRef attrNames[] = {::llvm::StringRef("overflow")};
136 return ::llvm::ArrayRef(attrNames);
137 }
138
139 ::mlir::StringAttr getOverflowAttrName() {
140 return getAttributeNameForIndex(0);
141 }
142
143 static ::mlir::StringAttr getOverflowAttrName(::mlir::OperationName name) {
144 return getAttributeNameForIndex(name, 0);
145 }
146
147 static constexpr ::llvm::StringLiteral getOperationName() {
148 return ::llvm::StringLiteral("cast.toindex");
149 }
150
151 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
152 return {index, 1};
153 }
154
155 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
156 auto valueRange = getODSOperandIndexAndLength(index);
157 return {std::next(getOperation()->operand_begin(), valueRange.first),
158 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
159 }
160
161 ::mlir::TypedValue<::llzk::felt::FeltType> getValue() {
162 return ::llvm::cast<::mlir::TypedValue<::llzk::felt::FeltType>>(*getODSOperands(0).begin());
163 }
164
165 ::mlir::OpOperand &getValueMutable() {
166 auto range = getODSOperandIndexAndLength(0);
167 return getOperation()->getOpOperand(range.first);
168 }
169
170 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
171 return {index, 1};
172 }
173
174 ::mlir::Operation::result_range getODSResults(unsigned index) {
175 auto valueRange = getODSResultIndexAndLength(index);
176 return {std::next(getOperation()->result_begin(), valueRange.first),
177 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
178 }
179
180 ::mlir::TypedValue<::mlir::IndexType> getResult() {
181 return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSResults(0).begin());
182 }
183
184 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
185 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
186 static llvm::hash_code computePropertiesHash(const Properties &prop);
187 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
188 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
189 static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs);
190 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
191 static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state);
192 void writeProperties(::mlir::DialectBytecodeWriter &writer);
193 ::llzk::cast::OverflowSemanticsAttr getOverflowAttr() {
194 return ::llvm::dyn_cast_or_null<::llzk::cast::OverflowSemanticsAttr>(getProperties().overflow);
195 }
196
198 void setOverflowAttr(::llzk::cast::OverflowSemanticsAttr attr) {
199 getProperties().overflow = attr;
200 }
201
203 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::llzk::cast::OverflowSemanticsAttr overflow, ::mlir::Value value);
204 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llzk::cast::OverflowSemanticsAttr overflow, ::mlir::Value value);
205 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llzk::cast::OverflowSemanticsAttr overflow, ::mlir::Value value);
206 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::llzk::cast::OverflowSemantics overflow, ::mlir::Value value);
207 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llzk::cast::OverflowSemantics overflow, ::mlir::Value value);
208 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llzk::cast::OverflowSemantics overflow, ::mlir::Value value);
209 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
210 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
211 static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties);
212 ::llvm::LogicalResult verifyInvariantsImpl();
213 ::llvm::LogicalResult verifyInvariants();
214 static ::llvm::LogicalResult canonicalize(FeltToIndexOp op, ::mlir::PatternRewriter &rewriter);
215 static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context);
216 static ::llvm::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes);
217 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
218 void print(::mlir::OpAsmPrinter &_odsPrinter);
219 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
220private:
221 ::mlir::StringAttr getAttributeNameForIndex(unsigned index) {
222 return getAttributeNameForIndex((*this)->getName(), index);
223 }
224
225 static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) {
226 assert(index < 1 && "invalid attribute index");
227 assert(name.getStringRef() == getOperationName() && "invalid operation name");
228 assert(name.isRegistered() && "Operation isn't registered, missing a "
229 "dependent dialect loading?");
230 return name.getAttributeNames()[index];
231 }
232
233public:
234 static ::mlir::ParseResult parseOptionalOverflowSemantics(
235 ::mlir::OpAsmParser &parser, ::llzk::cast::OverflowSemanticsAttr &overflow
236 );
237
239 ::mlir::OpAsmPrinter &printer, FeltToIndexOp op,
240 ::llzk::cast::OverflowSemanticsAttr overflow
241 );
242
243 private:
244 static ::mlir::ParseResult parseInferredOrParsedType(
245 ::mlir::OpAsmParser &parser, ::mlir::Type &opType, bool isFirst
246 ) {
247 if (mlir::succeeded(isFirst ? parser.parseOptionalColon() : parser.parseOptionalComma())) {
248 // If there is a comma, parse the `opType`
249 mlir::Type type;
250 if (parser.parseCustomTypeWithFallback(type)) {
251 return mlir::failure();
252 }
253 opType = type;
254 } else {
255 // Otherwise, build the default type
256 opType =
257 ::llzk::felt::FeltType::get(parser.getBuilder().getContext());
258 }
259 return mlir::success();
260 }
261
262 static void printInferredOrParsedType(::mlir::OpAsmPrinter &printer,
263 ::mlir::Operation *op, ::mlir::Type opType, bool isFirst
264 ) {
265 printer << (isFirst ? " : " : ", ");
266 printer.printStrippedAttrOrType(opType);
267 }
268};
269} // namespace cast
270} // namespace llzk
271MLIR_DECLARE_EXPLICIT_TYPE_ID(::llzk::cast::FeltToIndexOp)
272
273namespace llzk {
274namespace cast {
275
276//===----------------------------------------------------------------------===//
277// ::llzk::cast::IntToFeltOp declarations
278//===----------------------------------------------------------------------===//
279
280namespace detail {
282public:
283 struct Properties {
284 using overflowTy = ::llzk::cast::OverflowSemanticsAttr;
286
287 auto getOverflow() {
288 auto &propStorage = this->overflow;
289 return ::llvm::dyn_cast_or_null<::llzk::cast::OverflowSemanticsAttr>(propStorage);
290 }
291 void setOverflow(const ::llzk::cast::OverflowSemanticsAttr &propValue) {
292 this->overflow = propValue;
293 }
294 bool operator==(const Properties &rhs) const {
295 return
296 rhs.overflow == this->overflow &&
297 true;
298 }
299 bool operator!=(const Properties &rhs) const {
300 return !(*this == rhs);
301 }
302 };
303protected:
304 ::mlir::DictionaryAttr odsAttrs;
305 ::std::optional<::mlir::OperationName> odsOpName;
307 ::mlir::RegionRange odsRegions;
308public:
309 IntToFeltOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
310 odsOpName.emplace("cast.tofelt", odsAttrs.getContext());
311 }
312
314
315 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
316 return {index, 1};
317 }
318
320 return properties;
321 }
322
323 ::mlir::DictionaryAttr getAttributes() {
324 return odsAttrs;
325 }
326
327 ::llzk::cast::OverflowSemanticsAttr getOverflowAttr();
329};
330} // namespace detail
331template <typename RangeT>
333 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
335public:
336 IntToFeltOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
337
338 IntToFeltOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IntToFeltOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
339
340 IntToFeltOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : IntToFeltOpGenericAdaptor(values, attrs, Properties{}, {}) {}
341
342 IntToFeltOpGenericAdaptor(RangeT values, const IntToFeltOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
343
344 template <typename LateInst = IntToFeltOp, typename = std::enable_if_t<std::is_same_v<LateInst, IntToFeltOp>>>
345 IntToFeltOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
346
347 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
348 return Base::getODSOperandIndexAndLength(index, odsOperands.size());
349 }
350
351 RangeT getODSOperands(unsigned index) {
352 auto valueRange = getODSOperandIndexAndLength(index);
353 return {std::next(odsOperands.begin(), valueRange.first),
354 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
355 }
356
357 ValueT getValue() {
358 return (*getODSOperands(0).begin());
359 }
360
361 RangeT getOperands() {
362 return odsOperands;
363 }
364
365private:
366 RangeT odsOperands;
367};
368class IntToFeltOpAdaptor : public IntToFeltOpGenericAdaptor<::mlir::ValueRange> {
369public:
372
373 ::llvm::LogicalResult verify(::mlir::Location loc);
374};
375class IntToFeltOp : public ::mlir::Op<IntToFeltOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::llzk::felt::FeltType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> {
376public:
377 using Op::Op;
378 using Op::print;
380 template <typename RangeT>
384 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
385 static ::llvm::StringRef attrNames[] = {::llvm::StringRef("overflow")};
386 return ::llvm::ArrayRef(attrNames);
387 }
388
389 ::mlir::StringAttr getOverflowAttrName() {
390 return getAttributeNameForIndex(0);
391 }
392
393 static ::mlir::StringAttr getOverflowAttrName(::mlir::OperationName name) {
394 return getAttributeNameForIndex(name, 0);
395 }
396
397 static constexpr ::llvm::StringLiteral getOperationName() {
398 return ::llvm::StringLiteral("cast.tofelt");
399 }
400
401 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
402 return {index, 1};
403 }
404
405 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
406 auto valueRange = getODSOperandIndexAndLength(index);
407 return {std::next(getOperation()->operand_begin(), valueRange.first),
408 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
409 }
410
411 ::mlir::TypedValue<::mlir::Type> getValue() {
412 return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(0).begin());
413 }
414
415 ::mlir::OpOperand &getValueMutable() {
416 auto range = getODSOperandIndexAndLength(0);
417 return getOperation()->getOpOperand(range.first);
418 }
419
420 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
421 return {index, 1};
422 }
423
424 ::mlir::Operation::result_range getODSResults(unsigned index) {
425 auto valueRange = getODSResultIndexAndLength(index);
426 return {std::next(getOperation()->result_begin(), valueRange.first),
427 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
428 }
429
430 ::mlir::TypedValue<::llzk::felt::FeltType> getResult() {
431 return ::llvm::cast<::mlir::TypedValue<::llzk::felt::FeltType>>(*getODSResults(0).begin());
432 }
433
434 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
435 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
436 static llvm::hash_code computePropertiesHash(const Properties &prop);
437 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
438 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
439 static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs);
440 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
441 static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state);
442 void writeProperties(::mlir::DialectBytecodeWriter &writer);
443 ::llzk::cast::OverflowSemanticsAttr getOverflowAttr() {
444 return ::llvm::dyn_cast_or_null<::llzk::cast::OverflowSemanticsAttr>(getProperties().overflow);
445 }
446
448 void setOverflowAttr(::llzk::cast::OverflowSemanticsAttr attr) {
449 getProperties().overflow = attr;
450 }
451
453 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::llzk::cast::OverflowSemanticsAttr overflow, ::mlir::Value value);
454 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llzk::cast::OverflowSemanticsAttr overflow, ::mlir::Value value);
455 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llzk::cast::OverflowSemanticsAttr overflow, ::mlir::Value value);
456 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::llzk::cast::OverflowSemantics overflow, ::mlir::Value value);
457 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llzk::cast::OverflowSemantics overflow, ::mlir::Value value);
458 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llzk::cast::OverflowSemantics overflow, ::mlir::Value value);
459 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
460 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
461 static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties);
462 ::llvm::LogicalResult verifyInvariantsImpl();
463 ::llvm::LogicalResult verifyInvariants();
464 static ::llvm::LogicalResult canonicalize(IntToFeltOp op, ::mlir::PatternRewriter &rewriter);
465 static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context);
466 static ::llvm::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes);
467 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
468 void print(::mlir::OpAsmPrinter &_odsPrinter);
469 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
470private:
471 ::mlir::StringAttr getAttributeNameForIndex(unsigned index) {
472 return getAttributeNameForIndex((*this)->getName(), index);
473 }
474
475 static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) {
476 assert(index < 1 && "invalid attribute index");
477 assert(name.getStringRef() == getOperationName() && "invalid operation name");
478 assert(name.isRegistered() && "Operation isn't registered, missing a "
479 "dependent dialect loading?");
480 return name.getAttributeNames()[index];
481 }
482
483public:
484 static bool isCompatibleReturnTypes(::mlir::TypeRange lhs, ::mlir::TypeRange rhs);
485 static ::mlir::ParseResult parseOptionalOverflowSemantics(
486 ::mlir::OpAsmParser &parser, ::llzk::cast::OverflowSemanticsAttr &overflow
487 );
488
490 ::mlir::OpAsmPrinter &printer, IntToFeltOp op,
491 ::llzk::cast::OverflowSemanticsAttr overflow
492 );
493
494 private:
495 static ::mlir::ParseResult parseInferredOrParsedType(
496 ::mlir::OpAsmParser &parser, ::mlir::Type &opType, bool isFirst
497 ) {
498 if (mlir::succeeded(isFirst ? parser.parseOptionalColon() : parser.parseOptionalComma())) {
499 // If there is a comma, parse the `opType`
500 mlir::Type type;
501 if (parser.parseCustomTypeWithFallback(type)) {
502 return mlir::failure();
503 }
504 opType = type;
505 } else {
506 // Otherwise, build the default type
507 opType =
508 ::llzk::felt::FeltType::get(parser.getBuilder().getContext());
509 }
510 return mlir::success();
511 }
512
513 static void printInferredOrParsedType(::mlir::OpAsmPrinter &printer,
514 ::mlir::Operation *op, ::mlir::Type opType, bool isFirst
515 ) {
516 printer << (isFirst ? " : " : ", ");
517 printer.printStrippedAttrOrType(opType);
518 }
519};
520} // namespace cast
521} // namespace llzk
522MLIR_DECLARE_EXPLICIT_TYPE_ID(::llzk::cast::IntToFeltOp)
523
524
525#endif // GET_OP_CLASSES
526
::llvm::LogicalResult verify(::mlir::Location loc)
Definition Ops.cpp.inc:96
FeltToIndexOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
Definition Ops.h.inc:86
FeltToIndexOpAdaptor(FeltToIndexOp op)
Definition Ops.cpp.inc:94
FeltToIndexOpGenericAdaptor(RangeT values, LateInst op)
Definition Ops.h.inc:95
FeltToIndexOpGenericAdaptor(RangeT values, const FeltToIndexOpGenericAdaptorBase &base)
Definition Ops.h.inc:92
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index)
Definition Ops.h.inc:97
FeltToIndexOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions={})
Definition Ops.h.inc:88
FeltToIndexOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs=nullptr)
Definition Ops.h.inc:90
RangeT getODSOperands(unsigned index)
Definition Ops.h.inc:101
FeltToIndexOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
Definition Ops.h.inc:86
static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties)
Definition Ops.cpp.inc:305
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
Definition Ops.cpp.inc:161
::llvm::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:337
::llzk::cast::OverflowSemantics getOverflow()
Definition Ops.cpp.inc:187
void setOverflowAttr(::llzk::cast::OverflowSemanticsAttr attr)
Definition Ops.h.inc:198
::mlir::StringAttr getOverflowAttrName(::mlir::OperationName name)
Definition Ops.h.inc:143
::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:104
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
Definition Ops.cpp.inc:154
static ::llvm::ArrayRef<::llvm::StringRef > getAttributeNames()
Definition Ops.h.inc:134
void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect > > &effects)
Definition Ops.cpp.inc:406
std::pair< unsigned, unsigned > getODSResultIndexAndLength(unsigned index)
Definition Ops.h.inc:170
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::llzk::cast::OverflowSemanticsAttr overflow, ::mlir::Value value)
Definition Ops.cpp.inc:196
static llvm::hash_code computePropertiesHash(const Properties &prop)
Definition Ops.cpp.inc:143
::mlir::OpOperand & getValueMutable()
Definition Ops.h.inc:165
::mlir::TypedValue<::llzk::felt::FeltType > getValue()
Definition Ops.h.inc:161
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index)
Definition Ops.h.inc:151
void print(::mlir::OpAsmPrinter &_odsPrinter)
Definition Ops.cpp.inc:390
::mlir::StringAttr getOverflowAttrName()
Definition Ops.h.inc:139
::llzk::cast::OverflowSemanticsAttr getOverflowAttr()
Definition Ops.h.inc:193
FoldAdaptor::Properties Properties
Definition Ops.h.inc:133
::mlir::TypedValue<::mlir::IndexType > getResult()
Definition Ops.h.inc:180
::mlir::Operation::result_range getODSResults(unsigned index)
Definition Ops.h.inc:174
void writeProperties(::mlir::DialectBytecodeWriter &writer)
Definition Ops.cpp.inc:181
FeltToIndexOpAdaptor Adaptor
Definition Ops.h.inc:129
::llvm::LogicalResult canonicalize(FeltToIndexOp op, ::mlir::PatternRewriter &rewriter)
Definition Ops.cpp:107
::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state)
Definition Ops.cpp.inc:174
FeltToIndexOpGenericAdaptor< RangeT > GenericAdaptor
Definition Ops.h.inc:131
static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context)
Definition Ops.cpp.inc:341
GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute > > FoldAdaptor
Definition Ops.h.inc:132
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
Definition Ops.cpp.inc:127
static void printOptionalOverflowSemantics(::mlir::OpAsmPrinter &printer, FeltToIndexOp op, ::llzk::cast::OverflowSemanticsAttr overflow)
Definition Ops.cpp:125
::llvm::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location > location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type > &inferredReturnTypes)
Definition Ops.cpp.inc:345
void setOverflow(::llzk::cast::OverflowSemantics attrValue)
Definition Ops.cpp.inc:192
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
Definition Ops.cpp.inc:353
::mlir::Operation::operand_range getODSOperands(unsigned index)
Definition Ops.h.inc:155
::llvm::LogicalResult verifyInvariantsImpl()
Definition Ops.cpp.inc:311
::mlir::ParseResult parseOptionalOverflowSemantics(::mlir::OpAsmParser &parser, ::llzk::cast::OverflowSemanticsAttr &overflow)
Definition Ops.cpp:119
static constexpr ::llvm::StringLiteral getOperationName()
Definition Ops.h.inc:147
::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:165
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
Definition Ops.cpp.inc:148
::llvm::LogicalResult verify(::mlir::Location loc)
Definition Ops.cpp.inc:436
IntToFeltOpAdaptor(IntToFeltOp op)
Definition Ops.cpp.inc:434
IntToFeltOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
Definition Ops.h.inc:336
IntToFeltOpGenericAdaptor(RangeT values, LateInst op)
Definition Ops.h.inc:345
IntToFeltOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions={})
Definition Ops.h.inc:338
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index)
Definition Ops.h.inc:347
IntToFeltOpGenericAdaptor(RangeT values, const IntToFeltOpGenericAdaptorBase &base)
Definition Ops.h.inc:342
IntToFeltOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
Definition Ops.h.inc:336
IntToFeltOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs=nullptr)
Definition Ops.h.inc:340
RangeT getODSOperands(unsigned index)
Definition Ops.h.inc:351
::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:505
GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute > > FoldAdaptor
Definition Ops.h.inc:382
static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties)
Definition Ops.cpp.inc:645
void print(::mlir::OpAsmPrinter &_odsPrinter)
Definition Ops.cpp.inc:740
void setOverflow(::llzk::cast::OverflowSemantics attrValue)
Definition Ops.cpp.inc:532
::mlir::StringAttr getOverflowAttrName(::mlir::OperationName name)
Definition Ops.h.inc:393
::llvm::LogicalResult verifyInvariantsImpl()
Definition Ops.cpp.inc:651
::llzk::cast::OverflowSemanticsAttr getOverflowAttr()
Definition Ops.h.inc:443
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
Definition Ops.cpp.inc:501
static constexpr ::llvm::StringLiteral getOperationName()
Definition Ops.h.inc:397
::mlir::StringAttr getOverflowAttrName()
Definition Ops.h.inc:389
::llvm::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location > location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type > &inferredReturnTypes)
Definition Ops.cpp.inc:685
void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect > > &effects)
Definition Ops.cpp.inc:765
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index)
Definition Ops.h.inc:401
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::llzk::cast::OverflowSemanticsAttr overflow, ::mlir::Value value)
Definition Ops.cpp.inc:536
void setOverflowAttr(::llzk::cast::OverflowSemanticsAttr attr)
Definition Ops.h.inc:448
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
Definition Ops.cpp.inc:467
::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:444
static ::llvm::ArrayRef<::llvm::StringRef > getAttributeNames()
Definition Ops.h.inc:384
std::pair< unsigned, unsigned > getODSResultIndexAndLength(unsigned index)
Definition Ops.h.inc:420
static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context)
Definition Ops.cpp.inc:681
static llvm::hash_code computePropertiesHash(const Properties &prop)
Definition Ops.cpp.inc:483
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
Definition Ops.cpp.inc:488
FoldAdaptor::Properties Properties
Definition Ops.h.inc:383
IntToFeltOpAdaptor Adaptor
Definition Ops.h.inc:379
static void printOptionalOverflowSemantics(::mlir::OpAsmPrinter &printer, IntToFeltOp op, ::llzk::cast::OverflowSemanticsAttr overflow)
Definition Ops.cpp:101
::mlir::Operation::operand_range getODSOperands(unsigned index)
Definition Ops.h.inc:405
::mlir::ParseResult parseOptionalOverflowSemantics(::mlir::OpAsmParser &parser, ::llzk::cast::OverflowSemanticsAttr &overflow)
Definition Ops.cpp:97
::mlir::TypedValue<::llzk::felt::FeltType > getResult()
Definition Ops.h.inc:430
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
Definition Ops.cpp.inc:693
::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state)
Definition Ops.cpp.inc:514
IntToFeltOpGenericAdaptor< RangeT > GenericAdaptor
Definition Ops.h.inc:381
::llzk::cast::OverflowSemantics getOverflow()
Definition Ops.cpp.inc:527
static bool isCompatibleReturnTypes(::mlir::TypeRange lhs, ::mlir::TypeRange rhs)
Definition Ops.cpp:58
void writeProperties(::mlir::DialectBytecodeWriter &writer)
Definition Ops.cpp.inc:521
::mlir::Operation::result_range getODSResults(unsigned index)
Definition Ops.h.inc:424
::llvm::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:677
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
Definition Ops.cpp.inc:494
::llvm::LogicalResult canonicalize(IntToFeltOp op, ::mlir::PatternRewriter &rewriter)
Definition Ops.cpp:81
::mlir::TypedValue<::mlir::Type > getValue()
Definition Ops.h.inc:411
::mlir::OpOperand & getValueMutable()
Definition Ops.h.inc:415
FeltToIndexOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
Definition Ops.h.inc:59
::std::optional<::mlir::OperationName > odsOpName
Definition Ops.h.inc:55
::llzk::cast::OverflowSemanticsAttr getOverflowAttr()
Definition Ops.cpp.inc:83
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize)
Definition Ops.h.inc:65
::llzk::cast::OverflowSemantics getOverflow()
Definition Ops.cpp.inc:88
::std::optional<::mlir::OperationName > odsOpName
Definition Ops.h.inc:305
::llzk::cast::OverflowSemantics getOverflow()
Definition Ops.cpp.inc:428
::llzk::cast::OverflowSemanticsAttr getOverflowAttr()
Definition Ops.cpp.inc:423
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize)
Definition Ops.h.inc:315
IntToFeltOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
Definition Ops.h.inc:309
static FeltType get(::mlir::MLIRContext *context, ::mlir::StringAttr fieldName)
Definition Types.cpp.inc:67
void setOverflow(const ::llzk::cast::OverflowSemanticsAttr &propValue)
Definition Ops.h.inc:41
void setOverflow(const ::llzk::cast::OverflowSemanticsAttr &propValue)
Definition Ops.h.inc:291