29static ::llvm::LogicalResult __mlir_ods_local_type_constraint_Ops1(
30 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
31 unsigned valueIndex) {
33 return op->emitOpError(valueKind) <<
" #" << valueIndex
34 <<
" must be any LLZK type except non-constant types, but got " << type;
36 return ::mlir::success();
39static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops1(
40 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
41 if (attr && !((::llvm::isa<::mlir::StringAttr>(attr))))
42 return emitError() <<
"attribute '" << attrName
43 <<
"' failed to satisfy constraint: string attribute";
44 return ::mlir::success();
46static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops1(
47 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
48 return __mlir_ods_local_attr_constraint_Ops1(attr, attrName, [op]() {
49 return op->emitOpError();
53static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops2(
54 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
55 if (attr && !((::llvm::isa<::mlir::UnitAttr>(attr))))
56 return emitError() <<
"attribute '" << attrName
57 <<
"' failed to satisfy constraint: unit attribute";
58 return ::mlir::success();
60static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops2(
61 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
62 return __mlir_ods_local_attr_constraint_Ops2(attr, attrName, [op]() {
63 return op->emitOpError();
67static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops3(
68 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
69 if (attr && !(((::llvm::isa<::mlir::TypeAttr>(attr))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(attr).getValue()))) && ((
::llzk::isValidGlobalType(::llvm::cast<::mlir::TypeAttr>(attr).getValue())))))
70 return emitError() <<
"attribute '" << attrName
71 <<
"' failed to satisfy constraint: type attribute of any LLZK type except non-constant types";
72 return ::mlir::success();
74static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops3(
75 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
76 return __mlir_ods_local_attr_constraint_Ops3(attr, attrName, [op]() {
77 return op->emitOpError();
81static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops4(
82 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
83 if (attr && !((
true)))
84 return emitError() <<
"attribute '" << attrName
85 <<
"' failed to satisfy constraint: any attribute";
86 return ::mlir::success();
88static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops4(
89 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
90 return __mlir_ods_local_attr_constraint_Ops4(attr, attrName, [op]() {
91 return op->emitOpError();
95static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops5(
96 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
97 if (attr && !((::llvm::isa<::mlir::SymbolRefAttr>(attr))))
98 return emitError() <<
"attribute '" << attrName
99 <<
"' failed to satisfy constraint: symbol reference attribute";
100 return ::mlir::success();
102static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops5(
103 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
104 return __mlir_ods_local_attr_constraint_Ops5(attr, attrName, [op]() {
105 return op->emitOpError();
122 return attr.getValue();
126 auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(
getProperties().constant);
128 attr = ((
false) ? ::mlir::Builder(
odsAttrs.getContext()).getUnitAttr() :
nullptr);
135 return ((
false) ? ::mlir::Builder(
odsAttrs.getContext()).getUnitAttr() :
nullptr) !=
nullptr;
136 return attr !=
nullptr;
141 return ::llvm::cast<::mlir::Type>(attr.getValue());
145 auto attr = ::llvm::dyn_cast_or_null<::mlir::Attribute>(
getProperties().initial_value);
161 if (!tblgen_sym_name)
return emitError(loc,
"'global.def' op ""requires attribute 'sym_name'");
163 if (!tblgen_type)
return emitError(loc,
"'global.def' op ""requires attribute 'type'");
165 if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name))))
166 return emitError(loc,
"'global.def' op ""attribute 'sym_name' failed to satisfy constraint: string attribute");
168 if (tblgen_constant && !((::llvm::isa<::mlir::UnitAttr>(tblgen_constant))))
169 return emitError(loc,
"'global.def' op ""attribute 'constant' failed to satisfy constraint: unit attribute");
171 if (tblgen_type && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_type))) && ((::llvm::isa<::mlir::Type>(::llvm::cast<::mlir::TypeAttr>(tblgen_type).getValue()))) && ((
::llzk::isValidGlobalType(::llvm::cast<::mlir::TypeAttr>(tblgen_type).getValue())))))
172 return emitError(loc,
"'global.def' op ""attribute 'type' failed to satisfy constraint: type attribute of any LLZK type except non-constant types");
174 if (tblgen_initial_value && !((
true)))
175 return emitError(loc,
"'global.def' op ""attribute 'initial_value' failed to satisfy constraint: any attribute");
176 return ::mlir::success();
180 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
182 emitError() <<
"expected DictionaryAttr to set properties";
183 return ::mlir::failure();
188 auto attr = dict.get(
"constant");
190 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
192 propStorage = convertedAttr;
194 emitError() <<
"Invalid attribute `constant` in property conversion: " << attr;
195 return ::mlir::failure();
202 auto attr = dict.get(
"initial_value");
204 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
206 propStorage = convertedAttr;
208 emitError() <<
"Invalid attribute `initial_value` in property conversion: " << attr;
209 return ::mlir::failure();
216 auto attr = dict.get(
"sym_name");
218 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
220 propStorage = convertedAttr;
222 emitError() <<
"Invalid attribute `sym_name` in property conversion: " << attr;
223 return ::mlir::failure();
229 auto &propStorage = prop.
type;
230 auto attr = dict.get(
"type");
232 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
234 propStorage = convertedAttr;
236 emitError() <<
"Invalid attribute `type` in property conversion: " << attr;
237 return ::mlir::failure();
241 return ::mlir::success();
245 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
246 ::mlir::Builder odsBuilder{ctx};
249 const auto &propStorage = prop.
constant;
251 attrs.push_back(odsBuilder.getNamedAttr(
"constant",
258 attrs.push_back(odsBuilder.getNamedAttr(
"initial_value",
263 const auto &propStorage = prop.
sym_name;
265 attrs.push_back(odsBuilder.getNamedAttr(
"sym_name",
270 const auto &propStorage = prop.
type;
272 attrs.push_back(odsBuilder.getNamedAttr(
"type",
277 return odsBuilder.getDictionaryAttr(attrs);
282 return llvm::hash_combine(
283 llvm::hash_value(prop.
constant.getAsOpaquePointer()),
285 llvm::hash_value(prop.
sym_name.getAsOpaquePointer()),
286 llvm::hash_value(prop.
type.getAsOpaquePointer()));
290 if (name ==
"constant")
293 if (name ==
"initial_value")
296 if (name ==
"sym_name")
305 if (name ==
"constant") {
306 prop.
constant = ::llvm::dyn_cast_or_null<std::remove_reference_t<
decltype(prop.
constant)>>(value);
310 if (name ==
"initial_value") {
315 if (name ==
"sym_name") {
316 prop.
sym_name = ::llvm::dyn_cast_or_null<std::remove_reference_t<
decltype(prop.
sym_name)>>(value);
320 if (name ==
"type") {
321 prop.
type = ::llvm::dyn_cast_or_null<std::remove_reference_t<
decltype(prop.
type)>>(value);
333 if (prop.
type) attrs.append(
"type", prop.
type);
336::llvm::LogicalResult
GlobalDefOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
339 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops2(attr,
"constant", emitError)))
340 return ::mlir::failure();
345 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops4(attr,
"initial_value", emitError)))
346 return ::mlir::failure();
351 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(attr,
"sym_name", emitError)))
352 return ::mlir::failure();
357 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops3(attr,
"type", emitError)))
358 return ::mlir::failure();
360 return ::mlir::success();
364 auto &prop = state.getOrAddProperties<
Properties>(); (void)prop;
365 if (::mlir::failed(reader.readOptionalAttribute(prop.
constant)))
366 return ::mlir::failure();
368 if (::mlir::failed(reader.readOptionalAttribute(prop.
initial_value)))
369 return ::mlir::failure();
371 if (::mlir::failed(reader.readAttribute(prop.
sym_name)))
372 return ::mlir::failure();
374 if (::mlir::failed(reader.readAttribute(prop.
type)))
375 return ::mlir::failure();
376 return ::mlir::success();
380 auto &prop = getProperties(); (void)prop;
382 writer.writeOptionalAttribute(prop.
constant);
385 writer.writeAttribute(prop.
sym_name);
386 writer.writeAttribute(prop.
type);
391 return attr.getValue();
397 return ((
false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() :
nullptr) !=
nullptr;
398 return attr !=
nullptr;
403 return ::llvm::cast<::mlir::Type>(attr.getValue());
412 getProperties().sym_name = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue);
416 auto &odsProp = getProperties().constant;
418 odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() :
nullptr);
424 getProperties().type = ::mlir::TypeAttr::get(attrValue);
427void GlobalDefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::UnitAttr constant, ::mlir::TypeAttr type, ::mlir::Attribute initial_value) {
428 odsState.getOrAddProperties<
Properties>().sym_name = sym_name;
430 odsState.getOrAddProperties<
Properties>().constant = constant;
432 odsState.getOrAddProperties<
Properties>().type = type;
434 odsState.getOrAddProperties<
Properties>().initial_value = initial_value;
438void GlobalDefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::UnitAttr constant, ::mlir::TypeAttr type, ::mlir::Attribute initial_value) {
439 odsState.getOrAddProperties<
Properties>().sym_name = sym_name;
441 odsState.getOrAddProperties<
Properties>().constant = constant;
443 odsState.getOrAddProperties<
Properties>().type = type;
445 odsState.getOrAddProperties<
Properties>().initial_value = initial_value;
447 assert(resultTypes.size() == 0u &&
"mismatched number of results");
448 odsState.addTypes(resultTypes);
451void GlobalDefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name,
bool constant, ::mlir::Type type, ::mlir::Attribute initial_value) {
452 odsState.getOrAddProperties<
Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
454 odsState.getOrAddProperties<
Properties>().constant = ((constant) ? odsBuilder.getUnitAttr() :
nullptr);
456 odsState.getOrAddProperties<
Properties>().type = ::mlir::TypeAttr::get(type);
457 odsState.getOrAddProperties<
Properties>().initial_value = initial_value;
460void GlobalDefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name,
bool constant, ::mlir::Type type, ::mlir::Attribute initial_value) {
461 odsState.getOrAddProperties<
Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
463 odsState.getOrAddProperties<
Properties>().constant = ((constant) ? odsBuilder.getUnitAttr() :
nullptr);
465 odsState.getOrAddProperties<
Properties>().type = ::mlir::TypeAttr::get(type);
466 odsState.getOrAddProperties<
Properties>().initial_value = initial_value;
467 assert(resultTypes.size() == 0u &&
"mismatched number of results");
468 odsState.addTypes(resultTypes);
471void GlobalDefOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
472 assert(operands.size() == 0u &&
"mismatched number of parameters");
473 odsState.addOperands(operands);
474 odsState.addAttributes(attributes);
475 assert(resultTypes.size() == 0u &&
"mismatched number of return types");
476 odsState.addTypes(resultTypes);
478 if (!attributes.empty()) {
479 ::mlir::OpaqueProperties properties =
481 std::optional<::mlir::RegisteredOperationName> info =
482 odsState.name.getRegisteredInfo();
483 if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
484 odsState.attributes.getDictionary(odsState.getContext()),
nullptr)))
485 ::llvm::report_fatal_error(
"Property conversion failed.");
490 ::mlir::Builder odsBuilder(opName.getContext());
496 auto tblgen_constant = getProperties().constant; (void)tblgen_constant;
497 auto tblgen_initial_value = getProperties().initial_value; (void)tblgen_initial_value;
498 auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
499 if (!tblgen_sym_name)
return emitOpError(
"requires attribute 'sym_name'");
500 auto tblgen_type = getProperties().type; (void)tblgen_type;
501 if (!tblgen_type)
return emitOpError(
"requires attribute 'type'");
503 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(*
this, tblgen_sym_name,
"sym_name")))
504 return ::mlir::failure();
506 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops2(*
this, tblgen_constant,
"constant")))
507 return ::mlir::failure();
509 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops3(*
this, tblgen_type,
"type")))
510 return ::mlir::failure();
512 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops4(*
this, tblgen_initial_value,
"initial_value")))
513 return ::mlir::failure();
514 return ::mlir::success();
519 return ::mlir::success();
520 return ::mlir::failure();
547 if (!tblgen_name_ref)
return emitError(loc,
"'global.read' op ""requires attribute 'name_ref'");
549 if (tblgen_name_ref && !((::llvm::isa<::mlir::SymbolRefAttr>(tblgen_name_ref))))
550 return emitError(loc,
"'global.read' op ""attribute 'name_ref' failed to satisfy constraint: symbol reference attribute");
551 return ::mlir::success();
555 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
557 emitError() <<
"expected DictionaryAttr to set properties";
558 return ::mlir::failure();
563 auto attr = dict.get(
"name_ref");
565 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
567 propStorage = convertedAttr;
569 emitError() <<
"Invalid attribute `name_ref` in property conversion: " << attr;
570 return ::mlir::failure();
574 return ::mlir::success();
578 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
579 ::mlir::Builder odsBuilder{ctx};
582 const auto &propStorage = prop.
name_ref;
584 attrs.push_back(odsBuilder.getNamedAttr(
"name_ref",
589 return odsBuilder.getDictionaryAttr(attrs);
594 return llvm::hash_combine(
595 llvm::hash_value(prop.
name_ref.getAsOpaquePointer()));
599 if (name ==
"name_ref")
605 if (name ==
"name_ref") {
606 prop.
name_ref = ::llvm::dyn_cast_or_null<std::remove_reference_t<
decltype(prop.
name_ref)>>(value);
615::llvm::LogicalResult
GlobalReadOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
618 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops5(attr,
"name_ref", emitError)))
619 return ::mlir::failure();
621 return ::mlir::success();
625 auto &prop = state.getOrAddProperties<
Properties>(); (void)prop;
626 if (::mlir::failed(reader.readAttribute(prop.
name_ref)))
627 return ::mlir::failure();
628 return ::mlir::success();
632 auto &prop = getProperties(); (void)prop;
633 writer.writeAttribute(prop.
name_ref);
641void GlobalReadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type val, ::mlir::SymbolRefAttr name_ref) {
642 odsState.getOrAddProperties<
Properties>().name_ref = name_ref;
643 odsState.addTypes(val);
646void GlobalReadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::SymbolRefAttr name_ref) {
647 odsState.getOrAddProperties<
Properties>().name_ref = name_ref;
648 assert(resultTypes.size() == 1u &&
"mismatched number of results");
649 odsState.addTypes(resultTypes);
652void GlobalReadOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
653 assert(operands.size() == 0u &&
"mismatched number of parameters");
654 odsState.addOperands(operands);
655 odsState.addAttributes(attributes);
656 assert(resultTypes.size() == 1u &&
"mismatched number of return types");
657 odsState.addTypes(resultTypes);
659 if (!attributes.empty()) {
660 ::mlir::OpaqueProperties properties =
662 std::optional<::mlir::RegisteredOperationName> info =
663 odsState.name.getRegisteredInfo();
664 if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
665 odsState.attributes.getDictionary(odsState.getContext()),
nullptr)))
666 ::llvm::report_fatal_error(
"Property conversion failed.");
671 auto tblgen_name_ref = getProperties().name_ref; (void)tblgen_name_ref;
672 if (!tblgen_name_ref)
return emitOpError(
"requires attribute 'name_ref'");
674 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops5(*
this, tblgen_name_ref,
"name_ref")))
675 return ::mlir::failure();
677 unsigned index = 0; (void)index;
680 for (
auto v : valueGroup0) {
681 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*
this, v.getType(),
"result", index++)))
682 return ::mlir::failure();
685 return ::mlir::success();
693 ::mlir::SymbolRefAttr name_refAttr;
694 ::mlir::Type valRawType{};
695 ::llvm::ArrayRef<::mlir::Type> valTypes(&valRawType, 1);
697 if (parser.parseCustomAttributeWithFallback(name_refAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
698 return ::mlir::failure();
701 if (parser.parseColon())
702 return ::mlir::failure();
706 if (parser.parseCustomTypeWithFallback(type))
707 return ::mlir::failure();
711 auto loc = parser.getCurrentLocation();(void)loc;
712 if (parser.parseOptionalAttrDict(result.attributes))
713 return ::mlir::failure();
715 return parser.emitError(loc) <<
"'" << result.name.getStringRef() <<
"' op ";
717 return ::mlir::failure();
719 result.addTypes(valTypes);
720 return ::mlir::success();
726 _odsPrinter <<
' ' <<
":";
729 auto type =
getVal().getType();
730 if (
auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
731 _odsPrinter.printStrippedAttrOrType(validType);
735 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
736 elidedAttrs.push_back(
"name_ref");
737 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
740void GlobalReadOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
741 effects.emplace_back(::mlir::MemoryEffects::Read::get(), 0,
false, ::mlir::SideEffects::DefaultResource::get());
768 if (!tblgen_name_ref)
return emitError(loc,
"'global.write' op ""requires attribute 'name_ref'");
770 if (tblgen_name_ref && !((::llvm::isa<::mlir::SymbolRefAttr>(tblgen_name_ref))))
771 return emitError(loc,
"'global.write' op ""attribute 'name_ref' failed to satisfy constraint: symbol reference attribute");
772 return ::mlir::success();
776 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
778 emitError() <<
"expected DictionaryAttr to set properties";
779 return ::mlir::failure();
784 auto attr = dict.get(
"name_ref");
786 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
788 propStorage = convertedAttr;
790 emitError() <<
"Invalid attribute `name_ref` in property conversion: " << attr;
791 return ::mlir::failure();
795 return ::mlir::success();
799 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
800 ::mlir::Builder odsBuilder{ctx};
803 const auto &propStorage = prop.
name_ref;
805 attrs.push_back(odsBuilder.getNamedAttr(
"name_ref",
810 return odsBuilder.getDictionaryAttr(attrs);
815 return llvm::hash_combine(
816 llvm::hash_value(prop.
name_ref.getAsOpaquePointer()));
820 if (name ==
"name_ref")
826 if (name ==
"name_ref") {
827 prop.
name_ref = ::llvm::dyn_cast_or_null<std::remove_reference_t<
decltype(prop.
name_ref)>>(value);
839 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops5(attr,
"name_ref", emitError)))
840 return ::mlir::failure();
842 return ::mlir::success();
846 auto &prop = state.getOrAddProperties<
Properties>(); (void)prop;
847 if (::mlir::failed(reader.readAttribute(prop.
name_ref)))
848 return ::mlir::failure();
849 return ::mlir::success();
853 auto &prop = getProperties(); (void)prop;
854 writer.writeAttribute(prop.
name_ref);
862void GlobalWriteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::SymbolRefAttr name_ref, ::mlir::Value val) {
863 odsState.addOperands(val);
864 odsState.getOrAddProperties<
Properties>().name_ref = name_ref;
867void GlobalWriteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::SymbolRefAttr name_ref, ::mlir::Value val) {
868 odsState.addOperands(val);
869 odsState.getOrAddProperties<
Properties>().name_ref = name_ref;
870 assert(resultTypes.size() == 0u &&
"mismatched number of results");
871 odsState.addTypes(resultTypes);
874void GlobalWriteOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
875 assert(operands.size() == 1u &&
"mismatched number of parameters");
876 odsState.addOperands(operands);
877 odsState.addAttributes(attributes);
878 assert(resultTypes.size() == 0u &&
"mismatched number of return types");
879 odsState.addTypes(resultTypes);
881 if (!attributes.empty()) {
882 ::mlir::OpaqueProperties properties =
884 std::optional<::mlir::RegisteredOperationName> info =
885 odsState.name.getRegisteredInfo();
886 if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
887 odsState.attributes.getDictionary(odsState.getContext()),
nullptr)))
888 ::llvm::report_fatal_error(
"Property conversion failed.");
893 auto tblgen_name_ref = getProperties().name_ref; (void)tblgen_name_ref;
894 if (!tblgen_name_ref)
return emitOpError(
"requires attribute 'name_ref'");
896 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops5(*
this, tblgen_name_ref,
"name_ref")))
897 return ::mlir::failure();
899 unsigned index = 0; (void)index;
902 for (
auto v : valueGroup0) {
903 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*
this, v.getType(),
"operand", index++)))
904 return ::mlir::failure();
907 return ::mlir::success();
915 ::mlir::SymbolRefAttr name_refAttr;
916 ::mlir::OpAsmParser::UnresolvedOperand valRawOperand{};
917 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valOperands(&valRawOperand, 1); ::llvm::SMLoc valOperandsLoc;
918 (void)valOperandsLoc;
919 ::mlir::Type valRawType{};
920 ::llvm::ArrayRef<::mlir::Type> valTypes(&valRawType, 1);
922 if (parser.parseCustomAttributeWithFallback(name_refAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
923 return ::mlir::failure();
926 if (parser.parseEqual())
927 return ::mlir::failure();
929 valOperandsLoc = parser.getCurrentLocation();
930 if (parser.parseOperand(valRawOperand))
931 return ::mlir::failure();
932 if (parser.parseColon())
933 return ::mlir::failure();
937 if (parser.parseCustomTypeWithFallback(type))
938 return ::mlir::failure();
942 auto loc = parser.getCurrentLocation();(void)loc;
943 if (parser.parseOptionalAttrDict(result.attributes))
944 return ::mlir::failure();
946 return parser.emitError(loc) <<
"'" << result.name.getStringRef() <<
"' op ";
948 return ::mlir::failure();
950 if (parser.resolveOperands(valOperands, valTypes, valOperandsLoc, result.operands))
951 return ::mlir::failure();
952 return ::mlir::success();
958 _odsPrinter <<
' ' <<
"=";
961 _odsPrinter <<
' ' <<
":";
964 auto type =
getVal().getType();
965 if (
auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
966 _odsPrinter.printStrippedAttrOrType(validType);
970 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
971 elidedAttrs.push_back(
"name_ref");
972 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
976 effects.emplace_back(::mlir::MemoryEffects::Write::get(), 0,
false, ::mlir::SideEffects::DefaultResource::get());
::llvm::LogicalResult verify(::mlir::Location loc)
GlobalDefOpAdaptor(GlobalDefOp op)
GlobalDefOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
::mlir::ValueRange getOperands()
::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties)
FoldAdaptor::Properties Properties
::mlir::Attribute getInitialValue()
void setType(::mlir::Type attrValue)
::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state)
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
::llvm::LogicalResult verifyInvariants()
::mlir::TypeAttr getTypeAttr()
::llvm::StringRef getSymName()
::mlir::StringAttr getSymNameAttrName()
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
::mlir::Attribute getInitialValueAttr()
::mlir::StringAttr getSymNameAttr()
::mlir::UnitAttr getConstantAttr()
void setSymName(::llvm::StringRef attrValue)
void writeProperties(::mlir::DialectBytecodeWriter &writer)
::llvm::LogicalResult verifyInvariantsImpl()
::mlir::StringAttr getTypeAttrName()
void setConstant(bool attrValue)
::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
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, ::mlir::UnitAttr constant, ::mlir::TypeAttr type, ::mlir::Attribute initial_value=nullptr)
::mlir::StringAttr getInitialValueAttrName()
::llvm::LogicalResult verify()
static llvm::hash_code computePropertiesHash(const Properties &prop)
::mlir::StringAttr getConstantAttrName()
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
GlobalReadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
::llvm::LogicalResult verify(::mlir::Location loc)
GlobalReadOpAdaptor(GlobalReadOp op)
::mlir::ValueRange getOperands()
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type val, ::mlir::SymbolRefAttr name_ref)
::mlir::StringAttr getNameRefAttrName()
void writeProperties(::mlir::DialectBytecodeWriter &writer)
FoldAdaptor::Properties Properties
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
::mlir::Operation::result_range getODSResults(unsigned index)
::llvm::LogicalResult verifyInvariants()
void print(::mlir::OpAsmPrinter &_odsPrinter)
void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect > > &effects)
static llvm::hash_code computePropertiesHash(const Properties &prop)
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
::mlir::SymbolRefAttr getNameRefAttr()
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
::mlir::TypedValue<::mlir::Type > getVal()
::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
::mlir::SymbolRefAttr getNameRef()
::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state)
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
::llvm::LogicalResult verifyInvariantsImpl()
GlobalWriteOpAdaptor(GlobalWriteOp op)
GlobalWriteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
::llvm::LogicalResult verify(::mlir::Location loc)
::mlir::ValueRange getOperands()
::mlir::TypedValue<::mlir::Type > getVal()
static llvm::hash_code computePropertiesHash(const Properties &prop)
::mlir::StringAttr getNameRefAttrName()
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
::mlir::SymbolRefAttr getNameRefAttr()
::mlir::Operation::operand_range getODSOperands(unsigned index)
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
void print(::mlir::OpAsmPrinter &_odsPrinter)
FoldAdaptor::Properties Properties
::llvm::LogicalResult verifyInvariants()
void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect > > &effects)
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::SymbolRefAttr name_ref, ::mlir::Value val)
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
void writeProperties(::mlir::DialectBytecodeWriter &writer)
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
::llvm::LogicalResult verifyInvariantsImpl()
::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
::mlir::SymbolRefAttr getNameRef()
::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state)
::mlir::DictionaryAttr odsAttrs
::mlir::Attribute getInitialValueAttr()
GlobalDefOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
::mlir::RegionRange odsRegions
::llvm::StringRef getSymName()
::std::optional<::mlir::OperationName > odsOpName
::mlir::UnitAttr getConstantAttr()
const Properties & getProperties()
::mlir::Attribute getInitialValue()
::mlir::TypeAttr getTypeAttr()
::mlir::StringAttr getSymNameAttr()
const Properties & getProperties()
::mlir::SymbolRefAttr getNameRef()
::mlir::RegionRange odsRegions
GlobalReadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
::mlir::DictionaryAttr odsAttrs
::std::optional<::mlir::OperationName > odsOpName
::mlir::SymbolRefAttr getNameRefAttr()
::mlir::SymbolRefAttr getNameRefAttr()
::mlir::RegionRange odsRegions
const Properties & getProperties()
::mlir::SymbolRefAttr getNameRef()
::std::optional<::mlir::OperationName > odsOpName
GlobalWriteOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
::mlir::DictionaryAttr odsAttrs
bool isValidGlobalType(Type type)
initial_valueTy initial_value