LLZK 3.0.0
An open-source IR for Zero Knowledge (ZK) circuits
Loading...
Searching...
No Matches
Ops.cpp.inc
Go to the documentation of this file.
1/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
2|* *|
3|* Op Definitions *|
4|* *|
5|* Automatically generated file, do not edit! *|
6|* From: Ops.td *|
7|* *|
8\*===----------------------------------------------------------------------===*/
9
10#ifdef GET_OP_LIST
11#undef GET_OP_LIST
12
15#endif // GET_OP_LIST
16
17#ifdef GET_OP_CLASSES
18#undef GET_OP_CLASSES
19
20
21//===----------------------------------------------------------------------===//
22// Local Utility Method Definitions
23//===----------------------------------------------------------------------===//
24
25
26static ::llvm::LogicalResult __mlir_ods_local_type_constraint_Ops1(
27 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
28 unsigned valueIndex) {
29 if (!((::llvm::isa<::llzk::array::ArrayType>(type)))) {
30 return op->emitOpError(valueKind) << " #" << valueIndex
31 << " must be n-dimensional array, but got " << type;
32 }
33 return ::mlir::success();
34}
35
36static ::llvm::LogicalResult __mlir_ods_local_type_constraint_Ops2(
37 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
38 unsigned valueIndex) {
39 if (!((::llzk::isValidType(type)))) {
40 return op->emitOpError(valueKind) << " #" << valueIndex
41 << " must be a valid LLZK type, but got " << type;
42 }
43 return ::mlir::success();
44}
45
46static ::llvm::LogicalResult __mlir_ods_local_type_constraint_Ops3(
47 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
48 unsigned valueIndex) {
49 if (!((::llzk::isValidEmitEqType(type)))) {
50 return op->emitOpError(valueKind) << " #" << valueIndex
51 << " must be any LLZK type, excluding struct and string types, but got " << type;
52 }
53 return ::mlir::success();
54}
55namespace llzk::constrain {
56
57
58//===----------------------------------------------------------------------===//
59// ::llzk::constrain::EmitContainmentOp definitions
60//===----------------------------------------------------------------------===//
61
62namespace detail {
63
65
66
67} // namespace detail
69
70::llvm::LogicalResult EmitContainmentOpAdaptor::verify(::mlir::Location loc) {
71 return ::mlir::success();
72}
73
74::llvm::LogicalResult EmitContainmentOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
75 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
76 if (!dict) {
77 emitError() << "expected DictionaryAttr to set properties";
78 return ::mlir::failure();
79 }
80 return ::mlir::success();
81}
82
83::mlir::Attribute EmitContainmentOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
84 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
85 ::mlir::Builder odsBuilder{ctx};
86
87 if (!attrs.empty())
88 return odsBuilder.getDictionaryAttr(attrs);
89 return {};
90}
91
93 using llvm::hash_value;
94 return llvm::hash_combine();
95}
96
97std::optional<mlir::Attribute> EmitContainmentOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
98 return std::nullopt;
99}
100
101void EmitContainmentOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
102}
103
104void EmitContainmentOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
105}
106
107::llvm::LogicalResult EmitContainmentOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
108 return ::mlir::success();
109}
110
111void EmitContainmentOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) {
112 odsState.addOperands(lhs);
113 odsState.addOperands(rhs);
114}
115
116EmitContainmentOp EmitContainmentOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs) {
117 ::mlir::OperationState __state__(location, getOperationName());
118 build(builder, __state__, std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
119 auto __res__ = ::llvm::dyn_cast<EmitContainmentOp>(builder.create(__state__));
120 assert(__res__ && "builder didn't return the right type");
121 return __res__;
122}
123
124EmitContainmentOp EmitContainmentOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs) {
125 return create(builder, builder.getLoc(), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
126}
127
128void EmitContainmentOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
129 odsState.addOperands(lhs);
130 odsState.addOperands(rhs);
131 assert(resultTypes.size() == 0u && "mismatched number of results");
132 odsState.addTypes(resultTypes);
133}
134
135EmitContainmentOp EmitContainmentOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
136 ::mlir::OperationState __state__(location, getOperationName());
137 build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
138 auto __res__ = ::llvm::dyn_cast<EmitContainmentOp>(builder.create(__state__));
139 assert(__res__ && "builder didn't return the right type");
140 return __res__;
141}
142
143EmitContainmentOp EmitContainmentOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
144 return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
145}
146
147void EmitContainmentOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
148 assert(operands.size() == 2u && "mismatched number of parameters");
149 odsState.addOperands(operands);
150 odsState.addAttributes(attributes);
151 assert(resultTypes.size() == 0u && "mismatched number of return types");
152 odsState.addTypes(resultTypes);
153}
154
155EmitContainmentOp EmitContainmentOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
156 ::mlir::OperationState __state__(location, getOperationName());
157 build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
158 auto __res__ = ::llvm::dyn_cast<EmitContainmentOp>(builder.create(__state__));
159 assert(__res__ && "builder didn't return the right type");
160 return __res__;
161}
162
163EmitContainmentOp EmitContainmentOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
164 return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
165}
166
167void EmitContainmentOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
168 assert(operands.size() == 2u && "mismatched number of parameters");
169 odsState.addOperands(operands);
170 odsState.useProperties(const_cast<Properties&>(properties));
171 odsState.addAttributes(discardableAttributes);
172 assert(resultTypes.size() == 0u && "mismatched number of return types");
173 odsState.addTypes(resultTypes);
174}
175
176EmitContainmentOp EmitContainmentOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
177 ::mlir::OperationState __state__(location, getOperationName());
178 build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
179 auto __res__ = ::llvm::dyn_cast<EmitContainmentOp>(builder.create(__state__));
180 assert(__res__ && "builder didn't return the right type");
181 return __res__;
182}
183
184EmitContainmentOp EmitContainmentOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
185 return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
186}
187
189 {
190 unsigned index = 0; (void)index;
191 auto valueGroup0 = getODSOperands(0);
192
193 for (auto v : valueGroup0) {
194 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*this, v.getType(), "operand", index++)))
195 return ::mlir::failure();
196 }
197 auto valueGroup1 = getODSOperands(1);
198
199 for (auto v : valueGroup1) {
200 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops2(*this, v.getType(), "operand", index++)))
201 return ::mlir::failure();
202 }
203 }
204 return ::mlir::success();
205}
206
207::llvm::LogicalResult EmitContainmentOp::verifyInvariants() {
208 if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
209 return ::mlir::success();
210 return ::mlir::failure();
211}
212
213::mlir::ParseResult EmitContainmentOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
214 ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperand{};
215 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(&lhsRawOperand, 1); ::llvm::SMLoc lhsOperandsLoc;
216 (void)lhsOperandsLoc;
217 ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperand{};
218 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(&rhsRawOperand, 1); ::llvm::SMLoc rhsOperandsLoc;
219 (void)rhsOperandsLoc;
220 ::mlir::Type lhsRawType{};
221 ::llvm::ArrayRef<::mlir::Type> lhsTypes(&lhsRawType, 1);
222 ::mlir::Type rhsRawType{};
223 ::llvm::ArrayRef<::mlir::Type> rhsTypes(&rhsRawType, 1);
224
225 lhsOperandsLoc = parser.getCurrentLocation();
226 if (parser.parseOperand(lhsRawOperand))
227 return ::mlir::failure();
228 if (parser.parseComma())
229 return ::mlir::failure();
230
231 rhsOperandsLoc = parser.getCurrentLocation();
232 if (parser.parseOperand(rhsRawOperand))
233 return ::mlir::failure();
234 if (parser.parseColon())
235 return ::mlir::failure();
236
237 {
239 if (parser.parseCustomTypeWithFallback(type))
240 return ::mlir::failure();
241 lhsRawType = type;
242 }
243 if (parser.parseComma())
244 return ::mlir::failure();
245
246 {
247 ::mlir::Type type;
248 if (parser.parseCustomTypeWithFallback(type))
249 return ::mlir::failure();
250 rhsRawType = type;
251 }
252 {
253 auto loc = parser.getCurrentLocation();(void)loc;
254 if (parser.parseOptionalAttrDict(result.attributes))
255 return ::mlir::failure();
256 if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
257 return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
258 })))
259 return ::mlir::failure();
260 }
261 if (parser.resolveOperands(lhsOperands, lhsTypes, lhsOperandsLoc, result.operands))
262 return ::mlir::failure();
263 if (parser.resolveOperands(rhsOperands, rhsTypes, rhsOperandsLoc, result.operands))
264 return ::mlir::failure();
265 return ::mlir::success();
266}
267
268void EmitContainmentOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
269 _odsPrinter << ' ';
270 _odsPrinter << getLhs();
271 _odsPrinter << ",";
272 _odsPrinter << ' ';
273 _odsPrinter << getRhs();
274 _odsPrinter << ' ' << ":";
275 _odsPrinter << ' ';
276 {
277 auto type = getLhs().getType();
278 if (auto validType = ::llvm::dyn_cast<::llzk::array::ArrayType>(type))
279 _odsPrinter.printStrippedAttrOrType(validType);
280 else
281 _odsPrinter << type;
282 }
283 _odsPrinter << ",";
284 _odsPrinter << ' ';
285 {
286 auto type = getRhs().getType();
287 if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
288 _odsPrinter.printStrippedAttrOrType(validType);
289 else
290 _odsPrinter << type;
291 }
292 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
293 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
294}
295
296
297} // namespace llzk::constrain
298MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::constrain::EmitContainmentOp)
299
300namespace llzk::constrain {
301
302
303//===----------------------------------------------------------------------===//
304// ::llzk::constrain::EmitEqualityOp definitions
305//===----------------------------------------------------------------------===//
306
307namespace detail {
308
310
311
312} // namespace detail
314
315::llvm::LogicalResult EmitEqualityOpAdaptor::verify(::mlir::Location loc) {
316 return ::mlir::success();
317}
318
319::llvm::LogicalResult EmitEqualityOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
320 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
321 if (!dict) {
322 emitError() << "expected DictionaryAttr to set properties";
323 return ::mlir::failure();
324 }
325 return ::mlir::success();
326}
327
328::mlir::Attribute EmitEqualityOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
329 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
330 ::mlir::Builder odsBuilder{ctx};
331
332 if (!attrs.empty())
333 return odsBuilder.getDictionaryAttr(attrs);
334 return {};
335}
336
338 using llvm::hash_value;
339 return llvm::hash_combine();
340}
341
342std::optional<mlir::Attribute> EmitEqualityOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
343 return std::nullopt;
344}
345
346void EmitEqualityOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
347}
348
349void EmitEqualityOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
350}
351
352::llvm::LogicalResult EmitEqualityOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
353 return ::mlir::success();
354}
355
356void EmitEqualityOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) {
357 odsState.addOperands(lhs);
358 odsState.addOperands(rhs);
359}
360
361EmitEqualityOp EmitEqualityOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs) {
362 ::mlir::OperationState __state__(location, getOperationName());
363 build(builder, __state__, std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
364 auto __res__ = ::llvm::dyn_cast<EmitEqualityOp>(builder.create(__state__));
365 assert(__res__ && "builder didn't return the right type");
366 return __res__;
367}
368
369EmitEqualityOp EmitEqualityOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value lhs, ::mlir::Value rhs) {
370 return create(builder, builder.getLoc(), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
371}
372
373void EmitEqualityOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
374 odsState.addOperands(lhs);
375 odsState.addOperands(rhs);
376 assert(resultTypes.size() == 0u && "mismatched number of results");
377 odsState.addTypes(resultTypes);
378}
379
380EmitEqualityOp EmitEqualityOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
381 ::mlir::OperationState __state__(location, getOperationName());
382 build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
383 auto __res__ = ::llvm::dyn_cast<EmitEqualityOp>(builder.create(__state__));
384 assert(__res__ && "builder didn't return the right type");
385 return __res__;
386}
387
388EmitEqualityOp EmitEqualityOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
389 return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(lhs)>(lhs), std::forward<decltype(rhs)>(rhs));
390}
391
392void EmitEqualityOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
393 assert(operands.size() == 2u && "mismatched number of parameters");
394 odsState.addOperands(operands);
395 odsState.addAttributes(attributes);
396 assert(resultTypes.size() == 0u && "mismatched number of return types");
397 odsState.addTypes(resultTypes);
398}
399
400EmitEqualityOp EmitEqualityOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
401 ::mlir::OperationState __state__(location, getOperationName());
402 build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
403 auto __res__ = ::llvm::dyn_cast<EmitEqualityOp>(builder.create(__state__));
404 assert(__res__ && "builder didn't return the right type");
405 return __res__;
406}
407
408EmitEqualityOp EmitEqualityOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
409 return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(attributes)>(attributes));
410}
411
412void EmitEqualityOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
413 assert(operands.size() == 2u && "mismatched number of parameters");
414 odsState.addOperands(operands);
415 odsState.useProperties(const_cast<Properties&>(properties));
416 odsState.addAttributes(discardableAttributes);
417 assert(resultTypes.size() == 0u && "mismatched number of return types");
418 odsState.addTypes(resultTypes);
419}
420
421EmitEqualityOp EmitEqualityOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
422 ::mlir::OperationState __state__(location, getOperationName());
423 build(builder, __state__, std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
424 auto __res__ = ::llvm::dyn_cast<EmitEqualityOp>(builder.create(__state__));
425 assert(__res__ && "builder didn't return the right type");
426 return __res__;
427}
428
429EmitEqualityOp EmitEqualityOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
430 return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(operands)>(operands), std::forward<decltype(properties)>(properties), std::forward<decltype(discardableAttributes)>(discardableAttributes));
431}
432
434 {
435 unsigned index = 0; (void)index;
436 auto valueGroup0 = getODSOperands(0);
437
438 for (auto v : valueGroup0) {
439 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops3(*this, v.getType(), "operand", index++)))
440 return ::mlir::failure();
441 }
442 auto valueGroup1 = getODSOperands(1);
443
444 for (auto v : valueGroup1) {
445 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops3(*this, v.getType(), "operand", index++)))
446 return ::mlir::failure();
447 }
448 }
449 if (!((::llzk::typesUnify((*this->getODSOperands(0).begin()).getType(), (*this->getODSOperands(1).begin()).getType()))))
450 return emitOpError("failed to verify that rhs type matches with lhs type");
451 return ::mlir::success();
452}
453
454::llvm::LogicalResult EmitEqualityOp::verifyInvariants() {
455 return verifyInvariantsImpl();
456}
457
458::mlir::ParseResult EmitEqualityOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
459 ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperand{};
460 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(&lhsRawOperand, 1); ::llvm::SMLoc lhsOperandsLoc;
461 (void)lhsOperandsLoc;
462 ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperand{};
463 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(&rhsRawOperand, 1); ::llvm::SMLoc rhsOperandsLoc;
464 (void)rhsOperandsLoc;
465 ::mlir::Type lhsRawType{};
466 ::llvm::ArrayRef<::mlir::Type> lhsTypes(&lhsRawType, 1);
467 ::mlir::Type rhsRawType{};
468 ::llvm::ArrayRef<::mlir::Type> rhsTypes(&rhsRawType, 1);
469
470 lhsOperandsLoc = parser.getCurrentLocation();
471 if (parser.parseOperand(lhsRawOperand))
472 return ::mlir::failure();
473 if (parser.parseComma())
474 return ::mlir::failure();
475
476 rhsOperandsLoc = parser.getCurrentLocation();
477 if (parser.parseOperand(rhsRawOperand))
478 return ::mlir::failure();
479 if (parser.parseColon())
480 return ::mlir::failure();
481
482 {
483 ::mlir::Type type;
484 if (parser.parseCustomTypeWithFallback(type))
485 return ::mlir::failure();
486 lhsRawType = type;
487 }
488 {
489 auto odsResult = parseInferredOrParsedType(parser, rhsRawType, lhsRawType);
490 if (odsResult) return ::mlir::failure();
491 }
492 {
493 auto loc = parser.getCurrentLocation();(void)loc;
494 if (parser.parseOptionalAttrDict(result.attributes))
495 return ::mlir::failure();
496 if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
497 return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
498 })))
499 return ::mlir::failure();
500 }
501 if (parser.resolveOperands(lhsOperands, lhsTypes, lhsOperandsLoc, result.operands))
502 return ::mlir::failure();
503 if (parser.resolveOperands(rhsOperands, rhsTypes, rhsOperandsLoc, result.operands))
504 return ::mlir::failure();
505 return ::mlir::success();
506}
507
508void EmitEqualityOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
509 _odsPrinter << ' ';
510 _odsPrinter << getLhs();
511 _odsPrinter << ",";
512 _odsPrinter << ' ';
513 _odsPrinter << getRhs();
514 _odsPrinter << ' ' << ":";
515 _odsPrinter << ' ';
516 {
517 auto type = getLhs().getType();
518 if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
519 _odsPrinter.printStrippedAttrOrType(validType);
520 else
521 _odsPrinter << type;
522 }
523 printInferredOrParsedType(_odsPrinter, *this, getRhs().getType(), getLhs().getType());
524 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
525 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
526}
527
528
529} // namespace llzk::constrain
530MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::constrain::EmitEqualityOp)
531
532
533#endif // GET_OP_CLASSES
534
EmitContainmentOpAdaptor(EmitContainmentOp op)
Definition Ops.cpp.inc:68
EmitContainmentOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
Definition Ops.h.inc:76
::llvm::LogicalResult verify(::mlir::Location loc)
Definition Ops.cpp.inc:70
static EmitContainmentOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs)
Definition Ops.cpp.inc:116
::llvm::LogicalResult verifyInvariantsImpl()
Definition Ops.cpp.inc:188
::llvm::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:207
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs)
Definition Ops.cpp.inc:111
::llvm::LogicalResult verify()
Definition Ops.cpp:51
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
Definition Ops.cpp.inc:83
::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:74
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
Definition Ops.cpp.inc:97
static constexpr ::llvm::StringLiteral getOperationName()
Definition Ops.h.inc:134
::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:107
::mlir::TypedValue<::mlir::Type > getRhs()
Definition Ops.h.inc:152
FoldAdaptor::Properties Properties
Definition Ops.h.inc:129
::mlir::Operation::operand_range getODSOperands(unsigned index)
Definition Ops.h.inc:142
static llvm::hash_code computePropertiesHash(const Properties &prop)
Definition Ops.cpp.inc:92
void print(::mlir::OpAsmPrinter &_odsPrinter)
Definition Ops.cpp.inc:268
::mlir::TypedValue<::llzk::array::ArrayType > getLhs()
Definition Ops.h.inc:148
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
Definition Ops.cpp.inc:213
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
Definition Ops.cpp.inc:101
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
Definition Ops.cpp.inc:104
EmitEqualityOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
Definition Ops.h.inc:253
::llvm::LogicalResult verify(::mlir::Location loc)
Definition Ops.cpp.inc:315
EmitEqualityOpAdaptor(EmitEqualityOp op)
Definition Ops.cpp.inc:313
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
Definition Ops.cpp.inc:349
static constexpr ::llvm::StringLiteral getOperationName()
Definition Ops.h.inc:311
FoldAdaptor::Properties Properties
Definition Ops.h.inc:306
::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:319
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
Definition Ops.cpp.inc:342
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
Definition Ops.cpp.inc:328
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
Definition Ops.cpp.inc:458
static llvm::hash_code computePropertiesHash(const Properties &prop)
Definition Ops.cpp.inc:337
::mlir::TypedValue<::mlir::Type > getLhs()
Definition Ops.h.inc:325
::mlir::Operation::operand_range getODSOperands(unsigned index)
Definition Ops.h.inc:319
void print(::mlir::OpAsmPrinter &_odsPrinter)
Definition Ops.cpp.inc:508
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
Definition Ops.cpp.inc:346
::llvm::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:454
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs)
Definition Ops.cpp.inc:356
::llvm::LogicalResult verifyInvariantsImpl()
Definition Ops.cpp.inc:433
static EmitEqualityOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs)
Definition Ops.cpp.inc:361
::mlir::TypedValue<::mlir::Type > getRhs()
Definition Ops.h.inc:329
::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:352
::std::optional<::mlir::OperationName > odsOpName
Definition Ops.h.inc:44
EmitContainmentOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
Definition Ops.h.inc:48
::std::optional<::mlir::OperationName > odsOpName
Definition Ops.h.inc:221
EmitEqualityOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
Definition Ops.h.inc:225
Common interface for operations that produce a constraint.
Common interface for constant parameter-like symbol operations that can be defined within a TemplateO...
bool isValidEmitEqType(Type type)
bool isValidType(Type type)
bool typesUnify(Type lhs, Type rhs, ArrayRef< StringRef > rhsReversePrefix, UnificationMap *unifications)