27static ::llvm::LogicalResult __mlir_ods_local_type_constraint_Ops1(
28 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
29 unsigned valueIndex) {
31 return op->emitOpError(valueKind) <<
" #" << valueIndex
32 <<
" must be any LLZK type except non-constant types, but got " << type;
34 return ::mlir::success();
37static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops1(
38 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
39 if (attr && !((::llvm::isa<::mlir::StringAttr>(attr))))
40 return emitError() <<
"attribute '" << attrName
41 <<
"' failed to satisfy constraint: string attribute";
42 return ::mlir::success();
44static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops1(
45 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
46 return __mlir_ods_local_attr_constraint_Ops1(attr, attrName, [op]() {
47 return op->emitOpError();
51static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops2(
52 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
53 if (attr && !((::llvm::isa<::mlir::UnitAttr>(attr))))
54 return emitError() <<
"attribute '" << attrName
55 <<
"' failed to satisfy constraint: unit attribute";
56 return ::mlir::success();
58static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops2(
59 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
60 return __mlir_ods_local_attr_constraint_Ops2(attr, attrName, [op]() {
61 return op->emitOpError();
65static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops3(
66 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
67 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())))))
68 return emitError() <<
"attribute '" << attrName
69 <<
"' failed to satisfy constraint: type attribute of any LLZK type except non-constant types";
70 return ::mlir::success();
72static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops3(
73 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
74 return __mlir_ods_local_attr_constraint_Ops3(attr, attrName, [op]() {
75 return op->emitOpError();
79static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops4(
80 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
81 if (attr && !((
true)))
82 return emitError() <<
"attribute '" << attrName
83 <<
"' failed to satisfy constraint: any attribute";
84 return ::mlir::success();
86static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops4(
87 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
88 return __mlir_ods_local_attr_constraint_Ops4(attr, attrName, [op]() {
89 return op->emitOpError();
93static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops5(
94 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
95 if (attr && !((::llvm::isa<::mlir::SymbolRefAttr>(attr))))
96 return emitError() <<
"attribute '" << attrName
97 <<
"' failed to satisfy constraint: symbol reference attribute";
98 return ::mlir::success();
100static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops5(
101 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
102 return __mlir_ods_local_attr_constraint_Ops5(attr, attrName, [op]() {
103 return op->emitOpError();
119 return attr.getValue();
123 auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(
getProperties().constant);
125 attr = ((
false) ? ::mlir::Builder(
odsAttrs.getContext()).getUnitAttr() :
nullptr);
132 return ((
false) ? ::mlir::Builder(
odsAttrs.getContext()).getUnitAttr() :
nullptr) !=
nullptr;
133 return attr !=
nullptr;
138 return ::llvm::cast<::mlir::Type>(attr.getValue());
142 auto attr = ::llvm::dyn_cast_or_null<::mlir::Attribute>(
getProperties().initial_value);
159 if (!tblgen_sym_name)
return emitError(loc,
"'global.def' op requires attribute 'sym_name'");
161 if (!tblgen_type)
return emitError(loc,
"'global.def' op requires attribute 'type'");
163 if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name))))
164 return emitError(loc,
"'global.def' op attribute 'sym_name' failed to satisfy constraint: string attribute");
166 if (tblgen_constant && !((::llvm::isa<::mlir::UnitAttr>(tblgen_constant))))
167 return emitError(loc,
"'global.def' op attribute 'constant' failed to satisfy constraint: unit attribute");
169 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())))))
170 return emitError(loc,
"'global.def' op attribute 'type' failed to satisfy constraint: type attribute of any LLZK type except non-constant types");
172 if (tblgen_initial_value && !((
true)))
173 return emitError(loc,
"'global.def' op attribute 'initial_value' failed to satisfy constraint: any attribute");
174 return ::mlir::success();
178 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
180 emitError() <<
"expected DictionaryAttr to set properties";
181 return ::mlir::failure();
186 auto attr = dict.get(
"constant");
188 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
190 propStorage = convertedAttr;
192 emitError() <<
"Invalid attribute `constant` in property conversion: " << attr;
193 return ::mlir::failure();
200 auto attr = dict.get(
"initial_value");
202 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
204 propStorage = convertedAttr;
206 emitError() <<
"Invalid attribute `initial_value` in property conversion: " << attr;
207 return ::mlir::failure();
214 auto attr = dict.get(
"sym_name");
216 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
218 propStorage = convertedAttr;
220 emitError() <<
"Invalid attribute `sym_name` in property conversion: " << attr;
221 return ::mlir::failure();
227 auto &propStorage = prop.
type;
228 auto attr = dict.get(
"type");
230 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
232 propStorage = convertedAttr;
234 emitError() <<
"Invalid attribute `type` in property conversion: " << attr;
235 return ::mlir::failure();
239 return ::mlir::success();
243 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
244 ::mlir::Builder odsBuilder{ctx};
247 const auto &propStorage = prop.
constant;
249 attrs.push_back(odsBuilder.getNamedAttr(
"constant",
256 attrs.push_back(odsBuilder.getNamedAttr(
"initial_value",
261 const auto &propStorage = prop.
sym_name;
263 attrs.push_back(odsBuilder.getNamedAttr(
"sym_name",
268 const auto &propStorage = prop.
type;
270 attrs.push_back(odsBuilder.getNamedAttr(
"type",
275 return odsBuilder.getDictionaryAttr(attrs);
280 using llvm::hash_value;
281 return llvm::hash_combine(
282 llvm::hash_value(prop.
constant.getAsOpaquePointer()),
284 llvm::hash_value(prop.
sym_name.getAsOpaquePointer()),
285 llvm::hash_value(prop.
type.getAsOpaquePointer()));
289 if (name ==
"constant")
292 if (name ==
"initial_value")
295 if (name ==
"sym_name")
304 if (name ==
"constant") {
305 prop.
constant = ::llvm::dyn_cast_or_null<std::remove_reference_t<
decltype(prop.
constant)>>(value);
309 if (name ==
"initial_value") {
314 if (name ==
"sym_name") {
315 prop.
sym_name = ::llvm::dyn_cast_or_null<std::remove_reference_t<
decltype(prop.
sym_name)>>(value);
319 if (name ==
"type") {
320 prop.
type = ::llvm::dyn_cast_or_null<std::remove_reference_t<
decltype(prop.
type)>>(value);
332 if (prop.
type) attrs.append(
"type", prop.
type);
335::llvm::LogicalResult
GlobalDefOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
338 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops2(attr,
"constant", emitError)))
339 return ::mlir::failure();
344 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops4(attr,
"initial_value", emitError)))
345 return ::mlir::failure();
350 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(attr,
"sym_name", emitError)))
351 return ::mlir::failure();
356 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops3(attr,
"type", emitError)))
357 return ::mlir::failure();
359 return ::mlir::success();
363 auto &prop = state.getOrAddProperties<
Properties>(); (void)prop;
364 if (::mlir::failed(reader.readOptionalAttribute(prop.
constant)))
365 return ::mlir::failure();
367 if (::mlir::failed(reader.readOptionalAttribute(prop.
initial_value)))
368 return ::mlir::failure();
370 if (::mlir::failed(reader.readAttribute(prop.
sym_name)))
371 return ::mlir::failure();
373 if (::mlir::failed(reader.readAttribute(prop.
type)))
374 return ::mlir::failure();
375 return ::mlir::success();
379 auto &prop = getProperties(); (void)prop;
381 writer.writeOptionalAttribute(prop.
constant);
384 writer.writeAttribute(prop.
sym_name);
385 writer.writeAttribute(prop.
type);
390 return attr.getValue();
396 return ((
false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() :
nullptr) !=
nullptr;
397 return attr !=
nullptr;
402 return ::llvm::cast<::mlir::Type>(attr.getValue());
411 getProperties().sym_name = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue);
415 auto &odsProp = getProperties().constant;
417 odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() :
nullptr);
423 getProperties().type = ::mlir::TypeAttr::get(attrValue);
426void GlobalDefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::UnitAttr constant, ::mlir::TypeAttr type, ::mlir::Attribute initial_value) {
427 odsState.getOrAddProperties<
Properties>().sym_name = sym_name;
429 odsState.getOrAddProperties<
Properties>().constant = constant;
431 odsState.getOrAddProperties<
Properties>().type = type;
433 odsState.getOrAddProperties<
Properties>().initial_value = initial_value;
437GlobalDefOp GlobalDefOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::StringAttr sym_name, ::mlir::UnitAttr constant, ::mlir::TypeAttr type, ::mlir::Attribute initial_value) {
439 build(builder, __state__, std::forward<
decltype(sym_name)>(sym_name), std::forward<
decltype(constant)>(constant), std::forward<
decltype(type)>(type), std::forward<
decltype(initial_value)>(initial_value));
440 auto __res__ = ::llvm::dyn_cast<GlobalDefOp>(builder.create(__state__));
441 assert(__res__ &&
"builder didn't return the right type");
445GlobalDefOp GlobalDefOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::StringAttr sym_name, ::mlir::UnitAttr constant, ::mlir::TypeAttr type, ::mlir::Attribute initial_value) {
446 return create(builder, builder.getLoc(), std::forward<
decltype(sym_name)>(sym_name), std::forward<
decltype(constant)>(constant), std::forward<
decltype(type)>(type), std::forward<
decltype(initial_value)>(initial_value));
449void 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) {
450 odsState.getOrAddProperties<
Properties>().sym_name = sym_name;
452 odsState.getOrAddProperties<
Properties>().constant = constant;
454 odsState.getOrAddProperties<
Properties>().type = type;
456 odsState.getOrAddProperties<
Properties>().initial_value = initial_value;
458 assert(resultTypes.size() == 0u &&
"mismatched number of results");
459 odsState.addTypes(resultTypes);
462GlobalDefOp GlobalDefOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::UnitAttr constant, ::mlir::TypeAttr type, ::mlir::Attribute initial_value) {
464 build(builder, __state__, std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(sym_name)>(sym_name), std::forward<
decltype(constant)>(constant), std::forward<
decltype(type)>(type), std::forward<
decltype(initial_value)>(initial_value));
465 auto __res__ = ::llvm::dyn_cast<GlobalDefOp>(builder.create(__state__));
466 assert(__res__ &&
"builder didn't return the right type");
470GlobalDefOp GlobalDefOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::UnitAttr constant, ::mlir::TypeAttr type, ::mlir::Attribute initial_value) {
471 return create(builder, builder.getLoc(), std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(sym_name)>(sym_name), std::forward<
decltype(constant)>(constant), std::forward<
decltype(type)>(type), std::forward<
decltype(initial_value)>(initial_value));
474void GlobalDefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name,
bool constant, ::mlir::Type type, ::mlir::Attribute initial_value) {
475 odsState.getOrAddProperties<
Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
477 odsState.getOrAddProperties<
Properties>().constant = ((constant) ? odsBuilder.getUnitAttr() :
nullptr);
479 odsState.getOrAddProperties<
Properties>().type = ::mlir::TypeAttr::get(type);
480 odsState.getOrAddProperties<
Properties>().initial_value = initial_value;
483GlobalDefOp GlobalDefOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::llvm::StringRef sym_name,
bool constant, ::mlir::Type type, ::mlir::Attribute initial_value) {
485 build(builder, __state__, std::forward<
decltype(sym_name)>(sym_name), std::forward<
decltype(constant)>(constant), std::forward<
decltype(type)>(type), std::forward<
decltype(initial_value)>(initial_value));
486 auto __res__ = ::llvm::dyn_cast<GlobalDefOp>(builder.create(__state__));
487 assert(__res__ &&
"builder didn't return the right type");
491GlobalDefOp GlobalDefOp::create(::mlir::ImplicitLocOpBuilder &builder, ::llvm::StringRef sym_name,
bool constant, ::mlir::Type type, ::mlir::Attribute initial_value) {
492 return create(builder, builder.getLoc(), std::forward<
decltype(sym_name)>(sym_name), std::forward<
decltype(constant)>(constant), std::forward<
decltype(type)>(type), std::forward<
decltype(initial_value)>(initial_value));
495void GlobalDefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name,
bool constant, ::mlir::Type type, ::mlir::Attribute initial_value) {
496 odsState.getOrAddProperties<
Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
498 odsState.getOrAddProperties<
Properties>().constant = ((constant) ? odsBuilder.getUnitAttr() :
nullptr);
500 odsState.getOrAddProperties<
Properties>().type = ::mlir::TypeAttr::get(type);
501 odsState.getOrAddProperties<
Properties>().initial_value = initial_value;
502 assert(resultTypes.size() == 0u &&
"mismatched number of results");
503 odsState.addTypes(resultTypes);
506GlobalDefOp GlobalDefOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name,
bool constant, ::mlir::Type type, ::mlir::Attribute initial_value) {
508 build(builder, __state__, std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(sym_name)>(sym_name), std::forward<
decltype(constant)>(constant), std::forward<
decltype(type)>(type), std::forward<
decltype(initial_value)>(initial_value));
509 auto __res__ = ::llvm::dyn_cast<GlobalDefOp>(builder.create(__state__));
510 assert(__res__ &&
"builder didn't return the right type");
514GlobalDefOp GlobalDefOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name,
bool constant, ::mlir::Type type, ::mlir::Attribute initial_value) {
515 return create(builder, builder.getLoc(), std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(sym_name)>(sym_name), std::forward<
decltype(constant)>(constant), std::forward<
decltype(type)>(type), std::forward<
decltype(initial_value)>(initial_value));
518void GlobalDefOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
519 assert(operands.size() == 0u &&
"mismatched number of parameters");
520 odsState.addOperands(operands);
521 odsState.addAttributes(attributes);
522 assert(resultTypes.size() == 0u &&
"mismatched number of return types");
523 odsState.addTypes(resultTypes);
525 if (!attributes.empty()) {
527 ::mlir::PropertyRef properties = odsState.getRawProperties();
528 std::optional<::mlir::RegisteredOperationName> info =
529 odsState.name.getRegisteredInfo();
530 if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
531 odsState.attributes.getDictionary(odsState.getContext()),
nullptr)))
532 ::llvm::report_fatal_error(
"Property conversion failed.");
536GlobalDefOp GlobalDefOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
538 build(builder, __state__, std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(operands)>(operands), std::forward<
decltype(attributes)>(attributes));
539 auto __res__ = ::llvm::dyn_cast<GlobalDefOp>(builder.create(__state__));
540 assert(__res__ &&
"builder didn't return the right type");
544GlobalDefOp GlobalDefOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
545 return create(builder, builder.getLoc(), std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(operands)>(operands), std::forward<
decltype(attributes)>(attributes));
548void GlobalDefOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands,
const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
549 assert(operands.size() == 0u &&
"mismatched number of parameters");
550 odsState.addOperands(operands);
551 odsState.useProperties(
const_cast<Properties&
>(properties));
552 odsState.addAttributes(discardableAttributes);
553 assert(resultTypes.size() == 0u &&
"mismatched number of return types");
554 odsState.addTypes(resultTypes);
557GlobalDefOp GlobalDefOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands,
const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
559 build(builder, __state__, std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(operands)>(operands), std::forward<
decltype(properties)>(properties), std::forward<
decltype(discardableAttributes)>(discardableAttributes));
560 auto __res__ = ::llvm::dyn_cast<GlobalDefOp>(builder.create(__state__));
561 assert(__res__ &&
"builder didn't return the right type");
565GlobalDefOp GlobalDefOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands,
const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
566 return create(builder, builder.getLoc(), std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(operands)>(operands), std::forward<
decltype(properties)>(properties), std::forward<
decltype(discardableAttributes)>(discardableAttributes));
570 ::mlir::Builder odsBuilder(opName.getContext());
576 auto tblgen_constant = getProperties().constant; (void)tblgen_constant;
577 auto tblgen_initial_value = getProperties().initial_value; (void)tblgen_initial_value;
578 auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
579 if (!tblgen_sym_name)
return emitOpError(
"requires attribute 'sym_name'");
580 auto tblgen_type = getProperties().type; (void)tblgen_type;
581 if (!tblgen_type)
return emitOpError(
"requires attribute 'type'");
583 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(*
this, tblgen_sym_name,
"sym_name")))
584 return ::mlir::failure();
586 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops2(*
this, tblgen_constant,
"constant")))
587 return ::mlir::failure();
589 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops3(*
this, tblgen_type,
"type")))
590 return ::mlir::failure();
592 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops4(*
this, tblgen_initial_value,
"initial_value")))
593 return ::mlir::failure();
594 return ::mlir::success();
599 return ::mlir::success();
600 return ::mlir::failure();
604 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
606 emitError() <<
"expected DictionaryAttr to set properties";
607 return ::mlir::failure();
611 ::mlir::DenseSet<::mlir::StringAttr> usedKeys;
612 ::mlir::MLIRContext *ctx = dict.getContext();
617 auto sym_nameAttrName = ::mlir::StringAttr::get(ctx,
"sym_name");
618 auto attr = dict.get(sym_nameAttrName);
619 usedKeys.insert(sym_nameAttrName);
622 emitError() <<
"expected key entry for sym_name in DictionaryAttr to set "
624 return ::mlir::failure();
626 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
628 propStorage = convertedAttr;
630 emitError() <<
"Invalid attribute `sym_name` in property conversion: " << attr;
631 return ::mlir::failure();
638 auto constantAttrName = ::mlir::StringAttr::get(ctx,
"constant");
639 auto attr = dict.get(constantAttrName);
640 usedKeys.insert(constantAttrName);
643 emitError() <<
"expected key entry for constant in DictionaryAttr to set "
645 return ::mlir::failure();
647 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
649 propStorage = convertedAttr;
651 emitError() <<
"Invalid attribute `constant` in property conversion: " << attr;
652 return ::mlir::failure();
658 auto &propStorage = prop.
type;
659 auto typeAttrName = ::mlir::StringAttr::get(ctx,
"type");
660 auto attr = dict.get(typeAttrName);
661 usedKeys.insert(typeAttrName);
664 emitError() <<
"expected key entry for type in DictionaryAttr to set "
666 return ::mlir::failure();
668 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
670 propStorage = convertedAttr;
672 emitError() <<
"Invalid attribute `type` in property conversion: " << attr;
673 return ::mlir::failure();
680 auto initial_valueAttrName = ::mlir::StringAttr::get(ctx,
"initial_value");
681 auto attr = dict.get(initial_valueAttrName);
682 usedKeys.insert(initial_valueAttrName);
685 emitError() <<
"expected key entry for initial_value in DictionaryAttr to set "
687 return ::mlir::failure();
689 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
691 propStorage = convertedAttr;
693 emitError() <<
"Invalid attribute `initial_value` in property conversion: " << attr;
694 return ::mlir::failure();
699 for (::mlir::NamedAttribute attr : dict) {
700 if (!usedKeys.contains(attr.getName()))
701 return emitError() <<
"unknown key '" << attr.getName() <<
702 "' when parsing properties dictionary";
704 return ::mlir::success();
724 auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(
getProperties().constant);
726 attr = ((
false) ? ::mlir::Builder(
odsAttrs.getContext()).getUnitAttr() :
nullptr);
733 return ((
false) ? ::mlir::Builder(
odsAttrs.getContext()).getUnitAttr() :
nullptr) !=
nullptr;
734 return attr !=
nullptr;
749 if (!tblgen_name_ref)
return emitError(loc,
"'global.read' op requires attribute 'name_ref'");
751 if (tblgen_constant && !((::llvm::isa<::mlir::UnitAttr>(tblgen_constant))))
752 return emitError(loc,
"'global.read' op attribute 'constant' failed to satisfy constraint: unit attribute");
754 if (tblgen_name_ref && !((::llvm::isa<::mlir::SymbolRefAttr>(tblgen_name_ref))))
755 return emitError(loc,
"'global.read' op attribute 'name_ref' failed to satisfy constraint: symbol reference attribute");
756 return ::mlir::success();
760 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
762 emitError() <<
"expected DictionaryAttr to set properties";
763 return ::mlir::failure();
768 auto attr = dict.get(
"constant");
770 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
772 propStorage = convertedAttr;
774 emitError() <<
"Invalid attribute `constant` in property conversion: " << attr;
775 return ::mlir::failure();
782 auto attr = dict.get(
"name_ref");
784 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
786 propStorage = convertedAttr;
788 emitError() <<
"Invalid attribute `name_ref` in property conversion: " << attr;
789 return ::mlir::failure();
793 return ::mlir::success();
797 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
798 ::mlir::Builder odsBuilder{ctx};
801 const auto &propStorage = prop.
constant;
803 attrs.push_back(odsBuilder.getNamedAttr(
"constant",
808 const auto &propStorage = prop.
name_ref;
810 attrs.push_back(odsBuilder.getNamedAttr(
"name_ref",
815 return odsBuilder.getDictionaryAttr(attrs);
820 using llvm::hash_value;
821 return llvm::hash_combine(
822 llvm::hash_value(prop.
constant.getAsOpaquePointer()),
823 llvm::hash_value(prop.
name_ref.getAsOpaquePointer()));
827 if (name ==
"constant")
830 if (name ==
"name_ref")
836 if (name ==
"constant") {
837 prop.
constant = ::llvm::dyn_cast_or_null<std::remove_reference_t<
decltype(prop.
constant)>>(value);
841 if (name ==
"name_ref") {
842 prop.
name_ref = ::llvm::dyn_cast_or_null<std::remove_reference_t<
decltype(prop.
name_ref)>>(value);
853::llvm::LogicalResult
GlobalReadOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
856 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops2(attr,
"constant", emitError)))
857 return ::mlir::failure();
862 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops5(attr,
"name_ref", emitError)))
863 return ::mlir::failure();
865 return ::mlir::success();
871 return ((
false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() :
nullptr) !=
nullptr;
872 return attr !=
nullptr;
881 auto &odsProp = getProperties().constant;
883 odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() :
nullptr);
888void GlobalReadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type val, ::mlir::UnitAttr constant, ::mlir::SymbolRefAttr name_ref) {
890 odsState.getOrAddProperties<
Properties>().constant = constant;
892 odsState.getOrAddProperties<
Properties>().name_ref = name_ref;
893 odsState.addTypes(val);
898 build(builder, __state__, std::forward<
decltype(val)>(val), std::forward<
decltype(constant)>(constant), std::forward<
decltype(name_ref)>(name_ref));
899 auto __res__ = ::llvm::dyn_cast<GlobalReadOp>(builder.create(__state__));
900 assert(__res__ &&
"builder didn't return the right type");
905 return create(builder, builder.getLoc(), std::forward<
decltype(val)>(val), std::forward<
decltype(constant)>(constant), std::forward<
decltype(name_ref)>(name_ref));
908void GlobalReadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::UnitAttr constant, ::mlir::SymbolRefAttr name_ref) {
910 odsState.getOrAddProperties<
Properties>().constant = constant;
912 odsState.getOrAddProperties<
Properties>().name_ref = name_ref;
913 assert(resultTypes.size() == 1u &&
"mismatched number of results");
914 odsState.addTypes(resultTypes);
917GlobalReadOp GlobalReadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::UnitAttr constant, ::mlir::SymbolRefAttr name_ref) {
919 build(builder, __state__, std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(constant)>(constant), std::forward<
decltype(name_ref)>(name_ref));
920 auto __res__ = ::llvm::dyn_cast<GlobalReadOp>(builder.create(__state__));
921 assert(__res__ &&
"builder didn't return the right type");
926 return create(builder, builder.getLoc(), std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(constant)>(constant), std::forward<
decltype(name_ref)>(name_ref));
929void GlobalReadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type val,
bool constant, ::mlir::SymbolRefAttr name_ref) {
931 odsState.getOrAddProperties<
Properties>().constant = ((constant) ? odsBuilder.getUnitAttr() :
nullptr);
933 odsState.getOrAddProperties<
Properties>().name_ref = name_ref;
934 odsState.addTypes(val);
939 build(builder, __state__, std::forward<
decltype(val)>(val), std::forward<
decltype(constant)>(constant), std::forward<
decltype(name_ref)>(name_ref));
940 auto __res__ = ::llvm::dyn_cast<GlobalReadOp>(builder.create(__state__));
941 assert(__res__ &&
"builder didn't return the right type");
946 return create(builder, builder.getLoc(), std::forward<
decltype(val)>(val), std::forward<
decltype(constant)>(constant), std::forward<
decltype(name_ref)>(name_ref));
949void GlobalReadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes,
bool constant, ::mlir::SymbolRefAttr name_ref) {
951 odsState.getOrAddProperties<
Properties>().constant = ((constant) ? odsBuilder.getUnitAttr() :
nullptr);
953 odsState.getOrAddProperties<
Properties>().name_ref = name_ref;
954 assert(resultTypes.size() == 1u &&
"mismatched number of results");
955 odsState.addTypes(resultTypes);
960 build(builder, __state__, std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(constant)>(constant), std::forward<
decltype(name_ref)>(name_ref));
961 auto __res__ = ::llvm::dyn_cast<GlobalReadOp>(builder.create(__state__));
962 assert(__res__ &&
"builder didn't return the right type");
967 return create(builder, builder.getLoc(), std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(constant)>(constant), std::forward<
decltype(name_ref)>(name_ref));
970void GlobalReadOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
971 assert(operands.size() == 0u &&
"mismatched number of parameters");
972 odsState.addOperands(operands);
973 odsState.addAttributes(attributes);
974 assert(resultTypes.size() == 1u &&
"mismatched number of return types");
975 odsState.addTypes(resultTypes);
977 if (!attributes.empty()) {
979 ::mlir::PropertyRef properties = odsState.getRawProperties();
980 std::optional<::mlir::RegisteredOperationName> info =
981 odsState.name.getRegisteredInfo();
982 if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
983 odsState.attributes.getDictionary(odsState.getContext()),
nullptr)))
984 ::llvm::report_fatal_error(
"Property conversion failed.");
988GlobalReadOp GlobalReadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
990 build(builder, __state__, std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(operands)>(operands), std::forward<
decltype(attributes)>(attributes));
991 auto __res__ = ::llvm::dyn_cast<GlobalReadOp>(builder.create(__state__));
992 assert(__res__ &&
"builder didn't return the right type");
996GlobalReadOp GlobalReadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
997 return create(builder, builder.getLoc(), std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(operands)>(operands), std::forward<
decltype(attributes)>(attributes));
1000void GlobalReadOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands,
const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
1001 assert(operands.size() == 0u &&
"mismatched number of parameters");
1002 odsState.addOperands(operands);
1003 odsState.useProperties(
const_cast<Properties&
>(properties));
1004 odsState.addAttributes(discardableAttributes);
1005 assert(resultTypes.size() == 1u &&
"mismatched number of return types");
1006 odsState.addTypes(resultTypes);
1009GlobalReadOp GlobalReadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands,
const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
1011 build(builder, __state__, std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(operands)>(operands), std::forward<
decltype(properties)>(properties), std::forward<
decltype(discardableAttributes)>(discardableAttributes));
1012 auto __res__ = ::llvm::dyn_cast<GlobalReadOp>(builder.create(__state__));
1013 assert(__res__ &&
"builder didn't return the right type");
1017GlobalReadOp GlobalReadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands,
const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
1018 return create(builder, builder.getLoc(), std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(operands)>(operands), std::forward<
decltype(properties)>(properties), std::forward<
decltype(discardableAttributes)>(discardableAttributes));
1022 auto tblgen_constant = getProperties().constant; (void)tblgen_constant;
1023 auto tblgen_name_ref = getProperties().name_ref; (void)tblgen_name_ref;
1024 if (!tblgen_name_ref)
return emitOpError(
"requires attribute 'name_ref'");
1026 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops2(*
this, tblgen_constant,
"constant")))
1027 return ::mlir::failure();
1029 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops5(*
this, tblgen_name_ref,
"name_ref")))
1030 return ::mlir::failure();
1032 unsigned index = 0; (void)index;
1035 for (
auto v : valueGroup0) {
1036 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*
this, v.getType(),
"result", index++)))
1037 return ::mlir::failure();
1040 return ::mlir::success();
1048 ::mlir::SymbolRefAttr name_refAttr;
1049 ::mlir::Type valRawType{};
1050 ::llvm::ArrayRef<::mlir::Type> valTypes(&valRawType, 1);
1051 if (::mlir::succeeded(parser.parseOptionalKeyword(
"const"))) {
1054 if (parser.parseCustomAttributeWithFallback(name_refAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
1055 return ::mlir::failure();
1058 if (parser.parseColon())
1059 return ::mlir::failure();
1063 if (parser.parseCustomTypeWithFallback(type))
1064 return ::mlir::failure();
1068 auto loc = parser.getCurrentLocation();(void)loc;
1069 if (parser.parseOptionalAttrDict(result.attributes))
1070 return ::mlir::failure();
1072 return parser.emitError(loc) <<
"'" << result.name.getStringRef() <<
"' op ";
1074 return ::mlir::failure();
1076 result.addTypes(valTypes);
1077 return ::mlir::success();
1082 _odsPrinter <<
' ' <<
"const";
1086 _odsPrinter <<
' ' <<
":";
1089 auto type =
getVal().getType();
1090 if (
auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
1091 _odsPrinter.printStrippedAttrOrType(validType);
1093 _odsPrinter << type;
1095 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
1096 elidedAttrs.push_back(
"constant");
1097 elidedAttrs.push_back(
"name_ref");
1099 ::mlir::Builder odsBuilder(getContext());
1101 if(attr && (attr == ((
false) ? odsBuilder.getUnitAttr() :
nullptr)))
1102 elidedAttrs.push_back(
"constant");
1104 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
1134 if (!tblgen_name_ref)
return emitError(loc,
"'global.write' op requires attribute 'name_ref'");
1136 if (tblgen_name_ref && !((::llvm::isa<::mlir::SymbolRefAttr>(tblgen_name_ref))))
1137 return emitError(loc,
"'global.write' op attribute 'name_ref' failed to satisfy constraint: symbol reference attribute");
1138 return ::mlir::success();
1142 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
1144 emitError() <<
"expected DictionaryAttr to set properties";
1145 return ::mlir::failure();
1150 auto attr = dict.get(
"name_ref");
1152 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<
decltype(propStorage)>>(attr);
1153 if (convertedAttr) {
1154 propStorage = convertedAttr;
1156 emitError() <<
"Invalid attribute `name_ref` in property conversion: " << attr;
1157 return ::mlir::failure();
1161 return ::mlir::success();
1165 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
1166 ::mlir::Builder odsBuilder{ctx};
1169 const auto &propStorage = prop.
name_ref;
1171 attrs.push_back(odsBuilder.getNamedAttr(
"name_ref",
1176 return odsBuilder.getDictionaryAttr(attrs);
1181 using llvm::hash_value;
1182 return llvm::hash_combine(
1183 llvm::hash_value(prop.
name_ref.getAsOpaquePointer()));
1187 if (name ==
"name_ref")
1189 return std::nullopt;
1193 if (name ==
"name_ref") {
1194 prop.
name_ref = ::llvm::dyn_cast_or_null<std::remove_reference_t<
decltype(prop.
name_ref)>>(value);
1206 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops5(attr,
"name_ref", emitError)))
1207 return ::mlir::failure();
1209 return ::mlir::success();
1213 auto &prop = state.getOrAddProperties<
Properties>(); (void)prop;
1214 if (::mlir::failed(reader.readAttribute(prop.
name_ref)))
1215 return ::mlir::failure();
1216 return ::mlir::success();
1220 auto &prop = getProperties(); (void)prop;
1221 writer.writeAttribute(prop.
name_ref);
1229void GlobalWriteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::SymbolRefAttr name_ref, ::mlir::Value val) {
1230 odsState.addOperands(val);
1231 odsState.getOrAddProperties<
Properties>().name_ref = name_ref;
1236 build(builder, __state__, std::forward<
decltype(name_ref)>(name_ref), std::forward<
decltype(val)>(val));
1237 auto __res__ = ::llvm::dyn_cast<GlobalWriteOp>(builder.create(__state__));
1238 assert(__res__ &&
"builder didn't return the right type");
1243 return create(builder, builder.getLoc(), std::forward<
decltype(name_ref)>(name_ref), std::forward<
decltype(val)>(val));
1246void GlobalWriteOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::SymbolRefAttr name_ref, ::mlir::Value val) {
1247 odsState.addOperands(val);
1248 odsState.getOrAddProperties<
Properties>().name_ref = name_ref;
1249 assert(resultTypes.size() == 0u &&
"mismatched number of results");
1250 odsState.addTypes(resultTypes);
1255 build(builder, __state__, std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(name_ref)>(name_ref), std::forward<
decltype(val)>(val));
1256 auto __res__ = ::llvm::dyn_cast<GlobalWriteOp>(builder.create(__state__));
1257 assert(__res__ &&
"builder didn't return the right type");
1262 return create(builder, builder.getLoc(), std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(name_ref)>(name_ref), std::forward<
decltype(val)>(val));
1265void GlobalWriteOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
1266 assert(operands.size() == 1u &&
"mismatched number of parameters");
1267 odsState.addOperands(operands);
1268 odsState.addAttributes(attributes);
1269 assert(resultTypes.size() == 0u &&
"mismatched number of return types");
1270 odsState.addTypes(resultTypes);
1272 if (!attributes.empty()) {
1274 ::mlir::PropertyRef properties = odsState.getRawProperties();
1275 std::optional<::mlir::RegisteredOperationName> info =
1276 odsState.name.getRegisteredInfo();
1277 if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
1278 odsState.attributes.getDictionary(odsState.getContext()),
nullptr)))
1279 ::llvm::report_fatal_error(
"Property conversion failed.");
1283GlobalWriteOp GlobalWriteOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
1285 build(builder, __state__, std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(operands)>(operands), std::forward<
decltype(attributes)>(attributes));
1286 auto __res__ = ::llvm::dyn_cast<GlobalWriteOp>(builder.create(__state__));
1287 assert(__res__ &&
"builder didn't return the right type");
1291GlobalWriteOp GlobalWriteOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
1292 return create(builder, builder.getLoc(), std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(operands)>(operands), std::forward<
decltype(attributes)>(attributes));
1295void GlobalWriteOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands,
const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
1296 assert(operands.size() == 1u &&
"mismatched number of parameters");
1297 odsState.addOperands(operands);
1298 odsState.useProperties(
const_cast<Properties&
>(properties));
1299 odsState.addAttributes(discardableAttributes);
1300 assert(resultTypes.size() == 0u &&
"mismatched number of return types");
1301 odsState.addTypes(resultTypes);
1304GlobalWriteOp GlobalWriteOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands,
const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
1306 build(builder, __state__, std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(operands)>(operands), std::forward<
decltype(properties)>(properties), std::forward<
decltype(discardableAttributes)>(discardableAttributes));
1307 auto __res__ = ::llvm::dyn_cast<GlobalWriteOp>(builder.create(__state__));
1308 assert(__res__ &&
"builder didn't return the right type");
1313 return create(builder, builder.getLoc(), std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(operands)>(operands), std::forward<
decltype(properties)>(properties), std::forward<
decltype(discardableAttributes)>(discardableAttributes));
1317 auto tblgen_name_ref = getProperties().name_ref; (void)tblgen_name_ref;
1318 if (!tblgen_name_ref)
return emitOpError(
"requires attribute 'name_ref'");
1320 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops5(*
this, tblgen_name_ref,
"name_ref")))
1321 return ::mlir::failure();
1323 unsigned index = 0; (void)index;
1326 for (
auto v : valueGroup0) {
1327 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*
this, v.getType(),
"operand", index++)))
1328 return ::mlir::failure();
1331 return ::mlir::success();
1339 ::mlir::SymbolRefAttr name_refAttr;
1340 ::mlir::OpAsmParser::UnresolvedOperand valRawOperand{};
1341 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valOperands(&valRawOperand, 1); ::llvm::SMLoc valOperandsLoc;
1342 (void)valOperandsLoc;
1343 ::mlir::Type valRawType{};
1344 ::llvm::ArrayRef<::mlir::Type> valTypes(&valRawType, 1);
1346 if (parser.parseCustomAttributeWithFallback(name_refAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
1347 return ::mlir::failure();
1350 if (parser.parseEqual())
1351 return ::mlir::failure();
1353 valOperandsLoc = parser.getCurrentLocation();
1354 if (parser.parseOperand(valRawOperand))
1355 return ::mlir::failure();
1356 if (parser.parseColon())
1357 return ::mlir::failure();
1361 if (parser.parseCustomTypeWithFallback(type))
1362 return ::mlir::failure();
1366 auto loc = parser.getCurrentLocation();(void)loc;
1367 if (parser.parseOptionalAttrDict(result.attributes))
1368 return ::mlir::failure();
1370 return parser.emitError(loc) <<
"'" << result.name.getStringRef() <<
"' op ";
1372 return ::mlir::failure();
1374 if (parser.resolveOperands(valOperands, valTypes, valOperandsLoc, result.operands))
1375 return ::mlir::failure();
1376 return ::mlir::success();
1382 _odsPrinter <<
' ' <<
"=";
1385 _odsPrinter <<
' ' <<
":";
1388 auto type =
getVal().getType();
1389 if (
auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
1390 _odsPrinter.printStrippedAttrOrType(validType);
1392 _odsPrinter << type;
1394 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
1395 elidedAttrs.push_back(
"name_ref");
1396 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
1400 effects.emplace_back(::mlir::MemoryEffects::Write::get(), 0,
false, ::llzk::global::GlobalMemoryResource::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()
::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
static GlobalDefOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::StringAttr sym_name, ::mlir::UnitAttr constant, ::mlir::TypeAttr type, ::mlir::Attribute initial_value=nullptr)
::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 constexpr ::llvm::StringLiteral getOperationName()
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()
::mlir::StringAttr getNameRefAttrName()
static GlobalReadOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type val, ::mlir::UnitAttr constant, ::mlir::SymbolRefAttr name_ref)
::mlir::UnitAttr getConstantAttr()
FoldAdaptor::Properties Properties
static constexpr ::llvm::StringLiteral getOperationName()
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type val, ::mlir::UnitAttr constant, ::mlir::SymbolRefAttr name_ref)
::mlir::Operation::result_range getODSResults(unsigned index)
::llvm::LogicalResult verifyInvariants()
void print(::mlir::OpAsmPrinter &_odsPrinter)
void setConstant(bool attrValue)
static llvm::hash_code computePropertiesHash(const Properties &prop)
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
::mlir::StringAttr getConstantAttrName()
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()
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()
static constexpr ::llvm::StringLiteral getOperationName()
::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 GlobalWriteOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::SymbolRefAttr name_ref, ::mlir::Value val)
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()
::mlir::UnitAttr getConstantAttr()
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
Common interface for operations that read or write from a global.
Common interface for constant parameter-like symbol operations that can be defined within a TemplateO...
bool isValidGlobalType(Type type)
initial_valueTy initial_value