33static ::llvm::LogicalResult __mlir_ods_local_type_constraint_Ops1(
34 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
35 unsigned valueIndex) {
36 if (!((::llvm::isa<::mlir::IndexType>(type)))) {
37 return op->emitOpError(valueKind) <<
" #" << valueIndex
38 <<
" must be variadic of index, but got " << type;
40 return ::mlir::success();
43static ::llvm::LogicalResult __mlir_ods_local_type_constraint_Ops2(
44 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
45 unsigned valueIndex) {
46 if (!((::llvm::isa<::mlir::IndexType>(type)))) {
47 return op->emitOpError(valueKind) <<
" #" << valueIndex
48 <<
" must be index, but got " << type;
50 return ::mlir::success();
53static ::llvm::LogicalResult __mlir_ods_local_type_constraint_Ops3(
54 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
55 unsigned valueIndex) {
57 return op->emitOpError(valueKind) <<
" #" << valueIndex
58 <<
" must be integral, felt, or typevar type, but got " << type;
60 return ::mlir::success();
63static ::llvm::LogicalResult __mlir_ods_local_type_constraint_Ops4(
64 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
65 unsigned valueIndex) {
67 return op->emitOpError(valueKind) <<
" #" << valueIndex
68 <<
" must be a valid LLZK type, but got " << type;
70 return ::mlir::success();
73static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops1(
74 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
75 if (attr && !((::llvm::isa<::mlir::AffineMapAttr>(attr))))
76 return emitError() <<
"attribute '" << attrName
77 <<
"' failed to satisfy constraint: AffineMap attribute";
78 return ::mlir::success();
80static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops1(
81 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
82 return __mlir_ods_local_attr_constraint_Ops1(attr, attrName, [op]() {
83 return op->emitOpError();
87static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops2(
88 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
89 if (attr && !(((::llvm::isa<::mlir::IntegerAttr>(attr))) && ((::llvm::isa<::mlir::IndexType>(::llvm::cast<::mlir::IntegerAttr>(attr).getType())))))
90 return emitError() <<
"attribute '" << attrName
91 <<
"' failed to satisfy constraint: index attribute";
92 return ::mlir::success();
94static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops2(
95 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
96 return __mlir_ods_local_attr_constraint_Ops2(attr, attrName, [op]() {
97 return op->emitOpError();
101static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops3(
102 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
103 if (attr && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(attr))))
104 return emitError() <<
"attribute '" << attrName
105 <<
"' failed to satisfy constraint: flat symbol reference attribute";
106 return ::mlir::success();
108static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops3(
109 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
110 return __mlir_ods_local_attr_constraint_Ops3(attr, attrName, [op]() {
111 return op->emitOpError();
115static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops4(
116 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
117 if (attr && !((::llvm::isa<::mlir::StringAttr>(attr))))
118 return emitError() <<
"attribute '" << attrName
119 <<
"' failed to satisfy constraint: string attribute";
120 return ::mlir::success();
122static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops4(
123 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
124 return __mlir_ods_local_attr_constraint_Ops4(attr, attrName, [op]() {
125 return op->emitOpError();
129static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops5(
130 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
131 if (attr && !(((::llvm::isa<::mlir::TypeAttr>(attr))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(attr).getValue()))) && ((
::llzk::isValidConstReadType(::llvm::cast<::mlir::TypeAttr>(attr).getValue())))))
132 return emitError() <<
"attribute '" << attrName
133 <<
"' failed to satisfy constraint: type attribute of integral, felt, or typevar type";
134 return ::mlir::success();
136static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops5(
137 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
138 return __mlir_ods_local_attr_constraint_Ops5(attr, attrName, [op]() {
139 return op->emitOpError();
143static ::llvm::LogicalResult __mlir_ods_local_region_constraint_Ops1(
144 ::mlir::Operation *op, ::mlir::Region ®ion, ::llvm::StringRef regionName,
145 unsigned regionIndex) {
146 if (!((::llvm::hasNItems(region, 1)))) {
147 return op->emitOpError(
"region #") << regionIndex
148 << (regionName.empty() ?
" " :
" ('" + regionName +
"') ")
149 <<
"failed to verify constraint: region with 1 blocks";
151 return ::mlir::success();
166 bool isVariadic[] = {
true};
167 int prevVariadicCount = 0;
168 for (
unsigned i = 0; i < index; ++i)
169 if (isVariadic[i]) ++prevVariadicCount;
173 int variadicSize = (odsOperandsSize - 0) / 1;
178 int start = index + (variadicSize - 1) * prevVariadicCount;
179 int size = isVariadic[index] ? variadicSize : 1;
180 return {start, size};
185 return attr.getValue();
190 return attr.getValue();
198 if (!tblgen_map)
return emitError(loc,
"'poly.applymap' op ""requires attribute 'map'");
200 if (!tblgen_numDims)
return emitError(loc,
"'poly.applymap' op ""requires attribute 'numDims'");
202 if (tblgen_map && !((::llvm::isa<::mlir::AffineMapAttr>(tblgen_map))))
203 return emitError(loc,
"'poly.applymap' op ""attribute 'map' failed to satisfy constraint: AffineMap attribute");
205 if (tblgen_numDims && !(((::llvm::isa<::mlir::IntegerAttr>(tblgen_numDims))) && ((::llvm::isa<::mlir::IndexType>(::llvm::cast<::mlir::IntegerAttr>(tblgen_numDims).getType())))))
206 return emitError(loc,
"'poly.applymap' op ""attribute 'numDims' failed to satisfy constraint: index attribute");
207 return ::mlir::success();
211 bool isVariadic[] = {
true};
212 int prevVariadicCount = 0;
213 for (
unsigned i = 0; i < index; ++i)
214 if (isVariadic[i]) ++prevVariadicCount;
218 int variadicSize = (getOperation()->getNumOperands() - 0) / 1;
223 int start = index + (variadicSize - 1) * prevVariadicCount;
224 int size = isVariadic[index] ? variadicSize : 1;
225 return {start, size};
230 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
235 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
237 emitError() <<
"expected DictionaryAttr to set properties";
238 return ::mlir::failure();
242 auto &propStorage = prop.
map;
243 auto attr = dict.get(
"map");
245 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
247 propStorage = convertedAttr;
249 emitError() <<
"Invalid attribute `map` in property conversion: " << attr;
250 return ::mlir::failure();
256 auto &propStorage = prop.
numDims;
257 auto attr = dict.get(
"numDims");
259 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
261 propStorage = convertedAttr;
263 emitError() <<
"Invalid attribute `numDims` in property conversion: " << attr;
264 return ::mlir::failure();
268 return ::mlir::success();
272 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
273 ::mlir::Builder odsBuilder{ctx};
276 const auto &propStorage = prop.
map;
278 attrs.push_back(odsBuilder.getNamedAttr(
"map",
283 const auto &propStorage = prop.
numDims;
285 attrs.push_back(odsBuilder.getNamedAttr(
"numDims",
290 return odsBuilder.getDictionaryAttr(attrs);
295 return llvm::hash_combine(
296 llvm::hash_value(prop.
map.getAsOpaquePointer()),
297 llvm::hash_value(prop.
numDims.getAsOpaquePointer()));
304 if (name ==
"numDims")
311 prop.
map = ::llvm::dyn_cast_or_null<std::remove_reference_t<
decltype(prop.
map)>>(value);
315 if (name ==
"numDims") {
316 prop.
numDims = ::llvm::dyn_cast_or_null<std::remove_reference_t<
decltype(prop.
numDims)>>(value);
322 if (prop.
map) attrs.append(
"map", prop.
map);
327::llvm::LogicalResult
ApplyMapOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
330 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(attr,
"map", emitError)))
331 return ::mlir::failure();
336 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops2(attr,
"numDims", emitError)))
337 return ::mlir::failure();
339 return ::mlir::success();
343 auto &prop = state.getOrAddProperties<
Properties>(); (void)prop;
344 if (::mlir::failed(reader.readAttribute(prop.
map)))
345 return ::mlir::failure();
347 if (::mlir::failed(reader.readAttribute(prop.
numDims)))
348 return ::mlir::failure();
349 return ::mlir::success();
353 auto &prop = getProperties(); (void)prop;
354 writer.writeAttribute(prop.
map);
355 writer.writeAttribute(prop.
numDims);
360 return attr.getValue();
365 return attr.getValue();
369 getProperties().map = ::mlir::AffineMapAttr::get(attrValue);
373 getProperties().numDims = ::mlir::Builder((*this)->getContext()).getIntegerAttr(::mlir::Builder((*this)->getContext()).getIndexType(), attrValue);
376void ApplyMapOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::AffineMapAttr map, ::mlir::ValueRange mapOperands) {
377 odsState.addOperands(mapOperands);
380 props.
setNumDims(odsBuilder.getIntegerAttr(odsBuilder.getIndexType(),
381 map.getAffineMap().getNumDims()));
382 odsState.addTypes(odsBuilder.getIndexType());
386void ApplyMapOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::AffineMap map, ::mlir::ValueRange mapOperands) {
387 build(odsBuilder, odsState, ::mlir::AffineMapAttr::get(map), mapOperands);
391void ApplyMapOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::AffineExpr expr, ::mlir::ValueRange mapOperands) {
392 auto map = ::mlir::AffineMap::inferFromExprList({expr}, odsBuilder.getContext()).front();
393 build(odsBuilder, odsState, map, mapOperands);
398 auto tblgen_map = getProperties().map; (void)tblgen_map;
399 if (!tblgen_map)
return emitOpError(
"requires attribute 'map'");
400 auto tblgen_numDims = getProperties().numDims; (void)tblgen_numDims;
401 if (!tblgen_numDims)
return emitOpError(
"requires attribute 'numDims'");
403 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(*
this, tblgen_map,
"map")))
404 return ::mlir::failure();
406 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops2(*
this, tblgen_numDims,
"numDims")))
407 return ::mlir::failure();
409 unsigned index = 0; (void)index;
412 for (
auto v : valueGroup0) {
413 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*
this, v.getType(),
"operand", index++)))
414 return ::mlir::failure();
418 unsigned index = 0; (void)index;
421 for (
auto v : valueGroup0) {
422 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops2(*
this, v.getType(),
"result", index++)))
423 return ::mlir::failure();
426 return ::mlir::success();
431 return ::mlir::success();
432 return ::mlir::failure();
435::llvm::LogicalResult
ApplyMapOp::inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes) {
436 inferredReturnTypes.resize(1);
437 ::mlir::Builder odsBuilder(context);
438 ::mlir::Type odsInferredType0 = odsBuilder.getIndexType();
439 inferredReturnTypes[0] = odsInferredType0;
440 return ::mlir::success();
443::mlir::ParseResult
ApplyMapOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
444 ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> mapOperandsOperands;
445 ::llvm::SMLoc mapOperandsOperandsLoc;
446 (void)mapOperandsOperandsLoc;
447 ::mlir::IntegerAttr numDimsAttr;
448 ::mlir::AffineMapAttr mapAttr;
450 mapOperandsOperandsLoc = parser.getCurrentLocation();
452 if (odsResult) return ::mlir::failure();
456 if (parser.parseCustomAttributeWithFallback(mapAttr, parser.getBuilder().getIndexType())) {
457 return ::mlir::failure();
461 auto loc = parser.getCurrentLocation();(void)loc;
462 if (parser.parseOptionalAttrDict(result.attributes))
463 return ::mlir::failure();
465 return parser.emitError(loc) <<
"'" << result.name.getStringRef() <<
"' op ";
467 return ::mlir::failure();
469 ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType();
470 result.addTypes(odsBuildableType0);
471 if (parser.resolveOperands(mapOperandsOperands, odsBuildableType0, mapOperandsOperandsLoc, result.operands))
472 return ::mlir::failure();
473 return ::mlir::success();
480 _odsPrinter.printAttributeWithoutType(
getMapAttr());
481 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
482 elidedAttrs.push_back(
"numDims");
483 elidedAttrs.push_back(
"map");
484 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
487void ApplyMapOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
495namespace polymorphic {
506 return attr.getValue();
514 if (!tblgen_const_name)
return emitError(loc,
"'poly.read_const' op ""requires attribute 'const_name'");
516 if (tblgen_const_name && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(tblgen_const_name))))
517 return emitError(loc,
"'poly.read_const' op ""attribute 'const_name' failed to satisfy constraint: flat symbol reference attribute");
518 return ::mlir::success();
522 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
524 emitError() <<
"expected DictionaryAttr to set properties";
525 return ::mlir::failure();
530 auto attr = dict.get(
"const_name");
532 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
534 propStorage = convertedAttr;
536 emitError() <<
"Invalid attribute `const_name` in property conversion: " << attr;
537 return ::mlir::failure();
541 return ::mlir::success();
545 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
546 ::mlir::Builder odsBuilder{ctx};
551 attrs.push_back(odsBuilder.getNamedAttr(
"const_name",
556 return odsBuilder.getDictionaryAttr(attrs);
561 return llvm::hash_combine(
562 llvm::hash_value(prop.
const_name.getAsOpaquePointer()));
566 if (name ==
"const_name")
572 if (name ==
"const_name") {
573 prop.
const_name = ::llvm::dyn_cast_or_null<std::remove_reference_t<
decltype(prop.
const_name)>>(value);
582::llvm::LogicalResult
ConstReadOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
585 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops3(attr,
"const_name", emitError)))
586 return ::mlir::failure();
588 return ::mlir::success();
592 auto &prop = state.getOrAddProperties<
Properties>(); (void)prop;
593 if (::mlir::failed(reader.readAttribute(prop.
const_name)))
594 return ::mlir::failure();
595 return ::mlir::success();
599 auto &prop = getProperties(); (void)prop;
605 return attr.getValue();
609 getProperties().const_name = ::mlir::SymbolRefAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
612void ConstReadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type val, ::mlir::FlatSymbolRefAttr const_name) {
613 odsState.getOrAddProperties<
Properties>().const_name = const_name;
614 odsState.addTypes(val);
617void ConstReadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr const_name) {
618 odsState.getOrAddProperties<
Properties>().const_name = const_name;
619 assert(resultTypes.size() == 1u &&
"mismatched number of results");
620 odsState.addTypes(resultTypes);
623void ConstReadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type val, ::llvm::StringRef const_name) {
624 odsState.getOrAddProperties<
Properties>().const_name = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), const_name);
625 odsState.addTypes(val);
628void ConstReadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef const_name) {
629 odsState.getOrAddProperties<
Properties>().const_name = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), const_name);
630 assert(resultTypes.size() == 1u &&
"mismatched number of results");
631 odsState.addTypes(resultTypes);
634void ConstReadOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
635 assert(operands.size() == 0u &&
"mismatched number of parameters");
636 odsState.addOperands(operands);
637 odsState.addAttributes(attributes);
638 assert(resultTypes.size() == 1u &&
"mismatched number of return types");
639 odsState.addTypes(resultTypes);
641 if (!attributes.empty()) {
642 ::mlir::OpaqueProperties properties =
644 std::optional<::mlir::RegisteredOperationName> info =
645 odsState.name.getRegisteredInfo();
646 if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
647 odsState.attributes.getDictionary(odsState.getContext()),
nullptr)))
648 ::llvm::report_fatal_error(
"Property conversion failed.");
653 auto tblgen_const_name = getProperties().const_name; (void)tblgen_const_name;
654 if (!tblgen_const_name)
return emitOpError(
"requires attribute 'const_name'");
656 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops3(*
this, tblgen_const_name,
"const_name")))
657 return ::mlir::failure();
659 unsigned index = 0; (void)index;
662 for (
auto v : valueGroup0) {
663 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops3(*
this, v.getType(),
"result", index++)))
664 return ::mlir::failure();
667 return ::mlir::success();
675 ::mlir::FlatSymbolRefAttr const_nameAttr;
676 ::mlir::Type valRawType{};
677 ::llvm::ArrayRef<::mlir::Type> valTypes(&valRawType, 1);
679 if (parser.parseCustomAttributeWithFallback(const_nameAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
680 return ::mlir::failure();
683 if (parser.parseColon())
684 return ::mlir::failure();
688 if (parser.parseCustomTypeWithFallback(type))
689 return ::mlir::failure();
693 auto loc = parser.getCurrentLocation();(void)loc;
694 if (parser.parseOptionalAttrDict(result.attributes))
695 return ::mlir::failure();
697 return parser.emitError(loc) <<
"'" << result.name.getStringRef() <<
"' op ";
699 return ::mlir::failure();
701 result.addTypes(valTypes);
702 return ::mlir::success();
708 _odsPrinter <<
' ' <<
":";
711 auto type =
getVal().getType();
712 if (
auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
713 _odsPrinter.printStrippedAttrOrType(validType);
717 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
718 elidedAttrs.push_back(
"const_name");
719 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
722void ConstReadOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
730namespace polymorphic {
741 return attr.getValue();
749 if (!tblgen_sym_name)
return emitError(loc,
"'poly.expr' op ""requires attribute 'sym_name'");
751 if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name))))
752 return emitError(loc,
"'poly.expr' op ""attribute 'sym_name' failed to satisfy constraint: string attribute");
753 return ::mlir::success();
757 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
759 emitError() <<
"expected DictionaryAttr to set properties";
760 return ::mlir::failure();
765 auto attr = dict.get(
"sym_name");
767 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
769 propStorage = convertedAttr;
771 emitError() <<
"Invalid attribute `sym_name` in property conversion: " << attr;
772 return ::mlir::failure();
776 return ::mlir::success();
780 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
781 ::mlir::Builder odsBuilder{ctx};
784 const auto &propStorage = prop.
sym_name;
786 attrs.push_back(odsBuilder.getNamedAttr(
"sym_name",
791 return odsBuilder.getDictionaryAttr(attrs);
796 return llvm::hash_combine(
797 llvm::hash_value(prop.
sym_name.getAsOpaquePointer()));
801 if (name ==
"sym_name")
807 if (name ==
"sym_name") {
808 prop.
sym_name = ::llvm::dyn_cast_or_null<std::remove_reference_t<
decltype(prop.
sym_name)>>(value);
820 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops4(attr,
"sym_name", emitError)))
821 return ::mlir::failure();
823 return ::mlir::success();
827 auto &prop = state.getOrAddProperties<
Properties>(); (void)prop;
828 if (::mlir::failed(reader.readAttribute(prop.
sym_name)))
829 return ::mlir::failure();
830 return ::mlir::success();
834 auto &prop = getProperties(); (void)prop;
835 writer.writeAttribute(prop.
sym_name);
840 return attr.getValue();
844 getProperties().sym_name = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue);
847void TemplateExprOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name) {
848 odsState.getOrAddProperties<
Properties>().sym_name = sym_name;
849 (void)odsState.addRegion();
852void TemplateExprOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name) {
853 odsState.getOrAddProperties<
Properties>().sym_name = sym_name;
854 (void)odsState.addRegion();
855 assert(resultTypes.size() == 0u &&
"mismatched number of results");
856 odsState.addTypes(resultTypes);
859void TemplateExprOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name) {
860 odsState.getOrAddProperties<
Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
861 (void)odsState.addRegion();
864void TemplateExprOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name) {
865 odsState.getOrAddProperties<
Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
866 (void)odsState.addRegion();
867 assert(resultTypes.size() == 0u &&
"mismatched number of results");
868 odsState.addTypes(resultTypes);
871void TemplateExprOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
872 assert(operands.size() == 0u &&
"mismatched number of parameters");
873 odsState.addOperands(operands);
874 odsState.addAttributes(attributes);
875 for (
unsigned i = 0; i != 1; ++i)
876 (
void)odsState.addRegion();
877 assert(resultTypes.size() == 0u &&
"mismatched number of return types");
878 odsState.addTypes(resultTypes);
880 if (!attributes.empty()) {
881 ::mlir::OpaqueProperties properties =
883 std::optional<::mlir::RegisteredOperationName> info =
884 odsState.name.getRegisteredInfo();
885 if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
886 odsState.attributes.getDictionary(odsState.getContext()),
nullptr)))
887 ::llvm::report_fatal_error(
"Property conversion failed.");
892 auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
893 if (!tblgen_sym_name)
return emitOpError(
"requires attribute 'sym_name'");
895 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops4(*
this, tblgen_sym_name,
"sym_name")))
896 return ::mlir::failure();
898 unsigned index = 0; (void)index;
900 for (
auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0)))
901 if (::mlir::failed(__mlir_ods_local_region_constraint_Ops1(*
this, region,
"initializerRegion", index++)))
902 return ::mlir::failure();
904 return ::mlir::success();
912 ::mlir::StringAttr sym_nameAttr;
913 std::unique_ptr<::mlir::Region> initializerRegionRegion = std::make_unique<::mlir::Region>();
915 if (parser.parseSymbolName(sym_nameAttr))
916 return ::mlir::failure();
919 if (parser.parseRegion(*initializerRegionRegion))
920 return ::mlir::failure();
922 if (initializerRegionRegion->empty()) initializerRegionRegion->emplaceBlock();
924 auto loc = parser.getCurrentLocation();(void)loc;
925 if (parser.parseOptionalAttrDict(result.attributes))
926 return ::mlir::failure();
928 return parser.emitError(loc) <<
"'" << result.name.getStringRef() <<
"' op ";
930 return ::mlir::failure();
932 result.addRegion(std::move(initializerRegionRegion));
933 return ::mlir::success();
941 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
942 elidedAttrs.push_back(
"sym_name");
943 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
951namespace polymorphic {
962 return attr.getValue();
970 if (!tblgen_sym_name)
return emitError(loc,
"'poly.template' op ""requires attribute 'sym_name'");
972 if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name))))
973 return emitError(loc,
"'poly.template' op ""attribute 'sym_name' failed to satisfy constraint: string attribute");
974 return ::mlir::success();
978 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
980 emitError() <<
"expected DictionaryAttr to set properties";
981 return ::mlir::failure();
986 auto attr = dict.get(
"sym_name");
988 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
990 propStorage = convertedAttr;
992 emitError() <<
"Invalid attribute `sym_name` in property conversion: " << attr;
993 return ::mlir::failure();
997 return ::mlir::success();
1001 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
1002 ::mlir::Builder odsBuilder{ctx};
1005 const auto &propStorage = prop.
sym_name;
1007 attrs.push_back(odsBuilder.getNamedAttr(
"sym_name",
1012 return odsBuilder.getDictionaryAttr(attrs);
1017 return llvm::hash_combine(
1018 llvm::hash_value(prop.
sym_name.getAsOpaquePointer()));
1022 if (name ==
"sym_name")
1024 return std::nullopt;
1028 if (name ==
"sym_name") {
1029 prop.
sym_name = ::llvm::dyn_cast_or_null<std::remove_reference_t<
decltype(prop.
sym_name)>>(value);
1038::llvm::LogicalResult
TemplateOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
1041 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops4(attr,
"sym_name", emitError)))
1042 return ::mlir::failure();
1044 return ::mlir::success();
1048 auto &prop = state.getOrAddProperties<
Properties>(); (void)prop;
1049 if (::mlir::failed(reader.readAttribute(prop.
sym_name)))
1050 return ::mlir::failure();
1051 return ::mlir::success();
1055 auto &prop = getProperties(); (void)prop;
1056 writer.writeAttribute(prop.
sym_name);
1061 return attr.getValue();
1065 getProperties().sym_name = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue);
1068void TemplateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name) {
1069 odsState.getOrAddProperties<
Properties>().sym_name = sym_name;
1070 (void)odsState.addRegion();
1073void TemplateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name) {
1074 odsState.getOrAddProperties<
Properties>().sym_name = sym_name;
1075 (void)odsState.addRegion();
1076 assert(resultTypes.size() == 0u &&
"mismatched number of results");
1077 odsState.addTypes(resultTypes);
1080void TemplateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name) {
1081 odsState.getOrAddProperties<
Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
1082 (void)odsState.addRegion();
1085void TemplateOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name) {
1086 odsState.getOrAddProperties<
Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
1087 (void)odsState.addRegion();
1088 assert(resultTypes.size() == 0u &&
"mismatched number of results");
1089 odsState.addTypes(resultTypes);
1092void TemplateOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
1093 assert(operands.size() == 0u &&
"mismatched number of parameters");
1094 odsState.addOperands(operands);
1095 odsState.addAttributes(attributes);
1096 for (
unsigned i = 0; i != 1; ++i)
1097 (
void)odsState.addRegion();
1098 assert(resultTypes.size() == 0u &&
"mismatched number of return types");
1099 odsState.addTypes(resultTypes);
1101 if (!attributes.empty()) {
1102 ::mlir::OpaqueProperties properties =
1104 std::optional<::mlir::RegisteredOperationName> info =
1105 odsState.name.getRegisteredInfo();
1106 if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
1107 odsState.attributes.getDictionary(odsState.getContext()),
nullptr)))
1108 ::llvm::report_fatal_error(
"Property conversion failed.");
1113 auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
1114 if (!tblgen_sym_name)
return emitOpError(
"requires attribute 'sym_name'");
1116 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops4(*
this, tblgen_sym_name,
"sym_name")))
1117 return ::mlir::failure();
1119 unsigned index = 0; (void)index;
1121 for (
auto ®ion : ::llvm::MutableArrayRef((*this)->getRegion(0)))
1122 if (::mlir::failed(__mlir_ods_local_region_constraint_Ops1(*
this, region,
"bodyRegion", index++)))
1123 return ::mlir::failure();
1125 return ::mlir::success();
1130 return ::mlir::success();
1131 return ::mlir::failure();
1135 ::mlir::StringAttr sym_nameAttr;
1136 std::unique_ptr<::mlir::Region> bodyRegionRegion = std::make_unique<::mlir::Region>();
1138 if (parser.parseSymbolName(sym_nameAttr))
1139 return ::mlir::failure();
1142 if (parser.parseRegion(*bodyRegionRegion))
1143 return ::mlir::failure();
1145 if (bodyRegionRegion->empty()) bodyRegionRegion->emplaceBlock();
1147 auto loc = parser.getCurrentLocation();(void)loc;
1148 if (parser.parseOptionalAttrDict(result.attributes))
1149 return ::mlir::failure();
1151 return parser.emitError(loc) <<
"'" << result.name.getStringRef() <<
"' op ";
1153 return ::mlir::failure();
1155 result.addRegion(std::move(bodyRegionRegion));
1156 return ::mlir::success();
1164 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
1165 elidedAttrs.push_back(
"sym_name");
1166 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
1174namespace polymorphic {
1185 return attr.getValue();
1190 return attr ? ::std::optional<::mlir::Type>(::llvm::cast<::mlir::Type>(attr.getValue())) : (::std::nullopt);
1198 if (!tblgen_sym_name)
return emitError(loc,
"'poly.param' op ""requires attribute 'sym_name'");
1201 if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name))))
1202 return emitError(loc,
"'poly.param' op ""attribute 'sym_name' failed to satisfy constraint: string attribute");
1204 if (tblgen_type_opt && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_type_opt))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(tblgen_type_opt).getValue()))) && ((
::llzk::isValidConstReadType(::llvm::cast<::mlir::TypeAttr>(tblgen_type_opt).getValue())))))
1205 return emitError(loc,
"'poly.param' op ""attribute 'type_opt' failed to satisfy constraint: type attribute of integral, felt, or typevar type");
1206 return ::mlir::success();
1210 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
1212 emitError() <<
"expected DictionaryAttr to set properties";
1213 return ::mlir::failure();
1218 auto attr = dict.get(
"sym_name");
1220 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
1221 if (convertedAttr) {
1222 propStorage = convertedAttr;
1224 emitError() <<
"Invalid attribute `sym_name` in property conversion: " << attr;
1225 return ::mlir::failure();
1232 auto attr = dict.get(
"type_opt");
1234 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
1235 if (convertedAttr) {
1236 propStorage = convertedAttr;
1238 emitError() <<
"Invalid attribute `type_opt` in property conversion: " << attr;
1239 return ::mlir::failure();
1243 return ::mlir::success();
1247 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
1248 ::mlir::Builder odsBuilder{ctx};
1251 const auto &propStorage = prop.
sym_name;
1253 attrs.push_back(odsBuilder.getNamedAttr(
"sym_name",
1258 const auto &propStorage = prop.
type_opt;
1260 attrs.push_back(odsBuilder.getNamedAttr(
"type_opt",
1265 return odsBuilder.getDictionaryAttr(attrs);
1270 return llvm::hash_combine(
1271 llvm::hash_value(prop.
sym_name.getAsOpaquePointer()),
1272 llvm::hash_value(prop.
type_opt.getAsOpaquePointer()));
1276 if (name ==
"sym_name")
1279 if (name ==
"type_opt")
1281 return std::nullopt;
1285 if (name ==
"sym_name") {
1286 prop.
sym_name = ::llvm::dyn_cast_or_null<std::remove_reference_t<
decltype(prop.
sym_name)>>(value);
1290 if (name ==
"type_opt") {
1291 prop.
type_opt = ::llvm::dyn_cast_or_null<std::remove_reference_t<
decltype(prop.
type_opt)>>(value);
1305 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops4(attr,
"sym_name", emitError)))
1306 return ::mlir::failure();
1311 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops5(attr,
"type_opt", emitError)))
1312 return ::mlir::failure();
1314 return ::mlir::success();
1318 auto &prop = state.getOrAddProperties<
Properties>(); (void)prop;
1319 if (::mlir::failed(reader.readAttribute(prop.
sym_name)))
1320 return ::mlir::failure();
1322 if (::mlir::failed(reader.readOptionalAttribute(prop.
type_opt)))
1323 return ::mlir::failure();
1324 return ::mlir::success();
1328 auto &prop = getProperties(); (void)prop;
1329 writer.writeAttribute(prop.
sym_name);
1331 writer.writeOptionalAttribute(prop.
type_opt);
1336 return attr.getValue();
1341 return attr ? ::std::optional<::mlir::Type>(::llvm::cast<::mlir::Type>(attr.getValue())) : (::std::nullopt);
1345 getProperties().sym_name = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue);
1349 auto &odsProp = getProperties().type_opt;
1351 odsProp = ::mlir::TypeAttr::get(*attrValue);
1356void TemplateParamOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type_opt) {
1357 odsState.getOrAddProperties<
Properties>().sym_name = sym_name;
1359 odsState.getOrAddProperties<
Properties>().type_opt = type_opt;
1363void TemplateParamOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type_opt) {
1364 odsState.getOrAddProperties<
Properties>().sym_name = sym_name;
1366 odsState.getOrAddProperties<
Properties>().type_opt = type_opt;
1368 assert(resultTypes.size() == 0u &&
"mismatched number of results");
1369 odsState.addTypes(resultTypes);
1372void TemplateParamOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, ::mlir::TypeAttr type_opt) {
1373 odsState.getOrAddProperties<
Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
1375 odsState.getOrAddProperties<
Properties>().type_opt = type_opt;
1379void TemplateParamOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::TypeAttr type_opt) {
1380 odsState.getOrAddProperties<
Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
1382 odsState.getOrAddProperties<
Properties>().type_opt = type_opt;
1384 assert(resultTypes.size() == 0u &&
"mismatched number of results");
1385 odsState.addTypes(resultTypes);
1388void TemplateParamOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
1389 assert(operands.size() == 0u &&
"mismatched number of parameters");
1390 odsState.addOperands(operands);
1391 odsState.addAttributes(attributes);
1392 assert(resultTypes.size() == 0u &&
"mismatched number of return types");
1393 odsState.addTypes(resultTypes);
1395 if (!attributes.empty()) {
1396 ::mlir::OpaqueProperties properties =
1398 std::optional<::mlir::RegisteredOperationName> info =
1399 odsState.name.getRegisteredInfo();
1400 if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
1401 odsState.attributes.getDictionary(odsState.getContext()),
nullptr)))
1402 ::llvm::report_fatal_error(
"Property conversion failed.");
1407 auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
1408 if (!tblgen_sym_name)
return emitOpError(
"requires attribute 'sym_name'");
1409 auto tblgen_type_opt = getProperties().type_opt; (void)tblgen_type_opt;
1411 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops4(*
this, tblgen_sym_name,
"sym_name")))
1412 return ::mlir::failure();
1414 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops5(*
this, tblgen_type_opt,
"type_opt")))
1415 return ::mlir::failure();
1416 return ::mlir::success();
1424 ::mlir::StringAttr sym_nameAttr;
1425 ::mlir::TypeAttr type_optAttr;
1427 if (parser.parseSymbolName(sym_nameAttr))
1428 return ::mlir::failure();
1430 if (::mlir::succeeded(parser.parseOptionalColon())) {
1432 if (parser.parseCustomAttributeWithFallback(type_optAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
1433 return ::mlir::failure();
1438 auto loc = parser.getCurrentLocation();(void)loc;
1439 if (parser.parseOptionalAttrDict(result.attributes))
1440 return ::mlir::failure();
1442 return parser.emitError(loc) <<
"'" << result.name.getStringRef() <<
"' op ";
1444 return ::mlir::failure();
1446 return ::mlir::success();
1453 _odsPrinter <<
' ' <<
":";
1457 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
1458 elidedAttrs.push_back(
"sym_name");
1459 elidedAttrs.push_back(
"type_opt");
1460 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
1468namespace polymorphic {
1479 return ::mlir::success();
1482void UnifiableCastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value input) {
1483 odsState.addOperands(input);
1484 odsState.addTypes(result);
1487void UnifiableCastOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input) {
1488 odsState.addOperands(input);
1489 assert(resultTypes.size() == 1u &&
"mismatched number of results");
1490 odsState.addTypes(resultTypes);
1493void UnifiableCastOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
1494 assert(operands.size() == 1u &&
"mismatched number of parameters");
1495 odsState.addOperands(operands);
1496 odsState.addAttributes(attributes);
1497 assert(resultTypes.size() == 1u &&
"mismatched number of return types");
1498 odsState.addTypes(resultTypes);
1503 unsigned index = 0; (void)index;
1506 for (
auto v : valueGroup0) {
1507 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops4(*
this, v.getType(),
"operand", index++)))
1508 return ::mlir::failure();
1512 unsigned index = 0; (void)index;
1515 for (
auto v : valueGroup0) {
1516 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops4(*
this, v.getType(),
"result", index++)))
1517 return ::mlir::failure();
1520 return ::mlir::success();
1525 return ::mlir::success();
1526 return ::mlir::failure();
1530 ::mlir::OpAsmParser::UnresolvedOperand inputRawOperand{};
1531 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> inputOperands(&inputRawOperand, 1); ::llvm::SMLoc inputOperandsLoc;
1532 (void)inputOperandsLoc;
1533 ::llvm::ArrayRef<::mlir::Type> inputTypes;
1534 ::llvm::ArrayRef<::mlir::Type> allResultTypes;
1536 inputOperandsLoc = parser.getCurrentLocation();
1537 if (parser.parseOperand(inputRawOperand))
1538 return ::mlir::failure();
1539 if (parser.parseColon())
1540 return ::mlir::failure();
1542 ::mlir::FunctionType input__allResult_functionType;
1543 if (parser.parseType(input__allResult_functionType))
1544 return ::mlir::failure();
1545 inputTypes = input__allResult_functionType.getInputs();
1546 allResultTypes = input__allResult_functionType.getResults();
1548 auto loc = parser.getCurrentLocation();(void)loc;
1549 if (parser.parseOptionalAttrDict(result.attributes))
1550 return ::mlir::failure();
1552 result.addTypes(allResultTypes);
1553 if (parser.resolveOperands(inputOperands, inputTypes, inputOperandsLoc, result.operands))
1554 return ::mlir::failure();
1555 return ::mlir::success();
1561 _odsPrinter <<
' ' <<
":";
1563 _odsPrinter.printFunctionalType(::llvm::ArrayRef<::mlir::Type>(
getInput().getType()), getOperation()->getResultTypes());
1564 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
1565 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
1576namespace polymorphic {
1587 return ::mlir::success();
1590void YieldOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value val) {
1591 odsState.addOperands(val);
1594void YieldOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value val) {
1595 odsState.addOperands(val);
1596 assert(resultTypes.size() == 0u &&
"mismatched number of results");
1597 odsState.addTypes(resultTypes);
1600void YieldOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
1601 assert(operands.size() == 1u &&
"mismatched number of parameters");
1602 odsState.addOperands(operands);
1603 odsState.addAttributes(attributes);
1604 assert(resultTypes.size() == 0u &&
"mismatched number of return types");
1605 odsState.addTypes(resultTypes);
1610 unsigned index = 0; (void)index;
1613 for (
auto v : valueGroup0) {
1614 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops3(*
this, v.getType(),
"operand", index++)))
1615 return ::mlir::failure();
1618 return ::mlir::success();
1625::mlir::ParseResult
YieldOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
1626 ::mlir::OpAsmParser::UnresolvedOperand valRawOperand{};
1627 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valOperands(&valRawOperand, 1); ::llvm::SMLoc valOperandsLoc;
1628 (void)valOperandsLoc;
1629 ::mlir::Type valRawType{};
1630 ::llvm::ArrayRef<::mlir::Type> valTypes(&valRawType, 1);
1632 valOperandsLoc = parser.getCurrentLocation();
1633 if (parser.parseOperand(valRawOperand))
1634 return ::mlir::failure();
1635 if (parser.parseColon())
1636 return ::mlir::failure();
1640 if (parser.parseCustomTypeWithFallback(type))
1641 return ::mlir::failure();
1645 auto loc = parser.getCurrentLocation();(void)loc;
1646 if (parser.parseOptionalAttrDict(result.attributes))
1647 return ::mlir::failure();
1649 if (parser.resolveOperands(valOperands, valTypes, valOperandsLoc, result.operands))
1650 return ::mlir::failure();
1651 return ::mlir::success();
1657 _odsPrinter <<
' ' <<
":";
1660 auto type =
getVal().getType();
1661 if (
auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
1662 _odsPrinter.printStrippedAttrOrType(validType);
1664 _odsPrinter << type;
1666 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
1667 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
1671 ::mlir::RegionBranchPoint point) {
1672 return ::mlir::MutableOperandRange(*
this);
ApplyMapOpAdaptor(ApplyMapOp op)
::llvm::LogicalResult verify(::mlir::Location loc)
ApplyMapOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
::mlir::ValueRange getOperands()
::mlir::AffineMapAttr getMapAttr()
::mlir::IntegerAttr getNumDimsAttr()
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index)
::mlir::Operation::result_range getODSResults(unsigned index)
::llvm::APInt getNumDims()
::mlir::Operation::operand_range getMapOperands()
::llvm::LogicalResult verify()
void print(::mlir::OpAsmPrinter &_odsPrinter)
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
::llvm::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location > location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type > &inferredReturnTypes)
::llvm::LogicalResult verifyInvariants()
static llvm::hash_code computePropertiesHash(const Properties &prop)
FoldAdaptor::Properties Properties
::mlir::Operation::operand_range getODSOperands(unsigned index)
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::AffineMapAttr map, ::mlir::ValueRange mapOperands={})
::mlir::StringAttr getMapAttrName()
::mlir::AffineMap getMap()
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
void writeProperties(::mlir::DialectBytecodeWriter &writer)
void setMap(::mlir::AffineMap attrValue)
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
::mlir::StringAttr getNumDimsAttrName()
::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
::mlir::MutableOperandRange getMapOperandsMutable()
::llvm::LogicalResult verifyInvariantsImpl()
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state)
::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect > > &effects)
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
void setNumDims(::llvm::APInt attrValue)
::llvm::LogicalResult verify(::mlir::Location loc)
ConstReadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
ConstReadOpAdaptor(ConstReadOp op)
::mlir::ValueRange getOperands()
void writeProperties(::mlir::DialectBytecodeWriter &writer)
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
void print(::mlir::OpAsmPrinter &_odsPrinter)
FoldAdaptor::Properties Properties
::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
::mlir::TypedValue<::mlir::Type > getVal()
::mlir::StringAttr getConstNameAttrName()
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
::mlir::Operation::result_range getODSResults(unsigned index)
::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
static llvm::hash_code computePropertiesHash(const Properties &prop)
void setConstName(::llvm::StringRef attrValue)
::llvm::LogicalResult verifyInvariantsImpl()
void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect > > &effects)
::mlir::FlatSymbolRefAttr getConstNameAttr()
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type val, ::mlir::FlatSymbolRefAttr const_name)
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state)
::llvm::LogicalResult verifyInvariants()
::llvm::StringRef getConstName()
::llvm::LogicalResult verify(::mlir::Location loc)
TemplateExprOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
TemplateExprOpAdaptor(TemplateExprOp op)
::mlir::ValueRange getOperands()
::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
::mlir::StringAttr getSymNameAttr()
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
::mlir::Region & getInitializerRegion()
static llvm::hash_code computePropertiesHash(const Properties &prop)
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
::llvm::LogicalResult verifyInvariantsImpl()
::llvm::StringRef getSymName()
void setSymName(::llvm::StringRef attrValue)
void writeProperties(::mlir::DialectBytecodeWriter &writer)
::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state)
FoldAdaptor::Properties Properties
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name)
::mlir::StringAttr getSymNameAttrName()
::llvm::LogicalResult verifyInvariants()
void print(::mlir::OpAsmPrinter &_odsPrinter)
TemplateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
::llvm::LogicalResult verify(::mlir::Location loc)
TemplateOpAdaptor(TemplateOp op)
::mlir::ValueRange getOperands()
::mlir::Region & getBodyRegion()
::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
::mlir::StringAttr getSymNameAttrName()
static llvm::hash_code computePropertiesHash(const Properties &prop)
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
void writeProperties(::mlir::DialectBytecodeWriter &writer)
void print(::mlir::OpAsmPrinter &_odsPrinter)
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name)
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
FoldAdaptor::Properties Properties
::mlir::StringAttr getSymNameAttr()
::llvm::LogicalResult verifyInvariantsImpl()
::llvm::LogicalResult verify()
Verify the optional transform-carried name pattern against current parameters.
void setSymName(::llvm::StringRef attrValue)
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state)
::llvm::StringRef getSymName()
::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
::llvm::LogicalResult verifyInvariants()
::llvm::LogicalResult verify(::mlir::Location loc)
TemplateParamOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
TemplateParamOpAdaptor(TemplateParamOp op)
::mlir::ValueRange getOperands()
::llvm::LogicalResult verifyInvariants()
::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
void setSymName(::llvm::StringRef attrValue)
::mlir::StringAttr getTypeOptAttrName()
void setTypeOpt(::std::optional<::mlir::Type > attrValue)
::mlir::TypeAttr getTypeOptAttr()
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type_opt)
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
FoldAdaptor::Properties Properties
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
void writeProperties(::mlir::DialectBytecodeWriter &writer)
::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state)
void print(::mlir::OpAsmPrinter &_odsPrinter)
::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
::mlir::StringAttr getSymNameAttrName()
::mlir::StringAttr getSymNameAttr()
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
::llvm::LogicalResult verifyInvariantsImpl()
::std::optional<::mlir::Type > getTypeOpt()
::llvm::StringRef getSymName()
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
static llvm::hash_code computePropertiesHash(const Properties &prop)
UnifiableCastOpAdaptor(UnifiableCastOp op)
UnifiableCastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs={}, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
::llvm::LogicalResult verify(::mlir::Location loc)
::mlir::ValueRange getOperands()
::llvm::LogicalResult verify()
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value input)
void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect > > &effects)
::mlir::Operation::operand_range getODSOperands(unsigned index)
::mlir::TypedValue<::mlir::Type > getInput()
::llvm::LogicalResult verifyInvariantsImpl()
::llvm::LogicalResult verifyInvariants()
::mlir::Operation::result_range getODSResults(unsigned index)
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
void print(::mlir::OpAsmPrinter &_odsPrinter)
::llvm::LogicalResult verify(::mlir::Location loc)
YieldOpAdaptor(YieldOp op)
YieldOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs={}, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
::mlir::ValueRange getOperands()
::mlir::MutableOperandRange getMutableSuccessorOperands(::mlir::RegionBranchPoint point)
::llvm::LogicalResult verifyInvariantsImpl()
void print(::mlir::OpAsmPrinter &_odsPrinter)
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
::llvm::LogicalResult verifyInvariants()
::mlir::Operation::operand_range getODSOperands(unsigned index)
::mlir::TypedValue<::mlir::Type > getVal()
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value val)
const Properties & getProperties()
::mlir::AffineMap getMap()
::mlir::IntegerAttr getNumDimsAttr()
ApplyMapOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
::mlir::DictionaryAttr odsAttrs
::mlir::AffineMapAttr getMapAttr()
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize)
::llvm::APInt getNumDims()
::mlir::RegionRange odsRegions
::std::optional<::mlir::OperationName > odsOpName
const Properties & getProperties()
::mlir::FlatSymbolRefAttr getConstNameAttr()
ConstReadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
::std::optional<::mlir::OperationName > odsOpName
::mlir::RegionRange odsRegions
::llvm::StringRef getConstName()
::mlir::DictionaryAttr odsAttrs
const Properties & getProperties()
TemplateExprOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
::std::optional<::mlir::OperationName > odsOpName
::mlir::RegionRange odsRegions
::mlir::RegionRange getRegions()
::mlir::DictionaryAttr odsAttrs
::llvm::StringRef getSymName()
::mlir::StringAttr getSymNameAttr()
TemplateOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
::mlir::RegionRange odsRegions
const Properties & getProperties()
::mlir::StringAttr getSymNameAttr()
::mlir::DictionaryAttr odsAttrs
::std::optional<::mlir::OperationName > odsOpName
::mlir::RegionRange getRegions()
::llvm::StringRef getSymName()
::std::optional<::mlir::OperationName > odsOpName
::llvm::StringRef getSymName()
::mlir::TypeAttr getTypeOptAttr()
::std::optional<::mlir::Type > getTypeOpt()
TemplateParamOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
::mlir::RegionRange odsRegions
::mlir::StringAttr getSymNameAttr()
const Properties & getProperties()
::mlir::DictionaryAttr odsAttrs
void printDimAndSymbolList(mlir::OpAsmPrinter &printer, mlir::Operation *op, mlir::OperandRange mapOperands, mlir::IntegerAttr numDims)
bool isValidType(Type type)
mlir::ParseResult parseDimAndSymbolList(mlir::OpAsmParser &parser, mlir::SmallVector< mlir::OpAsmParser::UnresolvedOperand, N > &mapOperands, mlir::IntegerAttr &numDims)
bool isValidConstReadType(Type type)
void setMap(const ::mlir::AffineMapAttr &propValue)
void setNumDims(const ::mlir::IntegerAttr &propValue)