LLZK 3.0.0
An open-source IR for Zero Knowledge (ZK) circuits
Loading...
Searching...
No Matches
Ops.cpp.inc
Go to the documentation of this file.
1/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
2|* *|
3|* Op Definitions *|
4|* *|
5|* Automatically generated file, do not edit! *|
6|* From: Ops.td *|
7|* *|
8\*===----------------------------------------------------------------------===*/
9
10#ifdef GET_OP_LIST
11#undef GET_OP_LIST
12
16#endif // GET_OP_LIST
17
18#ifdef GET_OP_CLASSES
19#undef GET_OP_CLASSES
20
21
22//===----------------------------------------------------------------------===//
23// Local Utility Method Definitions
24//===----------------------------------------------------------------------===//
25
26
27static ::llvm::LogicalResult __mlir_ods_local_type_constraint_Ops1(
28 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
29 unsigned valueIndex) {
30 if (!((::llzk::isValidGlobalType(type)))) {
31 return op->emitOpError(valueKind) << " #" << valueIndex
32 << " must be any LLZK type except non-constant types, but got " << type;
33 }
34 return ::mlir::success();
35}
36
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();
43}
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();
48 });
49}
50
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();
57}
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();
62 });
63}
64
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();
71}
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();
76 });
77}
78
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();
85}
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();
90 });
91}
92
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();
99}
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();
104 });
105}
106namespace llzk::global {
107
108
109//===----------------------------------------------------------------------===//
110// ::llzk::global::GlobalDefOp definitions
111//===----------------------------------------------------------------------===//
112
113namespace detail {
114
115GlobalDefOpGenericAdaptorBase::GlobalDefOpGenericAdaptorBase(GlobalDefOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
116
118 auto attr = getSymNameAttr();
119 return attr.getValue();
120}
121
123 auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().constant);
124 if (!attr)
125 attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
126 return attr;
127}
128
130 auto attr = getConstantAttr();
131 if (!attr)
132 return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
133 return attr != nullptr;
134}
135
137 auto attr = getTypeAttr();
138 return ::llvm::cast<::mlir::Type>(attr.getValue());
139}
140
142 auto attr = ::llvm::dyn_cast_or_null<::mlir::Attribute>(getProperties().initial_value);
143 return attr;
144}
145
147 auto attr = getInitialValueAttr();
148 return attr;
149}
150
151
152} // namespace detail
154
155::llvm::LogicalResult GlobalDefOpAdaptor::verify(::mlir::Location loc) {
156 auto tblgen_constant = getProperties().constant; (void)tblgen_constant;
157 auto tblgen_initial_value = getProperties().initial_value; (void)tblgen_initial_value;
158 auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
159 if (!tblgen_sym_name) return emitError(loc, "'global.def' op requires attribute 'sym_name'");
160 auto tblgen_type = getProperties().type; (void)tblgen_type;
161 if (!tblgen_type) return emitError(loc, "'global.def' op requires attribute 'type'");
162
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");
165
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");
168
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");
171
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();
175}
176
177::llvm::LogicalResult GlobalDefOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
178 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
179 if (!dict) {
180 emitError() << "expected DictionaryAttr to set properties";
181 return ::mlir::failure();
182 }
183
184 {
185 auto &propStorage = prop.constant;
186 auto attr = dict.get("constant");
187 if (attr) {
188 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
189 if (convertedAttr) {
190 propStorage = convertedAttr;
191 } else {
192 emitError() << "Invalid attribute `constant` in property conversion: " << attr;
193 return ::mlir::failure();
194 }
195 }
196 }
197
198 {
199 auto &propStorage = prop.initial_value;
200 auto attr = dict.get("initial_value");
201 if (attr) {
202 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
203 if (convertedAttr) {
204 propStorage = convertedAttr;
205 } else {
206 emitError() << "Invalid attribute `initial_value` in property conversion: " << attr;
207 return ::mlir::failure();
208 }
209 }
210 }
211
212 {
213 auto &propStorage = prop.sym_name;
214 auto attr = dict.get("sym_name");
215 if (attr) {
216 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
217 if (convertedAttr) {
218 propStorage = convertedAttr;
219 } else {
220 emitError() << "Invalid attribute `sym_name` in property conversion: " << attr;
221 return ::mlir::failure();
222 }
223 }
224 }
225
226 {
227 auto &propStorage = prop.type;
228 auto attr = dict.get("type");
229 if (attr) {
230 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
231 if (convertedAttr) {
232 propStorage = convertedAttr;
233 } else {
234 emitError() << "Invalid attribute `type` in property conversion: " << attr;
235 return ::mlir::failure();
236 }
237 }
238 }
239 return ::mlir::success();
240}
241
242::mlir::Attribute GlobalDefOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
243 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
244 ::mlir::Builder odsBuilder{ctx};
245
246 {
247 const auto &propStorage = prop.constant;
248 if (propStorage)
249 attrs.push_back(odsBuilder.getNamedAttr("constant",
250 propStorage));
251 }
252
253 {
254 const auto &propStorage = prop.initial_value;
255 if (propStorage)
256 attrs.push_back(odsBuilder.getNamedAttr("initial_value",
257 propStorage));
258 }
259
260 {
261 const auto &propStorage = prop.sym_name;
262 if (propStorage)
263 attrs.push_back(odsBuilder.getNamedAttr("sym_name",
264 propStorage));
265 }
266
267 {
268 const auto &propStorage = prop.type;
269 if (propStorage)
270 attrs.push_back(odsBuilder.getNamedAttr("type",
271 propStorage));
272 }
273
274 if (!attrs.empty())
275 return odsBuilder.getDictionaryAttr(attrs);
276 return {};
277}
278
279llvm::hash_code GlobalDefOp::computePropertiesHash(const Properties &prop) {
280 using llvm::hash_value;
281 return llvm::hash_combine(
282 llvm::hash_value(prop.constant.getAsOpaquePointer()),
283 llvm::hash_value(prop.initial_value.getAsOpaquePointer()),
284 llvm::hash_value(prop.sym_name.getAsOpaquePointer()),
285 llvm::hash_value(prop.type.getAsOpaquePointer()));
286}
287
288std::optional<mlir::Attribute> GlobalDefOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
289 if (name == "constant")
290 return prop.constant;
291
292 if (name == "initial_value")
293 return prop.initial_value;
294
295 if (name == "sym_name")
296 return prop.sym_name;
297
298 if (name == "type")
299 return prop.type;
300 return std::nullopt;
301}
302
303void GlobalDefOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
304 if (name == "constant") {
305 prop.constant = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.constant)>>(value);
306 return;
307 }
308
309 if (name == "initial_value") {
310 prop.initial_value = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.initial_value)>>(value);
311 return;
312 }
313
314 if (name == "sym_name") {
315 prop.sym_name = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.sym_name)>>(value);
316 return;
317 }
318
319 if (name == "type") {
320 prop.type = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.type)>>(value);
321 return;
322 }
323}
324
325void GlobalDefOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
326 if (prop.constant) attrs.append("constant", prop.constant);
327
328 if (prop.initial_value) attrs.append("initial_value", prop.initial_value);
329
330 if (prop.sym_name) attrs.append("sym_name", prop.sym_name);
331
332 if (prop.type) attrs.append("type", prop.type);
333}
334
335::llvm::LogicalResult GlobalDefOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
336 {
337 ::mlir::Attribute attr = attrs.get(getConstantAttrName(opName));
338 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops2(attr, "constant", emitError)))
339 return ::mlir::failure();
340 }
341
342 {
343 ::mlir::Attribute attr = attrs.get(getInitialValueAttrName(opName));
344 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops4(attr, "initial_value", emitError)))
345 return ::mlir::failure();
346 }
347
348 {
349 ::mlir::Attribute attr = attrs.get(getSymNameAttrName(opName));
350 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(attr, "sym_name", emitError)))
351 return ::mlir::failure();
352 }
353
354 {
355 ::mlir::Attribute attr = attrs.get(getTypeAttrName(opName));
356 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops3(attr, "type", emitError)))
357 return ::mlir::failure();
358 }
359 return ::mlir::success();
360}
361
362::llvm::LogicalResult GlobalDefOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
363 auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
364 if (::mlir::failed(reader.readOptionalAttribute(prop.constant)))
365 return ::mlir::failure();
366
367 if (::mlir::failed(reader.readOptionalAttribute(prop.initial_value)))
368 return ::mlir::failure();
369
370 if (::mlir::failed(reader.readAttribute(prop.sym_name)))
371 return ::mlir::failure();
372
373 if (::mlir::failed(reader.readAttribute(prop.type)))
374 return ::mlir::failure();
375 return ::mlir::success();
376}
377
378void GlobalDefOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
379 auto &prop = getProperties(); (void)prop;
380
381 writer.writeOptionalAttribute(prop.constant);
382
383 writer.writeOptionalAttribute(prop.initial_value);
384 writer.writeAttribute(prop.sym_name);
385 writer.writeAttribute(prop.type);
386}
387
388::llvm::StringRef GlobalDefOp::getSymName() {
389 auto attr = getSymNameAttr();
390 return attr.getValue();
391}
392
394 auto attr = getConstantAttr();
395 if (!attr)
396 return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
397 return attr != nullptr;
398}
399
400::mlir::Type GlobalDefOp::getType() {
401 auto attr = getTypeAttr();
402 return ::llvm::cast<::mlir::Type>(attr.getValue());
403}
404
405::mlir::Attribute GlobalDefOp::getInitialValue() {
406 auto attr = getInitialValueAttr();
407 return attr;
408}
409
410void GlobalDefOp::setSymName(::llvm::StringRef attrValue) {
411 getProperties().sym_name = ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue);
412}
413
414void GlobalDefOp::setConstant(bool attrValue) {
415 auto &odsProp = getProperties().constant;
416 if (attrValue)
417 odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
418 else
419 odsProp = nullptr;
420}
421
422void GlobalDefOp::setType(::mlir::Type attrValue) {
423 getProperties().type = ::mlir::TypeAttr::get(attrValue);
424}
425
426void GlobalDefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, /*optional*/::mlir::UnitAttr constant, ::mlir::TypeAttr type, ::mlir::Attribute initial_value) {
427 odsState.getOrAddProperties<Properties>().sym_name = sym_name;
428 if (constant) {
429 odsState.getOrAddProperties<Properties>().constant = constant;
430 }
431 odsState.getOrAddProperties<Properties>().type = type;
432 if (initial_value) {
433 odsState.getOrAddProperties<Properties>().initial_value = initial_value;
434 }
435}
436
437GlobalDefOp GlobalDefOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::StringAttr sym_name, /*optional*/::mlir::UnitAttr constant, ::mlir::TypeAttr type, ::mlir::Attribute initial_value) {
438 ::mlir::OperationState __state__(location, getOperationName());
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");
442 return __res__;
443}
444
445GlobalDefOp GlobalDefOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::StringAttr sym_name, /*optional*/::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));
447}
448
449void GlobalDefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, /*optional*/::mlir::UnitAttr constant, ::mlir::TypeAttr type, ::mlir::Attribute initial_value) {
450 odsState.getOrAddProperties<Properties>().sym_name = sym_name;
451 if (constant) {
452 odsState.getOrAddProperties<Properties>().constant = constant;
453 }
454 odsState.getOrAddProperties<Properties>().type = type;
455 if (initial_value) {
456 odsState.getOrAddProperties<Properties>().initial_value = initial_value;
457 }
458 assert(resultTypes.size() == 0u && "mismatched number of results");
459 odsState.addTypes(resultTypes);
460}
461
462GlobalDefOp GlobalDefOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, /*optional*/::mlir::UnitAttr constant, ::mlir::TypeAttr type, ::mlir::Attribute initial_value) {
463 ::mlir::OperationState __state__(location, getOperationName());
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");
467 return __res__;
468}
469
470GlobalDefOp GlobalDefOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, /*optional*/::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));
472}
473
474void GlobalDefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, /*optional*/bool constant, ::mlir::Type type, ::mlir::Attribute initial_value) {
475 odsState.getOrAddProperties<Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
476 if (constant) {
477 odsState.getOrAddProperties<Properties>().constant = ((constant) ? odsBuilder.getUnitAttr() : nullptr);
478 }
479 odsState.getOrAddProperties<Properties>().type = ::mlir::TypeAttr::get(type);
480 odsState.getOrAddProperties<Properties>().initial_value = initial_value;
481}
482
483GlobalDefOp GlobalDefOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::llvm::StringRef sym_name, /*optional*/bool constant, ::mlir::Type type, ::mlir::Attribute initial_value) {
484 ::mlir::OperationState __state__(location, getOperationName());
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");
488 return __res__;
489}
490
491GlobalDefOp GlobalDefOp::create(::mlir::ImplicitLocOpBuilder &builder, ::llvm::StringRef sym_name, /*optional*/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));
493}
494
495void GlobalDefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, /*optional*/bool constant, ::mlir::Type type, ::mlir::Attribute initial_value) {
496 odsState.getOrAddProperties<Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
497 if (constant) {
498 odsState.getOrAddProperties<Properties>().constant = ((constant) ? odsBuilder.getUnitAttr() : nullptr);
499 }
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);
504}
505
506GlobalDefOp GlobalDefOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, /*optional*/bool constant, ::mlir::Type type, ::mlir::Attribute initial_value) {
507 ::mlir::OperationState __state__(location, getOperationName());
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");
511 return __res__;
512}
513
514GlobalDefOp GlobalDefOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, /*optional*/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));
516}
517
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);
524
525 if (!attributes.empty()) {
526 (void)odsState.getOrAddProperties<GlobalDefOp::Properties>();
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.");
533 }
534}
535
536GlobalDefOp GlobalDefOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
537 ::mlir::OperationState __state__(location, getOperationName());
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");
541 return __res__;
542}
543
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));
546}
547
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);
555}
556
557GlobalDefOp GlobalDefOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
558 ::mlir::OperationState __state__(location, getOperationName());
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");
562 return __res__;
563}
564
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));
567}
568
569void GlobalDefOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) {
570 ::mlir::Builder odsBuilder(opName.getContext());
571 if (!properties.initial_value)
572 properties.initial_value = nullptr;
573}
574
575::llvm::LogicalResult GlobalDefOp::verifyInvariantsImpl() {
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'");
582
583 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(*this, tblgen_sym_name, "sym_name")))
584 return ::mlir::failure();
585
586 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops2(*this, tblgen_constant, "constant")))
587 return ::mlir::failure();
588
589 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops3(*this, tblgen_type, "type")))
590 return ::mlir::failure();
591
592 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops4(*this, tblgen_initial_value, "initial_value")))
593 return ::mlir::failure();
594 return ::mlir::success();
595}
596
597::llvm::LogicalResult GlobalDefOp::verifyInvariants() {
598 if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
599 return ::mlir::success();
600 return ::mlir::failure();
601}
602
603::llvm::LogicalResult GlobalDefOp::setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
604 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
605 if (!dict) {
606 emitError() << "expected DictionaryAttr to set properties";
607 return ::mlir::failure();
608 }
609 // keep track of used keys in the input dictionary to be able to error out
610 // if there are some unknown ones.
611 ::mlir::DenseSet<::mlir::StringAttr> usedKeys;
612 ::mlir::MLIRContext *ctx = dict.getContext();
613 (void)ctx;
614 {
615
616 auto &propStorage = prop.sym_name;
617 auto sym_nameAttrName = ::mlir::StringAttr::get(ctx, "sym_name");
618 auto attr = dict.get(sym_nameAttrName);
619 usedKeys.insert(sym_nameAttrName);
620 if (attr || /*isRequired=*/true) {
621 if (!attr) {
622 emitError() << "expected key entry for sym_name in DictionaryAttr to set "
623 "Properties.";
624 return ::mlir::failure();
625 }
626 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
627 if (convertedAttr) {
628 propStorage = convertedAttr;
629 } else {
630 emitError() << "Invalid attribute `sym_name` in property conversion: " << attr;
631 return ::mlir::failure();
632 }
633 }
634 }
635 {
636
637 auto &propStorage = prop.constant;
638 auto constantAttrName = ::mlir::StringAttr::get(ctx, "constant");
639 auto attr = dict.get(constantAttrName);
640 usedKeys.insert(constantAttrName);
641 if (attr || /*isRequired=*/false) {
642 if (!attr) {
643 emitError() << "expected key entry for constant in DictionaryAttr to set "
644 "Properties.";
645 return ::mlir::failure();
646 }
647 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
648 if (convertedAttr) {
649 propStorage = convertedAttr;
650 } else {
651 emitError() << "Invalid attribute `constant` in property conversion: " << attr;
652 return ::mlir::failure();
653 }
654 }
655 }
656 {
657
658 auto &propStorage = prop.type;
659 auto typeAttrName = ::mlir::StringAttr::get(ctx, "type");
660 auto attr = dict.get(typeAttrName);
661 usedKeys.insert(typeAttrName);
662 if (attr || /*isRequired=*/true) {
663 if (!attr) {
664 emitError() << "expected key entry for type in DictionaryAttr to set "
665 "Properties.";
666 return ::mlir::failure();
667 }
668 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
669 if (convertedAttr) {
670 propStorage = convertedAttr;
671 } else {
672 emitError() << "Invalid attribute `type` in property conversion: " << attr;
673 return ::mlir::failure();
674 }
675 }
676 }
677 {
678
679 auto &propStorage = prop.initial_value;
680 auto initial_valueAttrName = ::mlir::StringAttr::get(ctx, "initial_value");
681 auto attr = dict.get(initial_valueAttrName);
682 usedKeys.insert(initial_valueAttrName);
683 if (attr || /*isRequired=*/false) {
684 if (!attr) {
685 emitError() << "expected key entry for initial_value in DictionaryAttr to set "
686 "Properties.";
687 return ::mlir::failure();
688 }
689 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
690 if (convertedAttr) {
691 propStorage = convertedAttr;
692 } else {
693 emitError() << "Invalid attribute `initial_value` in property conversion: " << attr;
694 return ::mlir::failure();
695 }
696 }
697 }
698
699 for (::mlir::NamedAttribute attr : dict) {
700 if (!usedKeys.contains(attr.getName()))
701 return emitError() << "unknown key '" << attr.getName() <<
702 "' when parsing properties dictionary";
703 }
704 return ::mlir::success();
705}
706
707
708} // namespace llzk::global
709MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::global::GlobalDefOp)
711
712namespace llzk::global {
713
714
715//===----------------------------------------------------------------------===//
716// ::llzk::global::GlobalReadOp definitions
717//===----------------------------------------------------------------------===//
718
719namespace detail {
720
721GlobalReadOpGenericAdaptorBase::GlobalReadOpGenericAdaptorBase(GlobalReadOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
722
724 auto attr = ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().constant);
725 if (!attr)
726 attr = ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr);
727 return attr;
728}
729
731 auto attr = getConstantAttr();
732 if (!attr)
733 return ((false) ? ::mlir::Builder(odsAttrs.getContext()).getUnitAttr() : nullptr) != nullptr;
734 return attr != nullptr;
735}
736
738 auto attr = getNameRefAttr();
739 return attr;
740}
741
742
743} // namespace detail
745
746::llvm::LogicalResult GlobalReadOpAdaptor::verify(::mlir::Location loc) {
747 auto tblgen_constant = getProperties().constant; (void)tblgen_constant;
748 auto tblgen_name_ref = getProperties().name_ref; (void)tblgen_name_ref;
749 if (!tblgen_name_ref) return emitError(loc, "'global.read' op requires attribute 'name_ref'");
750
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");
753
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();
757}
758
759::llvm::LogicalResult GlobalReadOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
760 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
761 if (!dict) {
762 emitError() << "expected DictionaryAttr to set properties";
763 return ::mlir::failure();
764 }
765
766 {
767 auto &propStorage = prop.constant;
768 auto attr = dict.get("constant");
769 if (attr) {
770 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
771 if (convertedAttr) {
772 propStorage = convertedAttr;
773 } else {
774 emitError() << "Invalid attribute `constant` in property conversion: " << attr;
775 return ::mlir::failure();
776 }
777 }
778 }
779
780 {
781 auto &propStorage = prop.name_ref;
782 auto attr = dict.get("name_ref");
783 if (attr) {
784 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
785 if (convertedAttr) {
786 propStorage = convertedAttr;
787 } else {
788 emitError() << "Invalid attribute `name_ref` in property conversion: " << attr;
789 return ::mlir::failure();
790 }
791 }
792 }
793 return ::mlir::success();
794}
795
796::mlir::Attribute GlobalReadOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
797 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
798 ::mlir::Builder odsBuilder{ctx};
799
800 {
801 const auto &propStorage = prop.constant;
802 if (propStorage)
803 attrs.push_back(odsBuilder.getNamedAttr("constant",
804 propStorage));
805 }
806
807 {
808 const auto &propStorage = prop.name_ref;
809 if (propStorage)
810 attrs.push_back(odsBuilder.getNamedAttr("name_ref",
811 propStorage));
812 }
813
814 if (!attrs.empty())
815 return odsBuilder.getDictionaryAttr(attrs);
816 return {};
817}
818
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()));
824}
825
826std::optional<mlir::Attribute> GlobalReadOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
827 if (name == "constant")
828 return prop.constant;
829
830 if (name == "name_ref")
831 return prop.name_ref;
832 return std::nullopt;
833}
834
835void GlobalReadOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
836 if (name == "constant") {
837 prop.constant = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.constant)>>(value);
838 return;
839 }
840
841 if (name == "name_ref") {
842 prop.name_ref = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.name_ref)>>(value);
843 return;
844 }
845}
846
847void GlobalReadOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
848 if (prop.constant) attrs.append("constant", prop.constant);
849
850 if (prop.name_ref) attrs.append("name_ref", prop.name_ref);
851}
852
853::llvm::LogicalResult GlobalReadOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
854 {
855 ::mlir::Attribute attr = attrs.get(getConstantAttrName(opName));
856 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops2(attr, "constant", emitError)))
857 return ::mlir::failure();
858 }
859
860 {
861 ::mlir::Attribute attr = attrs.get(getNameRefAttrName(opName));
862 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops5(attr, "name_ref", emitError)))
863 return ::mlir::failure();
864 }
865 return ::mlir::success();
866}
867
869 auto attr = getConstantAttr();
870 if (!attr)
871 return ((false) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr) != nullptr;
872 return attr != nullptr;
873}
874
875::mlir::SymbolRefAttr GlobalReadOp::getNameRef() {
876 auto attr = getNameRefAttr();
877 return attr;
878}
879
880void GlobalReadOp::setConstant(bool attrValue) {
881 auto &odsProp = getProperties().constant;
882 if (attrValue)
883 odsProp = ((attrValue) ? ::mlir::Builder((*this)->getContext()).getUnitAttr() : nullptr);
884 else
885 odsProp = nullptr;
886}
887
888void GlobalReadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type val, /*optional*/::mlir::UnitAttr constant, ::mlir::SymbolRefAttr name_ref) {
889 if (constant) {
890 odsState.getOrAddProperties<Properties>().constant = constant;
891 }
892 odsState.getOrAddProperties<Properties>().name_ref = name_ref;
893 odsState.addTypes(val);
894}
895
896GlobalReadOp GlobalReadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type val, /*optional*/::mlir::UnitAttr constant, ::mlir::SymbolRefAttr name_ref) {
897 ::mlir::OperationState __state__(location, getOperationName());
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");
901 return __res__;
902}
903
904GlobalReadOp GlobalReadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type val, /*optional*/::mlir::UnitAttr constant, ::mlir::SymbolRefAttr name_ref) {
905 return create(builder, builder.getLoc(), std::forward<decltype(val)>(val), std::forward<decltype(constant)>(constant), std::forward<decltype(name_ref)>(name_ref));
906}
907
908void GlobalReadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::UnitAttr constant, ::mlir::SymbolRefAttr name_ref) {
909 if (constant) {
910 odsState.getOrAddProperties<Properties>().constant = constant;
911 }
912 odsState.getOrAddProperties<Properties>().name_ref = name_ref;
913 assert(resultTypes.size() == 1u && "mismatched number of results");
914 odsState.addTypes(resultTypes);
915}
916
917GlobalReadOp GlobalReadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, /*optional*/::mlir::UnitAttr constant, ::mlir::SymbolRefAttr name_ref) {
918 ::mlir::OperationState __state__(location, getOperationName());
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");
922 return __res__;
923}
924
925GlobalReadOp GlobalReadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, /*optional*/::mlir::UnitAttr constant, ::mlir::SymbolRefAttr name_ref) {
926 return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(constant)>(constant), std::forward<decltype(name_ref)>(name_ref));
927}
928
929void GlobalReadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type val, /*optional*/bool constant, ::mlir::SymbolRefAttr name_ref) {
930 if (constant) {
931 odsState.getOrAddProperties<Properties>().constant = ((constant) ? odsBuilder.getUnitAttr() : nullptr);
932 }
933 odsState.getOrAddProperties<Properties>().name_ref = name_ref;
934 odsState.addTypes(val);
935}
936
937GlobalReadOp GlobalReadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type val, /*optional*/bool constant, ::mlir::SymbolRefAttr name_ref) {
938 ::mlir::OperationState __state__(location, getOperationName());
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");
942 return __res__;
943}
944
945GlobalReadOp GlobalReadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type val, /*optional*/bool constant, ::mlir::SymbolRefAttr name_ref) {
946 return create(builder, builder.getLoc(), std::forward<decltype(val)>(val), std::forward<decltype(constant)>(constant), std::forward<decltype(name_ref)>(name_ref));
947}
948
949void GlobalReadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/bool constant, ::mlir::SymbolRefAttr name_ref) {
950 if (constant) {
951 odsState.getOrAddProperties<Properties>().constant = ((constant) ? odsBuilder.getUnitAttr() : nullptr);
952 }
953 odsState.getOrAddProperties<Properties>().name_ref = name_ref;
954 assert(resultTypes.size() == 1u && "mismatched number of results");
955 odsState.addTypes(resultTypes);
956}
957
958GlobalReadOp GlobalReadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, /*optional*/bool constant, ::mlir::SymbolRefAttr name_ref) {
959 ::mlir::OperationState __state__(location, getOperationName());
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");
963 return __res__;
964}
965
966GlobalReadOp GlobalReadOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, /*optional*/bool constant, ::mlir::SymbolRefAttr name_ref) {
967 return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(constant)>(constant), std::forward<decltype(name_ref)>(name_ref));
968}
969
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);
976
977 if (!attributes.empty()) {
978 (void)odsState.getOrAddProperties<GlobalReadOp::Properties>();
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.");
985 }
986}
987
988GlobalReadOp GlobalReadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
989 ::mlir::OperationState __state__(location, getOperationName());
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");
993 return __res__;
994}
995
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));
998}
999
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);
1007}
1008
1009GlobalReadOp GlobalReadOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
1010 ::mlir::OperationState __state__(location, getOperationName());
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");
1014 return __res__;
1015}
1016
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));
1019}
1020
1021::llvm::LogicalResult GlobalReadOp::verifyInvariantsImpl() {
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'");
1025
1026 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops2(*this, tblgen_constant, "constant")))
1027 return ::mlir::failure();
1028
1029 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops5(*this, tblgen_name_ref, "name_ref")))
1030 return ::mlir::failure();
1031 {
1032 unsigned index = 0; (void)index;
1033 auto valueGroup0 = getODSResults(0);
1034
1035 for (auto v : valueGroup0) {
1036 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*this, v.getType(), "result", index++)))
1037 return ::mlir::failure();
1038 }
1039 }
1040 return ::mlir::success();
1041}
1042
1043::llvm::LogicalResult GlobalReadOp::verifyInvariants() {
1044 return verifyInvariantsImpl();
1045}
1046
1047::mlir::ParseResult GlobalReadOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
1048 ::mlir::SymbolRefAttr name_refAttr;
1049 ::mlir::Type valRawType{};
1050 ::llvm::ArrayRef<::mlir::Type> valTypes(&valRawType, 1);
1051 if (::mlir::succeeded(parser.parseOptionalKeyword("const"))) {
1052 result.getOrAddProperties<GlobalReadOp::Properties>().constant = parser.getBuilder().getUnitAttr(); }
1053
1054 if (parser.parseCustomAttributeWithFallback(name_refAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
1055 return ::mlir::failure();
1056 }
1057 if (name_refAttr) result.getOrAddProperties<GlobalReadOp::Properties>().name_ref = name_refAttr;
1058 if (parser.parseColon())
1059 return ::mlir::failure();
1060
1061 {
1062 ::mlir::Type type;
1063 if (parser.parseCustomTypeWithFallback(type))
1064 return ::mlir::failure();
1065 valRawType = type;
1066 }
1067 {
1068 auto loc = parser.getCurrentLocation();(void)loc;
1069 if (parser.parseOptionalAttrDict(result.attributes))
1070 return ::mlir::failure();
1071 if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
1072 return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
1073 })))
1074 return ::mlir::failure();
1075 }
1076 result.addTypes(valTypes);
1077 return ::mlir::success();
1078}
1079
1080void GlobalReadOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
1081 if ((getConstantAttr() && getConstantAttr() != ((false) ? ::mlir::OpBuilder((*this)->getContext()).getUnitAttr() : nullptr))) {
1082 _odsPrinter << ' ' << "const";
1083 }
1084 _odsPrinter << ' ';
1085 _odsPrinter.printAttributeWithoutType(getNameRefAttr());
1086 _odsPrinter << ' ' << ":";
1087 _odsPrinter << ' ';
1088 {
1089 auto type = getVal().getType();
1090 if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
1091 _odsPrinter.printStrippedAttrOrType(validType);
1092 else
1093 _odsPrinter << type;
1094 }
1095 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
1096 elidedAttrs.push_back("constant");
1097 elidedAttrs.push_back("name_ref");
1098 {
1099 ::mlir::Builder odsBuilder(getContext());
1100 ::mlir::Attribute attr = getConstantAttr();
1101 if(attr && (attr == ((false) ? odsBuilder.getUnitAttr() : nullptr)))
1102 elidedAttrs.push_back("constant");
1103 }
1104 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
1105}
1106
1107
1108} // namespace llzk::global
1109MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::global::GlobalReadOp)
1111
1112namespace llzk::global {
1113
1114
1115//===----------------------------------------------------------------------===//
1116// ::llzk::global::GlobalWriteOp definitions
1117//===----------------------------------------------------------------------===//
1118
1119namespace detail {
1120
1122
1124 auto attr = getNameRefAttr();
1125 return attr;
1126}
1127
1128
1129} // namespace detail
1131
1132::llvm::LogicalResult GlobalWriteOpAdaptor::verify(::mlir::Location loc) {
1133 auto tblgen_name_ref = getProperties().name_ref; (void)tblgen_name_ref;
1134 if (!tblgen_name_ref) return emitError(loc, "'global.write' op requires attribute 'name_ref'");
1135
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();
1139}
1140
1141::llvm::LogicalResult GlobalWriteOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
1142 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
1143 if (!dict) {
1144 emitError() << "expected DictionaryAttr to set properties";
1145 return ::mlir::failure();
1146 }
1147
1148 {
1149 auto &propStorage = prop.name_ref;
1150 auto attr = dict.get("name_ref");
1151 if (attr) {
1152 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
1153 if (convertedAttr) {
1154 propStorage = convertedAttr;
1155 } else {
1156 emitError() << "Invalid attribute `name_ref` in property conversion: " << attr;
1157 return ::mlir::failure();
1158 }
1159 }
1160 }
1161 return ::mlir::success();
1162}
1163
1164::mlir::Attribute GlobalWriteOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
1165 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
1166 ::mlir::Builder odsBuilder{ctx};
1167
1168 {
1169 const auto &propStorage = prop.name_ref;
1170 if (propStorage)
1171 attrs.push_back(odsBuilder.getNamedAttr("name_ref",
1172 propStorage));
1173 }
1174
1175 if (!attrs.empty())
1176 return odsBuilder.getDictionaryAttr(attrs);
1177 return {};
1178}
1179
1181 using llvm::hash_value;
1182 return llvm::hash_combine(
1183 llvm::hash_value(prop.name_ref.getAsOpaquePointer()));
1184}
1185
1186std::optional<mlir::Attribute> GlobalWriteOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
1187 if (name == "name_ref")
1188 return prop.name_ref;
1189 return std::nullopt;
1190}
1191
1192void GlobalWriteOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
1193 if (name == "name_ref") {
1194 prop.name_ref = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.name_ref)>>(value);
1195 return;
1196 }
1197}
1198
1199void GlobalWriteOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
1200 if (prop.name_ref) attrs.append("name_ref", prop.name_ref);
1201}
1202
1203::llvm::LogicalResult GlobalWriteOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
1204 {
1205 ::mlir::Attribute attr = attrs.get(getNameRefAttrName(opName));
1206 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops5(attr, "name_ref", emitError)))
1207 return ::mlir::failure();
1208 }
1209 return ::mlir::success();
1210}
1211
1212::llvm::LogicalResult GlobalWriteOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
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();
1217}
1218
1219void GlobalWriteOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
1220 auto &prop = getProperties(); (void)prop;
1221 writer.writeAttribute(prop.name_ref);
1222}
1223
1224::mlir::SymbolRefAttr GlobalWriteOp::getNameRef() {
1225 auto attr = getNameRefAttr();
1226 return attr;
1227}
1228
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;
1232}
1233
1234GlobalWriteOp GlobalWriteOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::SymbolRefAttr name_ref, ::mlir::Value val) {
1235 ::mlir::OperationState __state__(location, getOperationName());
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");
1239 return __res__;
1240}
1241
1242GlobalWriteOp GlobalWriteOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::SymbolRefAttr name_ref, ::mlir::Value val) {
1243 return create(builder, builder.getLoc(), std::forward<decltype(name_ref)>(name_ref), std::forward<decltype(val)>(val));
1244}
1245
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);
1251}
1252
1253GlobalWriteOp GlobalWriteOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::SymbolRefAttr name_ref, ::mlir::Value val) {
1254 ::mlir::OperationState __state__(location, getOperationName());
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");
1258 return __res__;
1259}
1260
1261GlobalWriteOp GlobalWriteOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::SymbolRefAttr name_ref, ::mlir::Value val) {
1262 return create(builder, builder.getLoc(), std::forward<decltype(resultTypes)>(resultTypes), std::forward<decltype(name_ref)>(name_ref), std::forward<decltype(val)>(val));
1263}
1264
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);
1271
1272 if (!attributes.empty()) {
1273 (void)odsState.getOrAddProperties<GlobalWriteOp::Properties>();
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.");
1280 }
1281}
1282
1283GlobalWriteOp GlobalWriteOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
1284 ::mlir::OperationState __state__(location, getOperationName());
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");
1288 return __res__;
1289}
1290
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));
1293}
1294
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);
1302}
1303
1304GlobalWriteOp GlobalWriteOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
1305 ::mlir::OperationState __state__(location, getOperationName());
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");
1309 return __res__;
1310}
1311
1312GlobalWriteOp GlobalWriteOp::create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
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));
1314}
1315
1317 auto tblgen_name_ref = getProperties().name_ref; (void)tblgen_name_ref;
1318 if (!tblgen_name_ref) return emitOpError("requires attribute 'name_ref'");
1319
1320 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops5(*this, tblgen_name_ref, "name_ref")))
1321 return ::mlir::failure();
1322 {
1323 unsigned index = 0; (void)index;
1324 auto valueGroup0 = getODSOperands(0);
1325
1326 for (auto v : valueGroup0) {
1327 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*this, v.getType(), "operand", index++)))
1328 return ::mlir::failure();
1329 }
1330 }
1331 return ::mlir::success();
1332}
1333
1334::llvm::LogicalResult GlobalWriteOp::verifyInvariants() {
1335 return verifyInvariantsImpl();
1336}
1337
1338::mlir::ParseResult GlobalWriteOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
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);
1345
1346 if (parser.parseCustomAttributeWithFallback(name_refAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
1347 return ::mlir::failure();
1348 }
1349 if (name_refAttr) result.getOrAddProperties<GlobalWriteOp::Properties>().name_ref = name_refAttr;
1350 if (parser.parseEqual())
1351 return ::mlir::failure();
1352
1353 valOperandsLoc = parser.getCurrentLocation();
1354 if (parser.parseOperand(valRawOperand))
1355 return ::mlir::failure();
1356 if (parser.parseColon())
1357 return ::mlir::failure();
1358
1359 {
1360 ::mlir::Type type;
1361 if (parser.parseCustomTypeWithFallback(type))
1362 return ::mlir::failure();
1363 valRawType = type;
1364 }
1365 {
1366 auto loc = parser.getCurrentLocation();(void)loc;
1367 if (parser.parseOptionalAttrDict(result.attributes))
1368 return ::mlir::failure();
1369 if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
1370 return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
1371 })))
1372 return ::mlir::failure();
1373 }
1374 if (parser.resolveOperands(valOperands, valTypes, valOperandsLoc, result.operands))
1375 return ::mlir::failure();
1376 return ::mlir::success();
1377}
1378
1379void GlobalWriteOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
1380 _odsPrinter << ' ';
1381 _odsPrinter.printAttributeWithoutType(getNameRefAttr());
1382 _odsPrinter << ' ' << "=";
1383 _odsPrinter << ' ';
1384 _odsPrinter << getVal();
1385 _odsPrinter << ' ' << ":";
1386 _odsPrinter << ' ';
1387 {
1388 auto type = getVal().getType();
1389 if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
1390 _odsPrinter.printStrippedAttrOrType(validType);
1391 else
1392 _odsPrinter << type;
1393 }
1394 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
1395 elidedAttrs.push_back("name_ref");
1396 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
1397}
1398
1399void GlobalWriteOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
1400 effects.emplace_back(::mlir::MemoryEffects::Write::get(), 0, false, ::llzk::global::GlobalMemoryResource::get());
1401}
1402
1403
1404} // namespace llzk::global
1405MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::global::GlobalWriteOp)
1407
1408
1409#endif // GET_OP_CLASSES
1410
::llvm::LogicalResult verify(::mlir::Location loc)
Definition Ops.cpp.inc:155
GlobalDefOpAdaptor(GlobalDefOp op)
Definition Ops.cpp.inc:153
GlobalDefOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
Definition Ops.h.inc:167
::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:335
static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties)
Definition Ops.cpp.inc:569
FoldAdaptor::Properties Properties
Definition Ops.h.inc:210
::mlir::Attribute getInitialValue()
Definition Ops.cpp.inc:405
void setType(::mlir::Type attrValue)
Definition Ops.cpp.inc:422
::mlir::Type getType()
Definition Ops.cpp.inc:400
::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state)
Definition Ops.cpp.inc:362
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
Definition Ops.cpp.inc:288
::llvm::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:597
::mlir::TypeAttr getTypeAttr()
Definition Ops.h.inc:291
::llvm::StringRef getSymName()
Definition Ops.cpp.inc:388
::mlir::StringAttr getSymNameAttrName()
Definition Ops.h.inc:232
::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:603
static GlobalDefOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::StringAttr sym_name, ::mlir::UnitAttr constant, ::mlir::TypeAttr type, ::mlir::Attribute initial_value=nullptr)
Definition Ops.cpp.inc:437
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
Definition Ops.cpp.inc:242
::mlir::Attribute getInitialValueAttr()
Definition Ops.h.inc:296
::mlir::StringAttr getSymNameAttr()
Definition Ops.h.inc:281
::mlir::UnitAttr getConstantAttr()
Definition Ops.h.inc:286
void setSymName(::llvm::StringRef attrValue)
Definition Ops.cpp.inc:410
void writeProperties(::mlir::DialectBytecodeWriter &writer)
Definition Ops.cpp.inc:378
::llvm::LogicalResult verifyInvariantsImpl()
Definition Ops.cpp.inc:575
::mlir::StringAttr getTypeAttrName()
Definition Ops.h.inc:240
void setConstant(bool attrValue)
Definition Ops.cpp.inc:414
::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:177
static constexpr ::llvm::StringLiteral getOperationName()
Definition Ops.h.inc:248
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
Definition Ops.cpp.inc:325
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::UnitAttr constant, ::mlir::TypeAttr type, ::mlir::Attribute initial_value=nullptr)
Definition Ops.cpp.inc:426
::mlir::StringAttr getInitialValueAttrName()
Definition Ops.h.inc:224
::llvm::LogicalResult verify()
Definition Ops.cpp:399
static llvm::hash_code computePropertiesHash(const Properties &prop)
Definition Ops.cpp.inc:279
::mlir::StringAttr getConstantAttrName()
Definition Ops.h.inc:216
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
Definition Ops.cpp.inc:303
GlobalReadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
Definition Ops.h.inc:456
::llvm::LogicalResult verify(::mlir::Location loc)
Definition Ops.cpp.inc:746
GlobalReadOpAdaptor(GlobalReadOp op)
Definition Ops.cpp.inc:744
::mlir::StringAttr getNameRefAttrName()
Definition Ops.h.inc:513
static GlobalReadOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type val, ::mlir::UnitAttr constant, ::mlir::SymbolRefAttr name_ref)
Definition Ops.cpp.inc:896
::mlir::UnitAttr getConstantAttr()
Definition Ops.h.inc:558
FoldAdaptor::Properties Properties
Definition Ops.h.inc:499
static constexpr ::llvm::StringLiteral getOperationName()
Definition Ops.h.inc:521
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
Definition Ops.cpp.inc:796
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type val, ::mlir::UnitAttr constant, ::mlir::SymbolRefAttr name_ref)
Definition Ops.cpp.inc:888
::mlir::Operation::result_range getODSResults(unsigned index)
Definition Ops.h.inc:539
::llvm::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:1043
void print(::mlir::OpAsmPrinter &_odsPrinter)
Definition Ops.cpp.inc:1080
void setConstant(bool attrValue)
Definition Ops.cpp.inc:880
static llvm::hash_code computePropertiesHash(const Properties &prop)
Definition Ops.cpp.inc:819
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
Definition Ops.cpp.inc:1047
::mlir::StringAttr getConstantAttrName()
Definition Ops.h.inc:505
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
Definition Ops.cpp.inc:826
::mlir::SymbolRefAttr getNameRefAttr()
Definition Ops.h.inc:563
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
Definition Ops.cpp.inc:835
::mlir::TypedValue<::mlir::Type > getVal()
Definition Ops.h.inc:545
::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:759
::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:853
::mlir::SymbolRefAttr getNameRef()
Definition Ops.cpp.inc:875
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
Definition Ops.cpp.inc:847
::llvm::LogicalResult verifyInvariantsImpl()
Definition Ops.cpp.inc:1021
GlobalWriteOpAdaptor(GlobalWriteOp op)
Definition Ops.cpp.inc:1130
GlobalWriteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
Definition Ops.h.inc:699
::llvm::LogicalResult verify(::mlir::Location loc)
Definition Ops.cpp.inc:1132
::mlir::TypedValue<::mlir::Type > getVal()
Definition Ops.h.inc:775
static llvm::hash_code computePropertiesHash(const Properties &prop)
Definition Ops.cpp.inc:1180
::mlir::StringAttr getNameRefAttrName()
Definition Ops.h.inc:753
static constexpr ::llvm::StringLiteral getOperationName()
Definition Ops.h.inc:761
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
Definition Ops.cpp.inc:1338
::mlir::SymbolRefAttr getNameRefAttr()
Definition Ops.h.inc:803
::mlir::Operation::operand_range getODSOperands(unsigned index)
Definition Ops.h.inc:769
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
Definition Ops.cpp.inc:1199
void print(::mlir::OpAsmPrinter &_odsPrinter)
Definition Ops.cpp.inc:1379
FoldAdaptor::Properties Properties
Definition Ops.h.inc:747
::llvm::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:1334
void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect > > &effects)
Definition Ops.cpp.inc:1399
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
Definition Ops.cpp.inc:1164
::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:1203
static GlobalWriteOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::SymbolRefAttr name_ref, ::mlir::Value val)
Definition Ops.cpp.inc:1234
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::SymbolRefAttr name_ref, ::mlir::Value val)
Definition Ops.cpp.inc:1229
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
Definition Ops.cpp.inc:1192
void writeProperties(::mlir::DialectBytecodeWriter &writer)
Definition Ops.cpp.inc:1219
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
Definition Ops.cpp.inc:1186
::llvm::LogicalResult verifyInvariantsImpl()
Definition Ops.cpp.inc:1316
::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:1141
::mlir::SymbolRefAttr getNameRef()
Definition Ops.cpp.inc:1224
::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state)
Definition Ops.cpp.inc:1212
GlobalDefOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
Definition Ops.h.inc:125
::std::optional<::mlir::OperationName > odsOpName
Definition Ops.h.inc:121
GlobalReadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
Definition Ops.h.inc:422
::std::optional<::mlir::OperationName > odsOpName
Definition Ops.h.inc:418
::std::optional<::mlir::OperationName > odsOpName
Definition Ops.h.inc:662
GlobalWriteOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
Definition Ops.h.inc:666
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)