LLZK 2.1.1
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
20#endif // GET_OP_LIST
21
22#ifdef GET_OP_CLASSES
23#undef GET_OP_CLASSES
24
25
26//===----------------------------------------------------------------------===//
27// Local Utility Method Definitions
28//===----------------------------------------------------------------------===//
29
30namespace llzk {
31namespace verif {
32
33static ::llvm::LogicalResult __mlir_ods_local_type_constraint_Ops1(
34 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
35 unsigned valueIndex) {
36 if (!((type.isSignlessInteger(1)))) {
37 return op->emitOpError(valueKind) << " #" << valueIndex
38 << " must be 1-bit signless integer, but got " << type;
39 }
40 return ::mlir::success();
41}
42
43static ::llvm::LogicalResult __mlir_ods_local_type_constraint_Ops2(
44 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
45 unsigned valueIndex) {
46 if (!((::llzk::isValidType(type)))) {
47 return op->emitOpError(valueKind) << " #" << valueIndex
48 << " must be variadic of a valid LLZK type, but got " << type;
49 }
50 return ::mlir::success();
51}
52
53static ::llvm::LogicalResult __mlir_ods_local_type_constraint_Ops3(
54 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
55 unsigned valueIndex) {
56 if (!((::llvm::isa<::mlir::IndexType>(type)))) {
57 return op->emitOpError(valueKind) << " #" << valueIndex
58 << " must be variadic of index, but got " << type;
59 }
60 return ::mlir::success();
61}
62
63static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops1(
64 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
65 if (attr && !((::llvm::isa<::mlir::StringAttr>(attr))))
66 return emitError() << "attribute '" << attrName
67 << "' failed to satisfy constraint: string attribute";
68 return ::mlir::success();
69}
70static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops1(
71 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
72 return __mlir_ods_local_attr_constraint_Ops1(attr, attrName, [op]() {
73 return op->emitOpError();
74 });
75}
76
77static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops2(
78 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
79 if (attr && !((::llvm::isa<::mlir::SymbolRefAttr>(attr))))
80 return emitError() << "attribute '" << attrName
81 << "' failed to satisfy constraint: symbol reference attribute";
82 return ::mlir::success();
83}
84static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops2(
85 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
86 return __mlir_ods_local_attr_constraint_Ops2(attr, attrName, [op]() {
87 return op->emitOpError();
88 });
89}
90
91static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops3(
92 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
93 if (attr && !(((::llvm::isa<::mlir::TypeAttr>(attr))) && ((::llvm::isa<::mlir::FunctionType>(::llvm::cast<::mlir::TypeAttr>(attr).getValue()))) && ((::llvm::isa<::mlir::FunctionType>(::llvm::cast<::mlir::TypeAttr>(attr).getValue())))))
94 return emitError() << "attribute '" << attrName
95 << "' failed to satisfy constraint: type attribute of function type";
96 return ::mlir::success();
97}
98static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops3(
99 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
100 return __mlir_ods_local_attr_constraint_Ops3(attr, attrName, [op]() {
101 return op->emitOpError();
102 });
103}
104
105static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops4(
106 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
107 if (attr && !(((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::DictionaryAttr>(attr))); }))))
108 return emitError() << "attribute '" << attrName
109 << "' failed to satisfy constraint: Array of dictionary attributes";
110 return ::mlir::success();
111}
112static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops4(
113 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
114 return __mlir_ods_local_attr_constraint_Ops4(attr, attrName, [op]() {
115 return op->emitOpError();
116 });
117}
118
119static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops5(
120 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
121 if (attr && !((::llvm::isa<::mlir::ArrayAttr>(attr))))
122 return emitError() << "attribute '" << attrName
123 << "' failed to satisfy constraint: array attribute";
124 return ::mlir::success();
125}
126static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops5(
127 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
128 return __mlir_ods_local_attr_constraint_Ops5(attr, attrName, [op]() {
129 return op->emitOpError();
130 });
131}
132
133static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops6(
134 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
135 if (attr && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(attr))))
136 return emitError() << "attribute '" << attrName
137 << "' failed to satisfy constraint: i32 dense array attribute";
138 return ::mlir::success();
139}
140static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops6(
141 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
142 return __mlir_ods_local_attr_constraint_Ops6(attr, attrName, [op]() {
143 return op->emitOpError();
144 });
145}
146
147static ::llvm::LogicalResult __mlir_ods_local_region_constraint_Ops1(
148 ::mlir::Operation *op, ::mlir::Region &region, ::llvm::StringRef regionName,
149 unsigned regionIndex) {
150 if (!((true))) {
151 return op->emitOpError("region #") << regionIndex
152 << (regionName.empty() ? " " : " ('" + regionName + "') ")
153 << "failed to verify constraint: any region";
154 }
155 return ::mlir::success();
156}
157} // namespace verif
158} // namespace llzk
159namespace llzk {
160namespace verif {
161
162//===----------------------------------------------------------------------===//
163// ::llzk::verif::ContractEndOp definitions
164//===----------------------------------------------------------------------===//
165
166namespace detail {
167} // namespace detail
169
170::llvm::LogicalResult ContractEndOpAdaptor::verify(::mlir::Location loc) {
171 return ::mlir::success();
172}
173
174void ContractEndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) {
175}
176
177void ContractEndOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) {
178 assert(resultTypes.size() == 0u && "mismatched number of results");
179 odsState.addTypes(resultTypes);
180}
181
182void ContractEndOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
183 assert(operands.size() == 0u && "mismatched number of parameters");
184 odsState.addOperands(operands);
185 odsState.addAttributes(attributes);
186 assert(resultTypes.size() == 0u && "mismatched number of return types");
187 odsState.addTypes(resultTypes);
188}
189
190::llvm::LogicalResult ContractEndOp::verifyInvariantsImpl() {
191 return ::mlir::success();
192}
193
194::llvm::LogicalResult ContractEndOp::verifyInvariants() {
195 return verifyInvariantsImpl();
196}
197
198::mlir::ParseResult ContractEndOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
199 {
200 auto loc = parser.getCurrentLocation();(void)loc;
201 if (parser.parseOptionalAttrDict(result.attributes))
202 return ::mlir::failure();
203 }
204 return ::mlir::success();
205}
206
207void ContractEndOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
208 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
209 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
210}
211
212void ContractEndOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
213}
214
215} // namespace verif
216} // namespace llzk
217MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::verif::ContractEndOp)
218
219namespace llzk {
220namespace verif {
221
222//===----------------------------------------------------------------------===//
223// ::llzk::verif::ContractOp definitions
224//===----------------------------------------------------------------------===//
225
226namespace detail {
228
230 auto attr = getSymNameAttr();
231 return attr.getValue();
232}
233
235 auto attr = getTargetAttr();
236 return attr;
237}
238
240 auto attr = getFunctionTypeAttr();
241 return ::llvm::cast<::mlir::FunctionType>(attr.getValue());
242}
243
244::std::optional< ::mlir::ArrayAttr > ContractOpGenericAdaptorBase::getArgAttrs() {
245 auto attr = getArgAttrsAttr();
246 return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
247}
248
249} // namespace detail
251
252::llvm::LogicalResult ContractOpAdaptor::verify(::mlir::Location loc) {
253 auto tblgen_arg_attrs = getProperties().arg_attrs; (void)tblgen_arg_attrs;
254 auto tblgen_function_type = getProperties().function_type; (void)tblgen_function_type;
255 if (!tblgen_function_type) return emitError(loc, "'verif.contract' op ""requires attribute 'function_type'");
256 auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
257 if (!tblgen_sym_name) return emitError(loc, "'verif.contract' op ""requires attribute 'sym_name'");
258 auto tblgen_target = getProperties().target; (void)tblgen_target;
259 if (!tblgen_target) return emitError(loc, "'verif.contract' op ""requires attribute 'target'");
260
261 if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name))))
262 return emitError(loc, "'verif.contract' op ""attribute 'sym_name' failed to satisfy constraint: string attribute");
263
264 if (tblgen_target && !((::llvm::isa<::mlir::SymbolRefAttr>(tblgen_target))))
265 return emitError(loc, "'verif.contract' op ""attribute 'target' failed to satisfy constraint: symbol reference attribute");
266
267 if (tblgen_function_type && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_function_type))) && ((::llvm::isa<::mlir::FunctionType>(::llvm::cast<::mlir::TypeAttr>(tblgen_function_type).getValue()))) && ((::llvm::isa<::mlir::FunctionType>(::llvm::cast<::mlir::TypeAttr>(tblgen_function_type).getValue())))))
268 return emitError(loc, "'verif.contract' op ""attribute 'function_type' failed to satisfy constraint: type attribute of function type");
269
270 if (tblgen_arg_attrs && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_arg_attrs))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_arg_attrs), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::DictionaryAttr>(attr))); }))))
271 return emitError(loc, "'verif.contract' op ""attribute 'arg_attrs' failed to satisfy constraint: Array of dictionary attributes");
272 return ::mlir::success();
273}
274
275::llvm::LogicalResult ContractOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
276 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
277 if (!dict) {
278 emitError() << "expected DictionaryAttr to set properties";
279 return ::mlir::failure();
280 }
281
282 {
283 auto &propStorage = prop.arg_attrs;
284 auto attr = dict.get("arg_attrs");
285 if (attr) {
286 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
287 if (convertedAttr) {
288 propStorage = convertedAttr;
289 } else {
290 emitError() << "Invalid attribute `arg_attrs` in property conversion: " << attr;
291 return ::mlir::failure();
292 }
293 }
294 }
295
296 {
297 auto &propStorage = prop.function_type;
298 auto attr = dict.get("function_type");
299 if (attr) {
300 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
301 if (convertedAttr) {
302 propStorage = convertedAttr;
303 } else {
304 emitError() << "Invalid attribute `function_type` in property conversion: " << attr;
305 return ::mlir::failure();
306 }
307 }
308 }
309
310 {
311 auto &propStorage = prop.sym_name;
312 auto attr = dict.get("sym_name");
313 if (attr) {
314 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
315 if (convertedAttr) {
316 propStorage = convertedAttr;
317 } else {
318 emitError() << "Invalid attribute `sym_name` in property conversion: " << attr;
319 return ::mlir::failure();
320 }
321 }
322 }
323
324 {
325 auto &propStorage = prop.target;
326 auto attr = dict.get("target");
327 if (attr) {
328 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
329 if (convertedAttr) {
330 propStorage = convertedAttr;
331 } else {
332 emitError() << "Invalid attribute `target` in property conversion: " << attr;
333 return ::mlir::failure();
334 }
335 }
336 }
337 return ::mlir::success();
338}
339
340::mlir::Attribute ContractOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
341 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
342 ::mlir::Builder odsBuilder{ctx};
343
344 {
345 const auto &propStorage = prop.arg_attrs;
346 if (propStorage)
347 attrs.push_back(odsBuilder.getNamedAttr("arg_attrs",
348 propStorage));
349 }
350
351 {
352 const auto &propStorage = prop.function_type;
353 if (propStorage)
354 attrs.push_back(odsBuilder.getNamedAttr("function_type",
355 propStorage));
356 }
357
358 {
359 const auto &propStorage = prop.sym_name;
360 if (propStorage)
361 attrs.push_back(odsBuilder.getNamedAttr("sym_name",
362 propStorage));
363 }
364
365 {
366 const auto &propStorage = prop.target;
367 if (propStorage)
368 attrs.push_back(odsBuilder.getNamedAttr("target",
369 propStorage));
370 }
371
372 if (!attrs.empty())
373 return odsBuilder.getDictionaryAttr(attrs);
374 return {};
375}
376
377llvm::hash_code ContractOp::computePropertiesHash(const Properties &prop) {
378 return llvm::hash_combine(
379 llvm::hash_value(prop.arg_attrs.getAsOpaquePointer()),
380 llvm::hash_value(prop.function_type.getAsOpaquePointer()),
381 llvm::hash_value(prop.sym_name.getAsOpaquePointer()),
382 llvm::hash_value(prop.target.getAsOpaquePointer()));
383}
384
385std::optional<mlir::Attribute> ContractOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
386 if (name == "arg_attrs")
387 return prop.arg_attrs;
388
389 if (name == "function_type")
390 return prop.function_type;
391
392 if (name == "sym_name")
393 return prop.sym_name;
394
395 if (name == "target")
396 return prop.target;
397 return std::nullopt;
398}
399
400void ContractOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
401 if (name == "arg_attrs") {
402 prop.arg_attrs = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.arg_attrs)>>(value);
403 return;
404 }
405
406 if (name == "function_type") {
407 prop.function_type = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.function_type)>>(value);
408 return;
409 }
410
411 if (name == "sym_name") {
412 prop.sym_name = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.sym_name)>>(value);
413 return;
414 }
415
416 if (name == "target") {
417 prop.target = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.target)>>(value);
418 return;
419 }
420}
421
422void ContractOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
423 if (prop.arg_attrs) attrs.append("arg_attrs", prop.arg_attrs);
424
425 if (prop.function_type) attrs.append("function_type", prop.function_type);
426
427 if (prop.sym_name) attrs.append("sym_name", prop.sym_name);
428
429 if (prop.target) attrs.append("target", prop.target);
430}
431
432::llvm::LogicalResult ContractOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
433 {
434 ::mlir::Attribute attr = attrs.get(getArgAttrsAttrName(opName));
435 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops4(attr, "arg_attrs", emitError)))
436 return ::mlir::failure();
437 }
438
439 {
440 ::mlir::Attribute attr = attrs.get(getFunctionTypeAttrName(opName));
441 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops3(attr, "function_type", emitError)))
442 return ::mlir::failure();
443 }
444
445 {
446 ::mlir::Attribute attr = attrs.get(getSymNameAttrName(opName));
447 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(attr, "sym_name", emitError)))
448 return ::mlir::failure();
449 }
450
451 {
452 ::mlir::Attribute attr = attrs.get(getTargetAttrName(opName));
453 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops2(attr, "target", emitError)))
454 return ::mlir::failure();
455 }
456 return ::mlir::success();
457}
458
459::llvm::LogicalResult ContractOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
460 auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
461 if (::mlir::failed(reader.readOptionalAttribute(prop.arg_attrs)))
462 return ::mlir::failure();
463
464 if (::mlir::failed(reader.readAttribute(prop.function_type)))
465 return ::mlir::failure();
466
467 if (::mlir::failed(reader.readAttribute(prop.sym_name)))
468 return ::mlir::failure();
469
470 if (::mlir::failed(reader.readAttribute(prop.target)))
471 return ::mlir::failure();
472 return ::mlir::success();
473}
474
475void ContractOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
476 auto &prop = getProperties(); (void)prop;
477
478 writer.writeOptionalAttribute(prop.arg_attrs);
479 writer.writeAttribute(prop.function_type);
480 writer.writeAttribute(prop.sym_name);
481 writer.writeAttribute(prop.target);
482}
483
484::llvm::StringRef ContractOp::getSymName() {
485 auto attr = getSymNameAttr();
486 return attr.getValue();
487}
488
489::mlir::SymbolRefAttr ContractOp::getTarget() {
490 auto attr = getTargetAttr();
491 return attr;
492}
493
494::mlir::FunctionType ContractOp::getFunctionType() {
495 auto attr = getFunctionTypeAttr();
496 return ::llvm::cast<::mlir::FunctionType>(attr.getValue());
497}
498
499::std::optional< ::mlir::ArrayAttr > ContractOp::getArgAttrs() {
500 auto attr = getArgAttrsAttr();
501 return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
502}
503
504void ContractOp::setSymName(::llvm::StringRef attrValue) {
505 getProperties().sym_name = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue);
506}
507
508void ContractOp::setFunctionType(::mlir::FunctionType attrValue) {
509 getProperties().function_type = ::mlir::TypeAttr::get(attrValue);
510}
511
512void ContractOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::SymbolRefAttr target, ::mlir::TypeAttr function_type, ::mlir::ArrayAttr arg_attrs) {
513 build(odsBuilder, odsState, ::mlir::TypeRange {}, sym_name, target, function_type, arg_attrs);
514
515}
516
517void ContractOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::SymbolRefAttr target, ::mlir::TypeAttr function_type, ::mlir::ArrayAttr arg_attrs) {
518 odsState.getOrAddProperties<Properties>().sym_name = sym_name;
519 odsState.getOrAddProperties<Properties>().target = target;
520 odsState.getOrAddProperties<Properties>().function_type = function_type;
521 if (arg_attrs) {
522 odsState.getOrAddProperties<Properties>().arg_attrs = arg_attrs;
523 }
524 initializeEmptyBody(
525 odsBuilder, odsState, ::mlir::cast<::mlir::FunctionType>(function_type.getValue())
526 );
527 assert(resultTypes.size() == 0u && "mismatched number of results");
528 odsState.addTypes(resultTypes);
529
530}
531
532void ContractOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, ::mlir::SymbolRefAttr target, ::mlir::FunctionType function_type, ::mlir::ArrayAttr arg_attrs) {
533 build(odsBuilder, odsState, ::mlir::TypeRange {}, sym_name, target, function_type, arg_attrs);
534
535}
536
537void ContractOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::SymbolRefAttr target, ::mlir::FunctionType function_type, ::mlir::ArrayAttr arg_attrs) {
538 odsState.getOrAddProperties<Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
539 odsState.getOrAddProperties<Properties>().target = target;
540 odsState.getOrAddProperties<Properties>().function_type = ::mlir::TypeAttr::get(function_type);
541 if (arg_attrs) {
542 odsState.getOrAddProperties<Properties>().arg_attrs = arg_attrs;
543 }
544 initializeEmptyBody(odsBuilder, odsState, function_type);
545 assert(resultTypes.size() == 0u && "mismatched number of results");
546 odsState.addTypes(resultTypes);
547
548}
549
550::llvm::LogicalResult ContractOp::verifyInvariantsImpl() {
551 auto tblgen_arg_attrs = getProperties().arg_attrs; (void)tblgen_arg_attrs;
552 auto tblgen_function_type = getProperties().function_type; (void)tblgen_function_type;
553 if (!tblgen_function_type) return emitOpError("requires attribute 'function_type'");
554 auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
555 if (!tblgen_sym_name) return emitOpError("requires attribute 'sym_name'");
556 auto tblgen_target = getProperties().target; (void)tblgen_target;
557 if (!tblgen_target) return emitOpError("requires attribute 'target'");
558
559 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(*this, tblgen_sym_name, "sym_name")))
560 return ::mlir::failure();
561
562 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops2(*this, tblgen_target, "target")))
563 return ::mlir::failure();
564
565 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops3(*this, tblgen_function_type, "function_type")))
566 return ::mlir::failure();
567
568 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops4(*this, tblgen_arg_attrs, "arg_attrs")))
569 return ::mlir::failure();
570 {
571 unsigned index = 0; (void)index;
572
573 for (auto &region : ::llvm::MutableArrayRef((*this)->getRegion(0)))
574 if (::mlir::failed(__mlir_ods_local_region_constraint_Ops1(*this, region, "body", index++)))
575 return ::mlir::failure();
576 }
577 return ::mlir::success();
578}
579
580::llvm::LogicalResult ContractOp::verifyInvariants() {
581 if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
582 return ::mlir::success();
583 return ::mlir::failure();
584}
585
586} // namespace verif
587} // namespace llzk
588MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::verif::ContractOp)
589
590namespace llzk {
591namespace verif {
592
593//===----------------------------------------------------------------------===//
594// ::llzk::verif::EnsureComputeOp definitions
595//===----------------------------------------------------------------------===//
596
597namespace detail {
598} // namespace detail
600
601::llvm::LogicalResult EnsureComputeOpAdaptor::verify(::mlir::Location loc) {
602 return ::mlir::success();
603}
604
605void EnsureComputeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value condition) {
606 odsState.addOperands(condition);
607}
608
609void EnsureComputeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value condition) {
610 odsState.addOperands(condition);
611 assert(resultTypes.size() == 0u && "mismatched number of results");
612 odsState.addTypes(resultTypes);
613}
614
615void EnsureComputeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
616 assert(operands.size() == 1u && "mismatched number of parameters");
617 odsState.addOperands(operands);
618 odsState.addAttributes(attributes);
619 assert(resultTypes.size() == 0u && "mismatched number of return types");
620 odsState.addTypes(resultTypes);
621}
622
624 {
625 unsigned index = 0; (void)index;
626 auto valueGroup0 = getODSOperands(0);
627
628 for (auto v : valueGroup0) {
629 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*this, v.getType(), "operand", index++)))
630 return ::mlir::failure();
631 }
632 }
633 return ::mlir::success();
634}
635
636::llvm::LogicalResult EnsureComputeOp::verifyInvariants() {
637 return verifyInvariantsImpl();
638}
639
640::mlir::ParseResult EnsureComputeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
641 ::mlir::OpAsmParser::UnresolvedOperand conditionRawOperand{};
642 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> conditionOperands(&conditionRawOperand, 1); ::llvm::SMLoc conditionOperandsLoc;
643 (void)conditionOperandsLoc;
644
645 conditionOperandsLoc = parser.getCurrentLocation();
646 if (parser.parseOperand(conditionRawOperand))
647 return ::mlir::failure();
648 {
649 auto loc = parser.getCurrentLocation();(void)loc;
650 if (parser.parseOptionalAttrDict(result.attributes))
651 return ::mlir::failure();
652 }
653 ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(1);
654 if (parser.resolveOperands(conditionOperands, odsBuildableType0, conditionOperandsLoc, result.operands))
655 return ::mlir::failure();
656 return ::mlir::success();
657}
658
659void EnsureComputeOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
660 _odsPrinter << ' ';
661 _odsPrinter << getCondition();
662 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
663 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
664}
665
666// This side effect models "program termination". Based on
667// https://github.com/llvm/llvm-project/blob/f325e4b2d836d6e65a4d0cf3efc6b0996ccf3765/mlir/lib/Dialect/ControlFlow/IR/ControlFlowOps.cpp#L92-L97
669 ::mlir::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects
670) {
671 effects.emplace_back(::mlir::MemoryEffects::Write::get());
672}
673} // namespace verif
674} // namespace llzk
675MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::verif::EnsureComputeOp)
676
677namespace llzk {
678namespace verif {
679
680//===----------------------------------------------------------------------===//
681// ::llzk::verif::EnsureConstrainOp definitions
682//===----------------------------------------------------------------------===//
683
684namespace detail {
685} // namespace detail
687
688::llvm::LogicalResult EnsureConstrainOpAdaptor::verify(::mlir::Location loc) {
689 return ::mlir::success();
690}
691
692void EnsureConstrainOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value condition) {
693 odsState.addOperands(condition);
694}
695
696void EnsureConstrainOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value condition) {
697 odsState.addOperands(condition);
698 assert(resultTypes.size() == 0u && "mismatched number of results");
699 odsState.addTypes(resultTypes);
700}
701
702void EnsureConstrainOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
703 assert(operands.size() == 1u && "mismatched number of parameters");
704 odsState.addOperands(operands);
705 odsState.addAttributes(attributes);
706 assert(resultTypes.size() == 0u && "mismatched number of return types");
707 odsState.addTypes(resultTypes);
708}
709
711 {
712 unsigned index = 0; (void)index;
713 auto valueGroup0 = getODSOperands(0);
714
715 for (auto v : valueGroup0) {
716 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*this, v.getType(), "operand", index++)))
717 return ::mlir::failure();
718 }
719 }
720 return ::mlir::success();
721}
722
723::llvm::LogicalResult EnsureConstrainOp::verifyInvariants() {
724 return verifyInvariantsImpl();
725}
726
727::mlir::ParseResult EnsureConstrainOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
728 ::mlir::OpAsmParser::UnresolvedOperand conditionRawOperand{};
729 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> conditionOperands(&conditionRawOperand, 1); ::llvm::SMLoc conditionOperandsLoc;
730 (void)conditionOperandsLoc;
731
732 conditionOperandsLoc = parser.getCurrentLocation();
733 if (parser.parseOperand(conditionRawOperand))
734 return ::mlir::failure();
735 {
736 auto loc = parser.getCurrentLocation();(void)loc;
737 if (parser.parseOptionalAttrDict(result.attributes))
738 return ::mlir::failure();
739 }
740 ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(1);
741 if (parser.resolveOperands(conditionOperands, odsBuildableType0, conditionOperandsLoc, result.operands))
742 return ::mlir::failure();
743 return ::mlir::success();
744}
745
746void EnsureConstrainOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
747 _odsPrinter << ' ';
748 _odsPrinter << getCondition();
749 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
750 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
751}
752
753// This side effect models "program termination". Based on
754// https://github.com/llvm/llvm-project/blob/f325e4b2d836d6e65a4d0cf3efc6b0996ccf3765/mlir/lib/Dialect/ControlFlow/IR/ControlFlowOps.cpp#L92-L97
756 ::mlir::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects
757) {
758 effects.emplace_back(::mlir::MemoryEffects::Write::get());
759}
760} // namespace verif
761} // namespace llzk
762MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::verif::EnsureConstrainOp)
763
764namespace llzk {
765namespace verif {
766
767//===----------------------------------------------------------------------===//
768// ::llzk::verif::IncludeOp definitions
769//===----------------------------------------------------------------------===//
770
771namespace detail {
772IncludeOpGenericAdaptorBase::IncludeOpGenericAdaptorBase(IncludeOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
773
774std::pair<unsigned, unsigned> IncludeOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
775 ::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
776
777 unsigned start = 0;
778 for (unsigned i = 0; i < index; ++i)
779 start += sizeAttr[i];
780 return {start, sizeAttr[index]};
781}
782
784 auto attr = getCalleeAttr();
785 return attr;
786}
787
788::std::optional< ::mlir::ArrayAttr > IncludeOpGenericAdaptorBase::getTemplateParams() {
789 auto attr = getTemplateParamsAttr();
790 return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
791}
792
794 auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(getProperties().numDimsPerMap);
795 return attr;
796}
797
799 auto attr = getNumDimsPerMapAttr();
800 return attr;
801}
802
804 auto attr = getMapOpGroupSizesAttr();
805 return attr;
806}
807
808} // namespace detail
810
811::llvm::LogicalResult IncludeOpAdaptor::verify(::mlir::Location loc) {
812 auto tblgen_callee = getProperties().callee; (void)tblgen_callee;
813 if (!tblgen_callee) return emitError(loc, "'verif.include' op ""requires attribute 'callee'");
814 auto tblgen_mapOpGroupSizes = getProperties().mapOpGroupSizes; (void)tblgen_mapOpGroupSizes;
815 if (!tblgen_mapOpGroupSizes) return emitError(loc, "'verif.include' op ""requires attribute 'mapOpGroupSizes'");
816 auto tblgen_numDimsPerMap = getProperties().numDimsPerMap; (void)tblgen_numDimsPerMap;
817 auto tblgen_templateParams = getProperties().templateParams; (void)tblgen_templateParams;
818
819 if (tblgen_callee && !((::llvm::isa<::mlir::SymbolRefAttr>(tblgen_callee))))
820 return emitError(loc, "'verif.include' op ""attribute 'callee' failed to satisfy constraint: symbol reference attribute");
821
822 if (tblgen_templateParams && !((::llvm::isa<::mlir::ArrayAttr>(tblgen_templateParams))))
823 return emitError(loc, "'verif.include' op ""attribute 'templateParams' failed to satisfy constraint: array attribute");
824
825 if (tblgen_numDimsPerMap && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(tblgen_numDimsPerMap))))
826 return emitError(loc, "'verif.include' op ""attribute 'numDimsPerMap' failed to satisfy constraint: i32 dense array attribute");
827
828 if (tblgen_mapOpGroupSizes && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(tblgen_mapOpGroupSizes))))
829 return emitError(loc, "'verif.include' op ""attribute 'mapOpGroupSizes' failed to satisfy constraint: i32 dense array attribute");
830 return ::mlir::success();
831}
832
833std::pair<unsigned, unsigned> IncludeOp::getODSOperandIndexAndLength(unsigned index) {
834 ::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
835
836 unsigned start = 0;
837 for (unsigned i = 0; i < index; ++i)
838 start += sizeAttr[i];
839 return {start, sizeAttr[index]};
840}
841
842::mlir::MutableOperandRange IncludeOp::getArgOperandsMutable() {
843 auto range = getODSOperandIndexAndLength(0);
844 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
845 return mutableRange;
846}
847
848::mlir::MutableOperandRangeRange IncludeOp::getMapOperandsMutable() {
849 auto range = getODSOperandIndexAndLength(1);
850 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
851 return mutableRange.split(*(*this)->getAttrDictionary().getNamed(getMapOpGroupSizesAttrName()));
852}
853
854::llvm::LogicalResult IncludeOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
855 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
856 if (!dict) {
857 emitError() << "expected DictionaryAttr to set properties";
858 return ::mlir::failure();
859 }
860
861 {
862 auto &propStorage = prop.callee;
863 auto attr = dict.get("callee");
864 if (attr) {
865 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
866 if (convertedAttr) {
867 propStorage = convertedAttr;
868 } else {
869 emitError() << "Invalid attribute `callee` in property conversion: " << attr;
870 return ::mlir::failure();
871 }
872 }
873 }
874
875 {
876 auto &propStorage = prop.mapOpGroupSizes;
877 auto attr = dict.get("mapOpGroupSizes");
878 if (attr) {
879 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
880 if (convertedAttr) {
881 propStorage = convertedAttr;
882 } else {
883 emitError() << "Invalid attribute `mapOpGroupSizes` in property conversion: " << attr;
884 return ::mlir::failure();
885 }
886 }
887 }
888
889 {
890 auto &propStorage = prop.numDimsPerMap;
891 auto attr = dict.get("numDimsPerMap");
892 if (attr) {
893 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
894 if (convertedAttr) {
895 propStorage = convertedAttr;
896 } else {
897 emitError() << "Invalid attribute `numDimsPerMap` in property conversion: " << attr;
898 return ::mlir::failure();
899 }
900 }
901 }
902
903 {
904 auto &propStorage = prop.templateParams;
905 auto attr = dict.get("templateParams");
906 if (attr) {
907 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
908 if (convertedAttr) {
909 propStorage = convertedAttr;
910 } else {
911 emitError() << "Invalid attribute `templateParams` in property conversion: " << attr;
912 return ::mlir::failure();
913 }
914 }
915 }
916{
917
918 auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr,
919 ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) -> ::mlir::LogicalResult {
920 return convertFromAttribute(propStorage, propAttr, emitError);
921 };
922 auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");;
923;
924 if (attr && ::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError)))
925 return ::mlir::failure();
926 }
927 return ::mlir::success();
928}
929
930::mlir::Attribute IncludeOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
931 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
932 ::mlir::Builder odsBuilder{ctx};
933
934 {
935 const auto &propStorage = prop.callee;
936 if (propStorage)
937 attrs.push_back(odsBuilder.getNamedAttr("callee",
938 propStorage));
939 }
940
941 {
942 const auto &propStorage = prop.mapOpGroupSizes;
943 if (propStorage)
944 attrs.push_back(odsBuilder.getNamedAttr("mapOpGroupSizes",
945 propStorage));
946 }
947
948 {
949 const auto &propStorage = prop.numDimsPerMap;
950 if (propStorage)
951 attrs.push_back(odsBuilder.getNamedAttr("numDimsPerMap",
952 propStorage));
953 }
954
955 {
956 const auto &propStorage = prop.templateParams;
957 if (propStorage)
958 attrs.push_back(odsBuilder.getNamedAttr("templateParams",
959 propStorage));
960 }
961
962 {
963 const auto &propStorage = prop.operandSegmentSizes;
964 auto attr = [&]() -> ::mlir::Attribute {
965 return ::mlir::DenseI32ArrayAttr::get(ctx, propStorage);
966 }();
967 attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", attr));
968 }
969
970 if (!attrs.empty())
971 return odsBuilder.getDictionaryAttr(attrs);
972 return {};
973}
974
975llvm::hash_code IncludeOp::computePropertiesHash(const Properties &prop) {
976 auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code {
977 return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));;
978 };
979 return llvm::hash_combine(
980 llvm::hash_value(prop.callee.getAsOpaquePointer()),
981 llvm::hash_value(prop.mapOpGroupSizes.getAsOpaquePointer()),
982 llvm::hash_value(prop.numDimsPerMap.getAsOpaquePointer()),
983 llvm::hash_value(prop.templateParams.getAsOpaquePointer()),
984 hash_operandSegmentSizes(prop.operandSegmentSizes));
985}
986
987std::optional<mlir::Attribute> IncludeOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
988 if (name == "callee")
989 return prop.callee;
990
991 if (name == "mapOpGroupSizes")
992 return prop.mapOpGroupSizes;
993
994 if (name == "numDimsPerMap")
995 return prop.numDimsPerMap;
996
997 if (name == "templateParams")
998 return prop.templateParams;
999 if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); }();
1000 return std::nullopt;
1001}
1002
1003void IncludeOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
1004 if (name == "callee") {
1005 prop.callee = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.callee)>>(value);
1006 return;
1007 }
1008
1009 if (name == "mapOpGroupSizes") {
1010 prop.mapOpGroupSizes = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.mapOpGroupSizes)>>(value);
1011 return;
1012 }
1013
1014 if (name == "numDimsPerMap") {
1015 prop.numDimsPerMap = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.numDimsPerMap)>>(value);
1016 return;
1017 }
1018
1019 if (name == "templateParams") {
1020 prop.templateParams = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.templateParams)>>(value);
1021 return;
1022 }
1023 if (name == "operand_segment_sizes" || name == "operandSegmentSizes") {
1024 auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value);
1025 if (!arrAttr) return;
1026 if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t))
1027 return;
1028 llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin());
1029 return;
1030 }
1031}
1032
1033void IncludeOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
1034 if (prop.callee) attrs.append("callee", prop.callee);
1035
1036 if (prop.mapOpGroupSizes) attrs.append("mapOpGroupSizes", prop.mapOpGroupSizes);
1037
1038 if (prop.numDimsPerMap) attrs.append("numDimsPerMap", prop.numDimsPerMap);
1039
1040 if (prop.templateParams) attrs.append("templateParams", prop.templateParams);
1041 attrs.append("operandSegmentSizes", [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); }());
1042}
1043
1044::llvm::LogicalResult IncludeOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
1045 {
1046 ::mlir::Attribute attr = attrs.get(getCalleeAttrName(opName));
1047 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops2(attr, "callee", emitError)))
1048 return ::mlir::failure();
1049 }
1050
1051 {
1052 ::mlir::Attribute attr = attrs.get(getMapOpGroupSizesAttrName(opName));
1053 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops6(attr, "mapOpGroupSizes", emitError)))
1054 return ::mlir::failure();
1055 }
1056
1057 {
1058 ::mlir::Attribute attr = attrs.get(getNumDimsPerMapAttrName(opName));
1059 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops6(attr, "numDimsPerMap", emitError)))
1060 return ::mlir::failure();
1061 }
1062
1063 {
1064 ::mlir::Attribute attr = attrs.get(getTemplateParamsAttrName(opName));
1065 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops5(attr, "templateParams", emitError)))
1066 return ::mlir::failure();
1067 }
1068 return ::mlir::success();
1069}
1070
1071::llvm::LogicalResult IncludeOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
1072 auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
1073 if (::mlir::failed(reader.readAttribute(prop.callee)))
1074 return ::mlir::failure();
1075
1076 if (::mlir::failed(reader.readAttribute(prop.mapOpGroupSizes)))
1077 return ::mlir::failure();
1078
1079 if (::mlir::failed(reader.readOptionalAttribute(prop.numDimsPerMap)))
1080 return ::mlir::failure();
1081
1082 if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) {
1083 auto &propStorage = prop.operandSegmentSizes;
1084 ::mlir::DenseI32ArrayAttr attr;
1085 if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure();
1086 if (attr.size() > static_cast<int64_t>(sizeof(propStorage) / sizeof(int32_t))) {
1087 reader.emitError("size mismatch for operand/result_segment_size");
1088 return ::mlir::failure();
1089 }
1090 ::llvm::copy(::llvm::ArrayRef<int32_t>(attr), propStorage.begin());
1091 }
1092
1093 if (::mlir::failed(reader.readOptionalAttribute(prop.templateParams)))
1094 return ::mlir::failure();
1095
1096 {
1097 auto &propStorage = prop.operandSegmentSizes;
1098 auto readProp = [&]() {
1099
1100 if (reader.getBytecodeVersion() >= /*kNativePropertiesODSSegmentSize=*/6)
1101 return reader.readSparseArray(::llvm::MutableArrayRef(propStorage));
1102;
1103 return ::mlir::success();
1104 };
1105 if (::mlir::failed(readProp()))
1106 return ::mlir::failure();
1107 }
1108 return ::mlir::success();
1109}
1110
1111void IncludeOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
1112 auto &prop = getProperties(); (void)prop;
1113 writer.writeAttribute(prop.callee);
1114 writer.writeAttribute(prop.mapOpGroupSizes);
1115
1116 writer.writeOptionalAttribute(prop.numDimsPerMap);
1117
1118if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) {
1119 auto &propStorage = prop.operandSegmentSizes;
1120 writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(this->getContext(), propStorage));
1121}
1122
1123 writer.writeOptionalAttribute(prop.templateParams);
1124
1125 {
1126 auto &propStorage = prop.operandSegmentSizes;
1127
1128 if (writer.getBytecodeVersion() >= /*kNativePropertiesODSSegmentSize=*/6)
1129 writer.writeSparseArray(::llvm::ArrayRef(propStorage));
1130;
1131 }
1132}
1133
1134::mlir::SymbolRefAttr IncludeOp::getCallee() {
1135 auto attr = getCalleeAttr();
1136 return attr;
1137}
1138
1139::std::optional< ::mlir::ArrayAttr > IncludeOp::getTemplateParams() {
1140 auto attr = getTemplateParamsAttr();
1141 return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
1142}
1143
1144::llvm::ArrayRef<int32_t> IncludeOp::getNumDimsPerMap() {
1145 auto attr = getNumDimsPerMapAttr();
1146 return attr;
1147}
1148
1149::llvm::ArrayRef<int32_t> IncludeOp::getMapOpGroupSizes() {
1150 auto attr = getMapOpGroupSizesAttr();
1151 return attr;
1152}
1153
1154void IncludeOp::setNumDimsPerMap(::llvm::ArrayRef<int32_t> attrValue) {
1155 getProperties().numDimsPerMap = ::mlir::Builder((*this)->getContext()).getDenseI32ArrayAttr(attrValue);
1156}
1157
1158void IncludeOp::setMapOpGroupSizes(::llvm::ArrayRef<int32_t> attrValue) {
1159 getProperties().mapOpGroupSizes = ::mlir::Builder((*this)->getContext()).getDenseI32ArrayAttr(attrValue);
1160}
1161
1162void IncludeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::SymbolRefAttr callee, ::llvm::ArrayRef<::mlir::ValueRange> mapOperands, ::llvm::ArrayRef<int32_t> numDimsPerMap, ::mlir::ValueRange argOperands, ::llvm::ArrayRef<::mlir::Attribute> templateParams) {
1163 build(odsBuilder, odsState, callee, mapOperands,
1164 odsBuilder.getDenseI32ArrayAttr(numDimsPerMap),
1165 argOperands, templateParams);
1166
1167}
1168
1169void IncludeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llzk::verif::ContractOp callee, ::mlir::ValueRange argOperands, ::llvm::ArrayRef<::mlir::Attribute> templateParams) {
1170 build(odsBuilder, odsState,
1171 callee.getFullyQualifiedName(false),
1172 argOperands, templateParams);
1173
1174}
1175
1176void IncludeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llzk::verif::ContractOp callee, ::llvm::ArrayRef<::mlir::ValueRange> mapOperands, ::mlir::DenseI32ArrayAttr numDimsPerMap, ::mlir::ValueRange argOperands, ::llvm::ArrayRef<::mlir::Attribute> templateParams) {
1177 build(odsBuilder, odsState,
1178 callee.getFullyQualifiedName(false), mapOperands, numDimsPerMap,
1179 argOperands, templateParams);
1180
1181}
1182
1183void IncludeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llzk::verif::ContractOp callee, ::llvm::ArrayRef<::mlir::ValueRange> mapOperands, ::llvm::ArrayRef<int32_t> numDimsPerMap, ::mlir::ValueRange argOperands, ::llvm::ArrayRef<::mlir::Attribute> templateParams) {
1184 build(odsBuilder, odsState, callee, mapOperands,
1185 odsBuilder.getDenseI32ArrayAttr(numDimsPerMap),
1186 argOperands, templateParams);
1187
1188}
1189
1190void IncludeOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) {
1191 ::mlir::Builder odsBuilder(opName.getContext());
1192 if (!properties.numDimsPerMap)
1193 properties.numDimsPerMap = odsBuilder.getDenseI32ArrayAttr({});
1194}
1195
1196::llvm::LogicalResult IncludeOp::verifyInvariantsImpl() {
1197 auto tblgen_callee = getProperties().callee; (void)tblgen_callee;
1198 if (!tblgen_callee) return emitOpError("requires attribute 'callee'");
1199 auto tblgen_mapOpGroupSizes = getProperties().mapOpGroupSizes; (void)tblgen_mapOpGroupSizes;
1200 if (!tblgen_mapOpGroupSizes) return emitOpError("requires attribute 'mapOpGroupSizes'");
1201 auto tblgen_numDimsPerMap = getProperties().numDimsPerMap; (void)tblgen_numDimsPerMap;
1202 auto tblgen_templateParams = getProperties().templateParams; (void)tblgen_templateParams;
1203
1204 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops2(*this, tblgen_callee, "callee")))
1205 return ::mlir::failure();
1206
1207 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops5(*this, tblgen_templateParams, "templateParams")))
1208 return ::mlir::failure();
1209
1210 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops6(*this, tblgen_numDimsPerMap, "numDimsPerMap")))
1211 return ::mlir::failure();
1212
1213 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops6(*this, tblgen_mapOpGroupSizes, "mapOpGroupSizes")))
1214 return ::mlir::failure();
1215 {
1216 unsigned index = 0; (void)index;
1217 auto valueGroup0 = getODSOperands(0);
1218
1219 for (auto v : valueGroup0) {
1220 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops2(*this, v.getType(), "operand", index++)))
1221 return ::mlir::failure();
1222 }
1223 auto valueGroup1 = getODSOperands(1);
1224 if (::mlir::failed(::mlir::OpTrait::impl::verifyValueSizeAttr(*this, "mapOpGroupSizes", "mapOperands", valueGroup1.size())))
1225 return ::mlir::failure();
1226
1227 for (auto v : valueGroup1) {
1228 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops3(*this, v.getType(), "operand", index++)))
1229 return ::mlir::failure();
1230 }
1231 }
1232 return ::mlir::success();
1233}
1234
1235::llvm::LogicalResult IncludeOp::verifyInvariants() {
1236 return verifyInvariantsImpl();
1237}
1238
1239::mlir::ParseResult IncludeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
1240 ::mlir::SymbolRefAttr calleeAttr;
1241 ::mlir::ArrayAttr templateParamsAttr;
1242 ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argOperandsOperands;
1243 ::llvm::SMLoc argOperandsOperandsLoc;
1244 (void)argOperandsOperandsLoc;
1245 ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> mapOperandsOperands;
1246 llvm::SmallVector<int32_t> mapOperandsOperandGroupSizes;
1247 ::llvm::SMLoc mapOperandsOperandsLoc;
1248 (void)mapOperandsOperandsLoc;
1249 ::mlir::DenseI32ArrayAttr numDimsPerMapAttr;
1250 ::llvm::ArrayRef<::mlir::Type> argOperandsTypes;
1251 ::llvm::ArrayRef<::mlir::Type> allResultTypes;
1252
1253 if (parser.parseCustomAttributeWithFallback(calleeAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
1254 return ::mlir::failure();
1255 }
1256 if (calleeAttr) result.getOrAddProperties<IncludeOp::Properties>().callee = calleeAttr;
1257 if (::mlir::succeeded(parser.parseOptionalLess())) {
1258 {
1259 auto odsResult = parseTemplateParams(parser, templateParamsAttr);
1260 if (odsResult) return ::mlir::failure();
1261 if (templateParamsAttr)
1262 result.getOrAddProperties<IncludeOp::Properties>().templateParams = templateParamsAttr;
1263 }
1264 if (parser.parseGreater())
1265 return ::mlir::failure();
1266 }
1267 if (parser.parseLParen())
1268 return ::mlir::failure();
1269
1270 argOperandsOperandsLoc = parser.getCurrentLocation();
1271 if (parser.parseOperandList(argOperandsOperands))
1272 return ::mlir::failure();
1273 if (parser.parseRParen())
1274 return ::mlir::failure();
1275 if (::mlir::succeeded(parser.parseOptionalLBrace())) {
1276 {
1277 mapOperandsOperandsLoc = parser.getCurrentLocation();
1278 ::llvm::SmallVector<::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand>> mapOperandsOperandGroups;
1279 auto odsResult = parseMultiDimAndSymbolList(parser, mapOperandsOperandGroups, numDimsPerMapAttr);
1280 if (odsResult) return ::mlir::failure();
1281 for (const auto &subRange : mapOperandsOperandGroups) {
1282 mapOperandsOperands.append(subRange.begin(), subRange.end());
1283 mapOperandsOperandGroupSizes.push_back(subRange.size());
1284 }
1285 if (numDimsPerMapAttr)
1286 result.getOrAddProperties<IncludeOp::Properties>().numDimsPerMap = numDimsPerMapAttr;
1287 }
1288 if (parser.parseRBrace())
1289 return ::mlir::failure();
1290 }
1291 if (parser.parseColon())
1292 return ::mlir::failure();
1293
1294 ::mlir::FunctionType argOperands__allResult_functionType;
1295 if (parser.parseType(argOperands__allResult_functionType))
1296 return ::mlir::failure();
1297 argOperandsTypes = argOperands__allResult_functionType.getInputs();
1298 allResultTypes = argOperands__allResult_functionType.getResults();
1299 {
1300 auto odsResult = parseAttrDictWithWarnings(parser, result.attributes, result);
1301 if (odsResult) return ::mlir::failure();
1302 }
1303::llvm::copy(::llvm::ArrayRef<int32_t>({static_cast<int32_t>(argOperandsOperands.size()), static_cast<int32_t>(mapOperandsOperands.size())}), result.getOrAddProperties<IncludeOp::Properties>().operandSegmentSizes.begin());
1304 result.getOrAddProperties<IncludeOp::Properties>().mapOpGroupSizes = parser.getBuilder().getDenseI32ArrayAttr(mapOperandsOperandGroupSizes);
1305 ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType();
1306 result.addTypes(allResultTypes);
1307 if (parser.resolveOperands(argOperandsOperands, argOperandsTypes, argOperandsOperandsLoc, result.operands))
1308 return ::mlir::failure();
1309 if (parser.resolveOperands(mapOperandsOperands, odsBuildableType0, mapOperandsOperandsLoc, result.operands))
1310 return ::mlir::failure();
1311 return ::mlir::success();
1312}
1313
1314::llvm::LogicalResult IncludeOp::setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
1315 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
1316 if (!dict) {
1317 emitError() << "expected DictionaryAttr to set properties";
1318 return ::mlir::failure();
1319 }
1320 {
1321
1322 auto &propStorage = prop.mapOpGroupSizes;
1323 auto attr = dict.get("mapOpGroupSizes");
1324 if (attr || /*isRequired=*/true) {
1325 if (!attr) {
1326 emitError() << "expected key entry for mapOpGroupSizes in DictionaryAttr to set "
1327 "Properties.";
1328 return ::mlir::failure();
1329 }
1330 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
1331 if (convertedAttr) {
1332 propStorage = convertedAttr;
1333 } else {
1334 emitError() << "Invalid attribute `mapOpGroupSizes` in property conversion: " << attr;
1335 return ::mlir::failure();
1336 }
1337 }
1338 }
1339 return ::mlir::success();
1340}
1341
1342void IncludeOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
1343 _odsPrinter << ' ';
1344 _odsPrinter.printAttributeWithoutType(getCalleeAttr());
1345 if (((getTemplateParamsAttr()))) {
1346 _odsPrinter << "<";
1347 printTemplateParams(_odsPrinter, *this, getTemplateParamsAttr());
1348 _odsPrinter << ">";
1349 }
1350 _odsPrinter << "(";
1351 _odsPrinter << getArgOperands();
1352 _odsPrinter << ")";
1353 if (((!getMapOperands().empty()) || (getNumDimsPerMapAttr() != ::mlir::OpBuilder((*this)->getContext()).getDenseI32ArrayAttr({})))) {
1354 _odsPrinter << ' ' << "{";
1356 _odsPrinter << "}";
1357 }
1358 _odsPrinter << ' ' << ":";
1359 _odsPrinter << ' ';
1360 _odsPrinter.printFunctionalType(getArgOperands().getTypes(), getOperation()->getResultTypes());
1361 _odsPrinter << ' ';
1362 printAttrDictWithWarnings(_odsPrinter, *this, getOperation()->getAttrDictionary(), getProperties());
1363}
1364
1365} // namespace verif
1366} // namespace llzk
1367MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::verif::IncludeOp)
1368
1369namespace llzk {
1370namespace verif {
1371
1372//===----------------------------------------------------------------------===//
1373// ::llzk::verif::RequireComputeOp definitions
1374//===----------------------------------------------------------------------===//
1375
1376namespace detail {
1377} // namespace detail
1379
1380::llvm::LogicalResult RequireComputeOpAdaptor::verify(::mlir::Location loc) {
1381 return ::mlir::success();
1382}
1383
1384void RequireComputeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value condition) {
1385 odsState.addOperands(condition);
1386}
1387
1388void RequireComputeOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value condition) {
1389 odsState.addOperands(condition);
1390 assert(resultTypes.size() == 0u && "mismatched number of results");
1391 odsState.addTypes(resultTypes);
1392}
1393
1394void RequireComputeOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
1395 assert(operands.size() == 1u && "mismatched number of parameters");
1396 odsState.addOperands(operands);
1397 odsState.addAttributes(attributes);
1398 assert(resultTypes.size() == 0u && "mismatched number of return types");
1399 odsState.addTypes(resultTypes);
1400}
1401
1403 {
1404 unsigned index = 0; (void)index;
1405 auto valueGroup0 = getODSOperands(0);
1406
1407 for (auto v : valueGroup0) {
1408 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*this, v.getType(), "operand", index++)))
1409 return ::mlir::failure();
1410 }
1411 }
1412 return ::mlir::success();
1413}
1414
1415::llvm::LogicalResult RequireComputeOp::verifyInvariants() {
1416 return verifyInvariantsImpl();
1417}
1418
1419::mlir::ParseResult RequireComputeOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
1420 ::mlir::OpAsmParser::UnresolvedOperand conditionRawOperand{};
1421 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> conditionOperands(&conditionRawOperand, 1); ::llvm::SMLoc conditionOperandsLoc;
1422 (void)conditionOperandsLoc;
1423
1424 conditionOperandsLoc = parser.getCurrentLocation();
1425 if (parser.parseOperand(conditionRawOperand))
1426 return ::mlir::failure();
1427 {
1428 auto loc = parser.getCurrentLocation();(void)loc;
1429 if (parser.parseOptionalAttrDict(result.attributes))
1430 return ::mlir::failure();
1431 }
1432 ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(1);
1433 if (parser.resolveOperands(conditionOperands, odsBuildableType0, conditionOperandsLoc, result.operands))
1434 return ::mlir::failure();
1435 return ::mlir::success();
1436}
1437
1438void RequireComputeOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
1439 _odsPrinter << ' ';
1440 _odsPrinter << getCondition();
1441 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
1442 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
1443}
1444
1445// This side effect models "program termination". Based on
1446// https://github.com/llvm/llvm-project/blob/f325e4b2d836d6e65a4d0cf3efc6b0996ccf3765/mlir/lib/Dialect/ControlFlow/IR/ControlFlowOps.cpp#L92-L97
1448 ::mlir::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects
1449) {
1450 effects.emplace_back(::mlir::MemoryEffects::Write::get());
1451}
1452} // namespace verif
1453} // namespace llzk
1454MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::verif::RequireComputeOp)
1455
1456namespace llzk {
1457namespace verif {
1458
1459//===----------------------------------------------------------------------===//
1460// ::llzk::verif::RequireConstrainOp definitions
1461//===----------------------------------------------------------------------===//
1462
1463namespace detail {
1464} // namespace detail
1466
1467::llvm::LogicalResult RequireConstrainOpAdaptor::verify(::mlir::Location loc) {
1468 return ::mlir::success();
1469}
1470
1471void RequireConstrainOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value condition) {
1472 odsState.addOperands(condition);
1473}
1474
1475void RequireConstrainOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value condition) {
1476 odsState.addOperands(condition);
1477 assert(resultTypes.size() == 0u && "mismatched number of results");
1478 odsState.addTypes(resultTypes);
1479}
1480
1481void RequireConstrainOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
1482 assert(operands.size() == 1u && "mismatched number of parameters");
1483 odsState.addOperands(operands);
1484 odsState.addAttributes(attributes);
1485 assert(resultTypes.size() == 0u && "mismatched number of return types");
1486 odsState.addTypes(resultTypes);
1487}
1488
1490 {
1491 unsigned index = 0; (void)index;
1492 auto valueGroup0 = getODSOperands(0);
1493
1494 for (auto v : valueGroup0) {
1495 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*this, v.getType(), "operand", index++)))
1496 return ::mlir::failure();
1497 }
1498 }
1499 return ::mlir::success();
1500}
1501
1503 return verifyInvariantsImpl();
1504}
1505
1506::mlir::ParseResult RequireConstrainOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
1507 ::mlir::OpAsmParser::UnresolvedOperand conditionRawOperand{};
1508 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> conditionOperands(&conditionRawOperand, 1); ::llvm::SMLoc conditionOperandsLoc;
1509 (void)conditionOperandsLoc;
1510
1511 conditionOperandsLoc = parser.getCurrentLocation();
1512 if (parser.parseOperand(conditionRawOperand))
1513 return ::mlir::failure();
1514 {
1515 auto loc = parser.getCurrentLocation();(void)loc;
1516 if (parser.parseOptionalAttrDict(result.attributes))
1517 return ::mlir::failure();
1518 }
1519 ::mlir::Type odsBuildableType0 = parser.getBuilder().getIntegerType(1);
1520 if (parser.resolveOperands(conditionOperands, odsBuildableType0, conditionOperandsLoc, result.operands))
1521 return ::mlir::failure();
1522 return ::mlir::success();
1523}
1524
1525void RequireConstrainOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
1526 _odsPrinter << ' ';
1527 _odsPrinter << getCondition();
1528 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
1529 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
1530}
1531
1532// This side effect models "program termination". Based on
1533// https://github.com/llvm/llvm-project/blob/f325e4b2d836d6e65a4d0cf3efc6b0996ccf3765/mlir/lib/Dialect/ControlFlow/IR/ControlFlowOps.cpp#L92-L97
1535 ::mlir::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects
1536) {
1537 effects.emplace_back(::mlir::MemoryEffects::Write::get());
1538}
1539} // namespace verif
1540} // namespace llzk
1541MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::verif::RequireConstrainOp)
1542
1543
1544#endif // GET_OP_CLASSES
1545
ContractEndOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs={}, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
Definition Ops.h.inc:84
::llvm::LogicalResult verify(::mlir::Location loc)
Definition Ops.cpp.inc:170
ContractEndOpAdaptor(ContractEndOp op)
Definition Ops.cpp.inc:168
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
Definition Ops.cpp.inc:198
::llvm::LogicalResult verifyInvariantsImpl()
Definition Ops.cpp.inc:190
::llvm::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:194
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState)
Definition Ops.cpp.inc:174
void print(::mlir::OpAsmPrinter &_odsPrinter)
Definition Ops.cpp.inc:207
void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect > > &effects)
Definition Ops.cpp.inc:212
ContractOpAdaptor(ContractOp op)
Definition Ops.cpp.inc:250
::llvm::LogicalResult verify(::mlir::Location loc)
Definition Ops.cpp.inc:252
ContractOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
Definition Ops.h.inc:293
::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:432
::mlir::StringAttr getFunctionTypeAttrName()
Definition Ops.h.inc:350
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
Definition Ops.cpp.inc:400
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
Definition Ops.cpp.inc:385
static llvm::hash_code computePropertiesHash(const Properties &prop)
Definition Ops.cpp.inc:377
::mlir::StringAttr getTargetAttrName()
Definition Ops.h.inc:366
void setFunctionType(::mlir::FunctionType attrValue)
Definition Ops.cpp.inc:508
::mlir::StringAttr getSymNameAttr()
Definition Ops.h.inc:411
::llvm::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:580
::llvm::LogicalResult verify()
Definition Ops.cpp:586
::std::optional< ::mlir::ArrayAttr > getArgAttrs()
Definition Ops.cpp.inc:499
::mlir::FunctionType getFunctionType()
Definition Ops.cpp.inc:494
::mlir::StringAttr getSymNameAttrName()
Definition Ops.h.inc:358
::mlir::StringAttr getArgAttrsAttrName()
Definition Ops.h.inc:342
::mlir::TypeAttr getFunctionTypeAttr()
Definition Ops.h.inc:421
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
Definition Ops.cpp.inc:340
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
Definition Ops.cpp.inc:422
::mlir::SymbolRefAttr getTargetAttr()
Definition Ops.h.inc:416
::mlir::SymbolRefAttr getFullyQualifiedName(bool requireParent=true)
Return the full name for this contract from the root module, including all surrounding symbol table n...
Definition Ops.cpp:387
::llvm::LogicalResult verifyInvariantsImpl()
Definition Ops.cpp.inc:550
::mlir::ArrayAttr getArgAttrsAttr()
Definition Ops.h.inc:426
void writeProperties(::mlir::DialectBytecodeWriter &writer)
Definition Ops.cpp.inc:475
void setSymName(::llvm::StringRef attrValue)
Definition Ops.cpp.inc:504
::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:275
::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state)
Definition Ops.cpp.inc:459
::mlir::SymbolRefAttr getTarget()
Definition Ops.cpp.inc:489
FoldAdaptor::Properties Properties
Definition Ops.h.inc:336
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::SymbolRefAttr target, ::mlir::TypeAttr function_type, ::mlir::ArrayAttr arg_attrs={})
Definition Ops.cpp.inc:512
::llvm::StringRef getSymName()
Definition Ops.cpp.inc:484
EnsureComputeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs={}, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
Definition Ops.h.inc:609
EnsureComputeOpAdaptor(EnsureComputeOp op)
Definition Ops.cpp.inc:599
::llvm::LogicalResult verify(::mlir::Location loc)
Definition Ops.cpp.inc:601
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
Definition Ops.cpp.inc:640
void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect > > &effects)
Definition Ops.cpp.inc:668
::llvm::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:636
void print(::mlir::OpAsmPrinter &_odsPrinter)
Definition Ops.cpp.inc:659
::mlir::Operation::operand_range getODSOperands(unsigned index)
Definition Ops.h.inc:666
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value condition)
Definition Ops.cpp.inc:605
::llvm::LogicalResult verifyInvariantsImpl()
Definition Ops.cpp.inc:623
::mlir::TypedValue<::mlir::IntegerType > getCondition()
Definition Ops.h.inc:672
::llvm::LogicalResult verify(::mlir::Location loc)
Definition Ops.cpp.inc:688
EnsureConstrainOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs={}, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
Definition Ops.h.inc:741
EnsureConstrainOpAdaptor(EnsureConstrainOp op)
Definition Ops.cpp.inc:686
::mlir::Operation::operand_range getODSOperands(unsigned index)
Definition Ops.h.inc:798
void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect > > &effects)
Definition Ops.cpp.inc:755
::llvm::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:723
void print(::mlir::OpAsmPrinter &_odsPrinter)
Definition Ops.cpp.inc:746
::llvm::LogicalResult verifyInvariantsImpl()
Definition Ops.cpp.inc:710
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value condition)
Definition Ops.cpp.inc:692
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
Definition Ops.cpp.inc:727
::mlir::TypedValue<::mlir::IntegerType > getCondition()
Definition Ops.h.inc:804
::llvm::LogicalResult verify(::mlir::Location loc)
Definition Ops.cpp.inc:811
IncludeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
Definition Ops.h.inc:959
void setNumDimsPerMap(::llvm::ArrayRef< int32_t > attrValue)
Definition Ops.cpp.inc:1154
::mlir::MutableOperandRange getArgOperandsMutable()
Definition Ops.cpp.inc:842
::mlir::ArrayAttr getTemplateParamsAttr()
Definition Ops.h.inc:1109
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
Definition Ops.cpp.inc:930
::llvm::LogicalResult verifyInvariantsImpl()
Definition Ops.cpp.inc:1196
static llvm::hash_code computePropertiesHash(const Properties &prop)
Definition Ops.cpp.inc:975
::mlir::Operation::operand_range getODSOperands(unsigned index)
Definition Ops.h.inc:1069
::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state)
Definition Ops.cpp.inc:1071
void setMapOpGroupSizes(::llvm::ArrayRef< int32_t > attrValue)
Definition Ops.cpp.inc:1158
::mlir::OperandRangeRange getMapOperands()
Definition Ops.h.inc:1079
::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:1314
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
Definition Ops.cpp.inc:1239
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index)
Definition Ops.cpp.inc:833
::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:1044
::llvm::ArrayRef< int32_t > getMapOpGroupSizes()
Definition Ops.cpp.inc:1149
void writeProperties(::mlir::DialectBytecodeWriter &writer)
Definition Ops.cpp.inc:1111
::mlir::SymbolRefAttr getCalleeAttr()
Definition Ops.h.inc:1104
FoldAdaptor::Properties Properties
Definition Ops.h.inc:1018
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
Definition Ops.cpp.inc:987
::mlir::Operation::operand_range getArgOperands()
Definition Ops.h.inc:1075
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
Definition Ops.cpp.inc:1033
::mlir::SymbolRefAttr getCallee()
Definition Ops.cpp.inc:1134
::mlir::StringAttr getCalleeAttrName()
Definition Ops.h.inc:1024
::mlir::StringAttr getMapOpGroupSizesAttrName()
Definition Ops.h.inc:1032
::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:854
::mlir::MutableOperandRangeRange getMapOperandsMutable()
Definition Ops.cpp.inc:848
::std::optional< ::mlir::ArrayAttr > getTemplateParams()
Definition Ops.cpp.inc:1139
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
Definition Ops.cpp.inc:1003
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::SymbolRefAttr callee, ::mlir::ValueRange argOperands={}, ::llvm::ArrayRef<::mlir::Attribute > templateParams={})
void print(::mlir::OpAsmPrinter &_odsPrinter)
Definition Ops.cpp.inc:1342
static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties)
Definition Ops.cpp.inc:1190
::llvm::ArrayRef< int32_t > getNumDimsPerMap()
Definition Ops.cpp.inc:1144
::mlir::StringAttr getNumDimsPerMapAttrName()
Definition Ops.h.inc:1040
::mlir::DenseI32ArrayAttr getNumDimsPerMapAttr()
Definition Ops.h.inc:1114
::llvm::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:1235
::mlir::DenseI32ArrayAttr getMapOpGroupSizesAttr()
Definition Ops.h.inc:1119
::mlir::StringAttr getTemplateParamsAttrName()
Definition Ops.h.inc:1048
RequireComputeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs={}, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
Definition Ops.h.inc:1277
RequireComputeOpAdaptor(RequireComputeOp op)
Definition Ops.cpp.inc:1378
::llvm::LogicalResult verify(::mlir::Location loc)
Definition Ops.cpp.inc:1380
::llvm::LogicalResult verifyInvariantsImpl()
Definition Ops.cpp.inc:1402
void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect > > &effects)
Definition Ops.cpp.inc:1447
::llvm::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:1415
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
Definition Ops.cpp.inc:1419
::mlir::TypedValue<::mlir::IntegerType > getCondition()
Definition Ops.h.inc:1340
::mlir::Operation::operand_range getODSOperands(unsigned index)
Definition Ops.h.inc:1334
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value condition)
Definition Ops.cpp.inc:1384
void print(::mlir::OpAsmPrinter &_odsPrinter)
Definition Ops.cpp.inc:1438
RequireConstrainOpAdaptor(RequireConstrainOp op)
Definition Ops.cpp.inc:1465
RequireConstrainOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs={}, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
Definition Ops.h.inc:1409
::llvm::LogicalResult verify(::mlir::Location loc)
Definition Ops.cpp.inc:1467
::llvm::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:1502
::mlir::TypedValue<::mlir::IntegerType > getCondition()
Definition Ops.h.inc:1472
void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect > > &effects)
Definition Ops.cpp.inc:1534
::llvm::LogicalResult verifyInvariantsImpl()
Definition Ops.cpp.inc:1489
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value condition)
Definition Ops.cpp.inc:1471
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
Definition Ops.cpp.inc:1506
::mlir::Operation::operand_range getODSOperands(unsigned index)
Definition Ops.h.inc:1466
void print(::mlir::OpAsmPrinter &_odsPrinter)
Definition Ops.cpp.inc:1525
::std::optional<::mlir::OperationName > odsOpName
Definition Ops.h.inc:232
ContractOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
Definition Ops.h.inc:236
::std::optional< ::mlir::ArrayAttr > getArgAttrs()
Definition Ops.cpp.inc:244
::llvm::ArrayRef< int32_t > getNumDimsPerMap()
Definition Ops.cpp.inc:798
::mlir::DenseI32ArrayAttr getNumDimsPerMapAttr()
Definition Ops.cpp.inc:793
::std::optional<::mlir::OperationName > odsOpName
Definition Ops.h.inc:913
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize)
Definition Ops.cpp.inc:774
::llvm::ArrayRef< int32_t > getMapOpGroupSizes()
Definition Ops.cpp.inc:803
::std::optional< ::mlir::ArrayAttr > getTemplateParams()
Definition Ops.cpp.inc:788
IncludeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
Definition Ops.h.inc:917
::mlir::DenseI32ArrayAttr getMapOpGroupSizesAttr()
Definition Ops.h.inc:946
void printTemplateParams(mlir::AsmPrinter &printer, mlir::ArrayAttr value)
Definition OpHelpers.h:242
mlir::ParseResult parseAttrDictWithWarnings(mlir::OpAsmParser &parser, mlir::NamedAttrList &extraAttrs, mlir::OperationState &state)
Definition OpHelpers.h:195
bool isValidType(Type type)
void printMultiDimAndSymbolList(mlir::OpAsmPrinter &printer, mlir::Operation *op, mlir::OperandRangeRange multiMapOperands, mlir::DenseI32ArrayAttr numDimsPerMap)
Definition OpHelpers.h:188
void printAttrDictWithWarnings(mlir::OpAsmPrinter &printer, ConcreteOp op, mlir::DictionaryAttr extraAttrs, typename mlir::PropertiesSelector< ConcreteOp >::type state)
Definition OpHelpers.h:202
mlir::ParseResult parseTemplateParams(mlir::AsmParser &parser, mlir::ArrayAttr &value)
Definition OpHelpers.h:209
mlir::ParseResult parseMultiDimAndSymbolList(mlir::OpAsmParser &parser, mlir::SmallVector< mlir::SmallVector< mlir::OpAsmParser::UnresolvedOperand > > &multiMapOperands, mlir::DenseI32ArrayAttr &numDimsPerMap)
Definition OpHelpers.h:180