LLZK 0.1.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
26namespace llzk {
27namespace pod {
28
29static ::llvm::LogicalResult __mlir_ods_local_type_constraint_Ops1(
30 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
31 unsigned valueIndex) {
32 if (!((::llzk::isValidType(type)))) {
33 return op->emitOpError(valueKind) << " #" << valueIndex
34 << " must be variadic of a valid LLZK type, but got " << type;
35 }
36 return ::mlir::success();
37}
38
39static ::llvm::LogicalResult __mlir_ods_local_type_constraint_Ops2(
40 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
41 unsigned valueIndex) {
42 if (!((::llvm::isa<::mlir::IndexType>(type)))) {
43 return op->emitOpError(valueKind) << " #" << valueIndex
44 << " must be variadic of index, but got " << type;
45 }
46 return ::mlir::success();
47}
48
49static ::llvm::LogicalResult __mlir_ods_local_type_constraint_Ops3(
50 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
51 unsigned valueIndex) {
52 if (!((::llvm::isa<::llzk::pod::PodType>(type)))) {
53 return op->emitOpError(valueKind) << " #" << valueIndex
54 << " must be plain-old-data struct, but got " << type;
55 }
56 return ::mlir::success();
57}
58
59static ::llvm::LogicalResult __mlir_ods_local_type_constraint_Ops4(
60 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
61 unsigned valueIndex) {
62 if (!((::llzk::isValidType(type)))) {
63 return op->emitOpError(valueKind) << " #" << valueIndex
64 << " must be a valid LLZK type, but got " << type;
65 }
66 return ::mlir::success();
67}
68
69static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops1(
70 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
71 if (attr && !(((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::StringAttr>(attr))); }))))
72 return emitError() << "attribute '" << attrName
73 << "' failed to satisfy constraint: string array attribute";
74 return ::mlir::success();
75}
76static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops1(
77 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
78 return __mlir_ods_local_attr_constraint_Ops1(attr, attrName, [op]() {
79 return op->emitOpError();
80 });
81}
82
83static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops2(
84 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
85 if (attr && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(attr))))
86 return emitError() << "attribute '" << attrName
87 << "' failed to satisfy constraint: i32 dense array attribute";
88 return ::mlir::success();
89}
90static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops2(
91 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
92 return __mlir_ods_local_attr_constraint_Ops2(attr, attrName, [op]() {
93 return op->emitOpError();
94 });
95}
96
97static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops3(
98 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
99 if (attr && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(attr))))
100 return emitError() << "attribute '" << attrName
101 << "' failed to satisfy constraint: flat symbol reference attribute";
102 return ::mlir::success();
103}
104static ::llvm::LogicalResult __mlir_ods_local_attr_constraint_Ops3(
105 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
106 return __mlir_ods_local_attr_constraint_Ops3(attr, attrName, [op]() {
107 return op->emitOpError();
108 });
109}
110} // namespace pod
111} // namespace llzk
112namespace llzk {
113namespace pod {
114
115//===----------------------------------------------------------------------===//
116// ::llzk::pod::NewPodOp definitions
117//===----------------------------------------------------------------------===//
118
119namespace detail {
120NewPodOpGenericAdaptorBase::NewPodOpGenericAdaptorBase(NewPodOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
121
122std::pair<unsigned, unsigned> NewPodOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
123 ::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
124
125 unsigned start = 0;
126 for (unsigned i = 0; i < index; ++i)
127 start += sizeAttr[i];
128 return {start, sizeAttr[index]};
129}
130
132 auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().initializedRecords);
133 return attr;
134}
135
137 auto attr = getInitializedRecordsAttr();
138 return attr;
139}
140
142 auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(getProperties().numDimsPerMap);
143 return attr;
144}
145
147 auto attr = getNumDimsPerMapAttr();
148 return attr;
149}
150
152 auto attr = getMapOpGroupSizesAttr();
153 return attr;
154}
155
156} // namespace detail
158
159::llvm::LogicalResult NewPodOpAdaptor::verify(::mlir::Location loc) {
160 auto tblgen_initializedRecords = getProperties().initializedRecords; (void)tblgen_initializedRecords;
161 auto tblgen_mapOpGroupSizes = getProperties().mapOpGroupSizes; (void)tblgen_mapOpGroupSizes;
162 if (!tblgen_mapOpGroupSizes) return emitError(loc, "'pod.new' op ""requires attribute 'mapOpGroupSizes'");
163 auto tblgen_numDimsPerMap = getProperties().numDimsPerMap; (void)tblgen_numDimsPerMap;
164
165 if (tblgen_initializedRecords && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_initializedRecords))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_initializedRecords), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::StringAttr>(attr))); }))))
166 return emitError(loc, "'pod.new' op ""attribute 'initializedRecords' failed to satisfy constraint: string array attribute");
167
168 if (tblgen_numDimsPerMap && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(tblgen_numDimsPerMap))))
169 return emitError(loc, "'pod.new' op ""attribute 'numDimsPerMap' failed to satisfy constraint: i32 dense array attribute");
170
171 if (tblgen_mapOpGroupSizes && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(tblgen_mapOpGroupSizes))))
172 return emitError(loc, "'pod.new' op ""attribute 'mapOpGroupSizes' failed to satisfy constraint: i32 dense array attribute");
173 return ::mlir::success();
174}
175
176std::pair<unsigned, unsigned> NewPodOp::getODSOperandIndexAndLength(unsigned index) {
177 ::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
178
179 unsigned start = 0;
180 for (unsigned i = 0; i < index; ++i)
181 start += sizeAttr[i];
182 return {start, sizeAttr[index]};
183}
184
185::mlir::MutableOperandRange NewPodOp::getInitialValuesMutable() {
186 auto range = getODSOperandIndexAndLength(0);
187 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
188 return mutableRange;
189}
190
191::mlir::MutableOperandRangeRange NewPodOp::getMapOperandsMutable() {
192 auto range = getODSOperandIndexAndLength(1);
193 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
194 return mutableRange.split(*(*this)->getAttrDictionary().getNamed(getMapOpGroupSizesAttrName()));
195}
196
197::llvm::LogicalResult NewPodOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
198 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
199 if (!dict) {
200 emitError() << "expected DictionaryAttr to set properties";
201 return ::mlir::failure();
202 }
203
204 {
205 auto &propStorage = prop.initializedRecords;
206 auto attr = dict.get("initializedRecords");
207 if (attr) {
208 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
209 if (convertedAttr) {
210 propStorage = convertedAttr;
211 } else {
212 emitError() << "Invalid attribute `initializedRecords` in property conversion: " << attr;
213 return ::mlir::failure();
214 }
215 }
216 }
217
218 {
219 auto &propStorage = prop.mapOpGroupSizes;
220 auto attr = dict.get("mapOpGroupSizes");
221 if (attr) {
222 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
223 if (convertedAttr) {
224 propStorage = convertedAttr;
225 } else {
226 emitError() << "Invalid attribute `mapOpGroupSizes` in property conversion: " << attr;
227 return ::mlir::failure();
228 }
229 }
230 }
231
232 {
233 auto &propStorage = prop.numDimsPerMap;
234 auto attr = dict.get("numDimsPerMap");
235 if (attr) {
236 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
237 if (convertedAttr) {
238 propStorage = convertedAttr;
239 } else {
240 emitError() << "Invalid attribute `numDimsPerMap` in property conversion: " << attr;
241 return ::mlir::failure();
242 }
243 }
244 }
245{
246
247 auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr,
248 ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) -> ::mlir::LogicalResult {
249 return convertFromAttribute(propStorage, propAttr, emitError);
250 };
251 auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");;
252;
253 if (attr && ::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError)))
254 return ::mlir::failure();
255 }
256 return ::mlir::success();
257}
258
259::mlir::Attribute NewPodOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
260 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
261 ::mlir::Builder odsBuilder{ctx};
262
263 {
264 const auto &propStorage = prop.initializedRecords;
265 if (propStorage)
266 attrs.push_back(odsBuilder.getNamedAttr("initializedRecords",
267 propStorage));
268 }
269
270 {
271 const auto &propStorage = prop.mapOpGroupSizes;
272 if (propStorage)
273 attrs.push_back(odsBuilder.getNamedAttr("mapOpGroupSizes",
274 propStorage));
275 }
276
277 {
278 const auto &propStorage = prop.numDimsPerMap;
279 if (propStorage)
280 attrs.push_back(odsBuilder.getNamedAttr("numDimsPerMap",
281 propStorage));
282 }
283
284 {
285 const auto &propStorage = prop.operandSegmentSizes;
286 auto attr = [&]() -> ::mlir::Attribute {
287 return ::mlir::DenseI32ArrayAttr::get(ctx, propStorage);
288 }();
289 attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes", attr));
290 }
291
292 if (!attrs.empty())
293 return odsBuilder.getDictionaryAttr(attrs);
294 return {};
295}
296
297llvm::hash_code NewPodOp::computePropertiesHash(const Properties &prop) {
298 auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code {
299 return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));;
300 };
301 return llvm::hash_combine(
302 llvm::hash_value(prop.initializedRecords.getAsOpaquePointer()),
303 llvm::hash_value(prop.mapOpGroupSizes.getAsOpaquePointer()),
304 llvm::hash_value(prop.numDimsPerMap.getAsOpaquePointer()),
305 hash_operandSegmentSizes(prop.operandSegmentSizes));
306}
307
308std::optional<mlir::Attribute> NewPodOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
309 if (name == "initializedRecords")
310 return prop.initializedRecords;
311
312 if (name == "mapOpGroupSizes")
313 return prop.mapOpGroupSizes;
314
315 if (name == "numDimsPerMap")
316 return prop.numDimsPerMap;
317 if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); }();
318 return std::nullopt;
319}
320
321void NewPodOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
322 if (name == "initializedRecords") {
323 prop.initializedRecords = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.initializedRecords)>>(value);
324 return;
325 }
326
327 if (name == "mapOpGroupSizes") {
328 prop.mapOpGroupSizes = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.mapOpGroupSizes)>>(value);
329 return;
330 }
331
332 if (name == "numDimsPerMap") {
333 prop.numDimsPerMap = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.numDimsPerMap)>>(value);
334 return;
335 }
336 if (name == "operand_segment_sizes" || name == "operandSegmentSizes") {
337 auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value);
338 if (!arrAttr) return;
339 if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t))
340 return;
341 llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin());
342 return;
343 }
344}
345
346void NewPodOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
347 if (prop.initializedRecords) attrs.append("initializedRecords", prop.initializedRecords);
348
349 if (prop.mapOpGroupSizes) attrs.append("mapOpGroupSizes", prop.mapOpGroupSizes);
350
351 if (prop.numDimsPerMap) attrs.append("numDimsPerMap", prop.numDimsPerMap);
352 attrs.append("operandSegmentSizes", [&]() -> ::mlir::Attribute { return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes); }());
353}
354
355::llvm::LogicalResult NewPodOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
356 {
357 ::mlir::Attribute attr = attrs.get(getInitializedRecordsAttrName(opName));
358 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(attr, "initializedRecords", emitError)))
359 return ::mlir::failure();
360 }
361
362 {
363 ::mlir::Attribute attr = attrs.get(getMapOpGroupSizesAttrName(opName));
364 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops2(attr, "mapOpGroupSizes", emitError)))
365 return ::mlir::failure();
366 }
367
368 {
369 ::mlir::Attribute attr = attrs.get(getNumDimsPerMapAttrName(opName));
370 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops2(attr, "numDimsPerMap", emitError)))
371 return ::mlir::failure();
372 }
373 return ::mlir::success();
374}
375
376::llvm::LogicalResult NewPodOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
377 auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
378 if (::mlir::failed(reader.readOptionalAttribute(prop.initializedRecords)))
379 return ::mlir::failure();
380
381 if (::mlir::failed(reader.readAttribute(prop.mapOpGroupSizes)))
382 return ::mlir::failure();
383
384 if (::mlir::failed(reader.readOptionalAttribute(prop.numDimsPerMap)))
385 return ::mlir::failure();
386
387 if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) {
388 auto &propStorage = prop.operandSegmentSizes;
389 ::mlir::DenseI32ArrayAttr attr;
390 if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure();
391 if (attr.size() > static_cast<int64_t>(sizeof(propStorage) / sizeof(int32_t))) {
392 reader.emitError("size mismatch for operand/result_segment_size");
393 return ::mlir::failure();
394 }
395 ::llvm::copy(::llvm::ArrayRef<int32_t>(attr), propStorage.begin());
396 }
397
398 {
399 auto &propStorage = prop.operandSegmentSizes;
400 auto readProp = [&]() {
401
402 if (reader.getBytecodeVersion() >= /*kNativePropertiesODSSegmentSize=*/6)
403 return reader.readSparseArray(::llvm::MutableArrayRef(propStorage));
404;
405 return ::mlir::success();
406 };
407 if (::mlir::failed(readProp()))
408 return ::mlir::failure();
409 }
410 return ::mlir::success();
411}
412
413void NewPodOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
414 auto &prop = getProperties(); (void)prop;
415
416 writer.writeOptionalAttribute(prop.initializedRecords);
417 writer.writeAttribute(prop.mapOpGroupSizes);
418
419 writer.writeOptionalAttribute(prop.numDimsPerMap);
420
421if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) {
422 auto &propStorage = prop.operandSegmentSizes;
423 writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(this->getContext(), propStorage));
424}
425
426 {
427 auto &propStorage = prop.operandSegmentSizes;
428
429 if (writer.getBytecodeVersion() >= /*kNativePropertiesODSSegmentSize=*/6)
430 writer.writeSparseArray(::llvm::ArrayRef(propStorage));
431;
432 }
433}
434
436 auto attr = getInitializedRecordsAttr();
437 return attr;
438}
439
440::llvm::ArrayRef<int32_t> NewPodOp::getNumDimsPerMap() {
441 auto attr = getNumDimsPerMapAttr();
442 return attr;
443}
444
445::llvm::ArrayRef<int32_t> NewPodOp::getMapOpGroupSizes() {
446 auto attr = getMapOpGroupSizesAttr();
447 return attr;
448}
449
450void NewPodOp::setNumDimsPerMap(::llvm::ArrayRef<int32_t> attrValue) {
451 getProperties().numDimsPerMap = ::mlir::Builder((*this)->getContext()).getDenseI32ArrayAttr(attrValue);
452}
453
454void NewPodOp::setMapOpGroupSizes(::llvm::ArrayRef<int32_t> attrValue) {
455 getProperties().mapOpGroupSizes = ::mlir::Builder((*this)->getContext()).getDenseI32ArrayAttr(attrValue);
456}
457
458void NewPodOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llzk::pod::InitializedRecords initialValues) {
459 auto resultType = ::llzk::pod::PodType::fromInitialValues(odsBuilder.getContext(), initialValues);
460 build(odsBuilder, odsState, resultType, initialValues);
461
462}
463
464void NewPodOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llzk::pod::PodType resultType, ::llvm::ArrayRef<::mlir::ValueRange> mapOperands, ::llvm::ArrayRef<int32_t> numDimsPerMap, ::llzk::pod::InitializedRecords initialValues) {
465 build(odsBuilder, odsState, resultType, mapOperands,
466 odsBuilder.getDenseI32ArrayAttr(numDimsPerMap), initialValues);
467
468}
469
470void NewPodOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) {
471 ::mlir::Builder odsBuilder(opName.getContext());
472 if (!properties.initializedRecords)
473 properties.initializedRecords = odsBuilder.getStrArrayAttr({});
474 if (!properties.numDimsPerMap)
475 properties.numDimsPerMap = odsBuilder.getDenseI32ArrayAttr({});
476}
477
478::llvm::LogicalResult NewPodOp::verifyInvariantsImpl() {
479 auto tblgen_initializedRecords = getProperties().initializedRecords; (void)tblgen_initializedRecords;
480 auto tblgen_mapOpGroupSizes = getProperties().mapOpGroupSizes; (void)tblgen_mapOpGroupSizes;
481 if (!tblgen_mapOpGroupSizes) return emitOpError("requires attribute 'mapOpGroupSizes'");
482 auto tblgen_numDimsPerMap = getProperties().numDimsPerMap; (void)tblgen_numDimsPerMap;
483
484 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(*this, tblgen_initializedRecords, "initializedRecords")))
485 return ::mlir::failure();
486
487 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops2(*this, tblgen_numDimsPerMap, "numDimsPerMap")))
488 return ::mlir::failure();
489
490 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops2(*this, tblgen_mapOpGroupSizes, "mapOpGroupSizes")))
491 return ::mlir::failure();
492 {
493 unsigned index = 0; (void)index;
494 auto valueGroup0 = getODSOperands(0);
495
496 for (auto v : valueGroup0) {
497 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*this, v.getType(), "operand", index++)))
498 return ::mlir::failure();
499 }
500 auto valueGroup1 = getODSOperands(1);
501 if (::mlir::failed(::mlir::OpTrait::impl::verifyValueSizeAttr(*this, "mapOpGroupSizes", "mapOperands", valueGroup1.size())))
502 return ::mlir::failure();
503
504 for (auto v : valueGroup1) {
505 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops2(*this, v.getType(), "operand", index++)))
506 return ::mlir::failure();
507 }
508 }
509 {
510 unsigned index = 0; (void)index;
511 auto valueGroup0 = getODSResults(0);
512
513 for (auto v : valueGroup0) {
514 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops3(*this, v.getType(), "result", index++)))
515 return ::mlir::failure();
516 }
517 }
518 return ::mlir::success();
519}
520
521::llvm::LogicalResult NewPodOp::verifyInvariants() {
522 if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
523 return ::mlir::success();
524 return ::mlir::failure();
525}
526
527void NewPodOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
528}
529
530} // namespace pod
531} // namespace llzk
532MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::pod::NewPodOp)
533
534namespace llzk {
535namespace pod {
536
537//===----------------------------------------------------------------------===//
538// ::llzk::pod::ReadPodOp definitions
539//===----------------------------------------------------------------------===//
540
541namespace detail {
542ReadPodOpGenericAdaptorBase::ReadPodOpGenericAdaptorBase(ReadPodOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
543
545 auto attr = getRecordNameAttr();
546 return attr.getValue();
547}
548
549} // namespace detail
551
552::llvm::LogicalResult ReadPodOpAdaptor::verify(::mlir::Location loc) {
553 auto tblgen_record_name = getProperties().record_name; (void)tblgen_record_name;
554 if (!tblgen_record_name) return emitError(loc, "'pod.read' op ""requires attribute 'record_name'");
555
556 if (tblgen_record_name && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(tblgen_record_name))))
557 return emitError(loc, "'pod.read' op ""attribute 'record_name' failed to satisfy constraint: flat symbol reference attribute");
558 return ::mlir::success();
559}
560
561::llvm::LogicalResult ReadPodOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
562 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
563 if (!dict) {
564 emitError() << "expected DictionaryAttr to set properties";
565 return ::mlir::failure();
566 }
567
568 {
569 auto &propStorage = prop.record_name;
570 auto attr = dict.get("record_name");
571 if (attr) {
572 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
573 if (convertedAttr) {
574 propStorage = convertedAttr;
575 } else {
576 emitError() << "Invalid attribute `record_name` in property conversion: " << attr;
577 return ::mlir::failure();
578 }
579 }
580 }
581 return ::mlir::success();
582}
583
584::mlir::Attribute ReadPodOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
585 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
586 ::mlir::Builder odsBuilder{ctx};
587
588 {
589 const auto &propStorage = prop.record_name;
590 if (propStorage)
591 attrs.push_back(odsBuilder.getNamedAttr("record_name",
592 propStorage));
593 }
594
595 if (!attrs.empty())
596 return odsBuilder.getDictionaryAttr(attrs);
597 return {};
598}
599
600llvm::hash_code ReadPodOp::computePropertiesHash(const Properties &prop) {
601 return llvm::hash_combine(
602 llvm::hash_value(prop.record_name.getAsOpaquePointer()));
603}
604
605std::optional<mlir::Attribute> ReadPodOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
606 if (name == "record_name")
607 return prop.record_name;
608 return std::nullopt;
609}
610
611void ReadPodOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
612 if (name == "record_name") {
613 prop.record_name = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.record_name)>>(value);
614 return;
615 }
616}
617
618void ReadPodOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
619 if (prop.record_name) attrs.append("record_name", prop.record_name);
620}
621
622::llvm::LogicalResult ReadPodOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
623 {
624 ::mlir::Attribute attr = attrs.get(getRecordNameAttrName(opName));
625 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops3(attr, "record_name", emitError)))
626 return ::mlir::failure();
627 }
628 return ::mlir::success();
629}
630
631::llvm::LogicalResult ReadPodOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
632 auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
633 if (::mlir::failed(reader.readAttribute(prop.record_name)))
634 return ::mlir::failure();
635 return ::mlir::success();
636}
637
638void ReadPodOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
639 auto &prop = getProperties(); (void)prop;
640 writer.writeAttribute(prop.record_name);
641}
642
643::llvm::StringRef ReadPodOp::getRecordName() {
644 auto attr = getRecordNameAttr();
645 return attr.getValue();
646}
647
648void ReadPodOp::setRecordName(::llvm::StringRef attrValue) {
649 getProperties().record_name = ::mlir::SymbolRefAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
650}
651
652void ReadPodOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value pod_ref, ::mlir::FlatSymbolRefAttr record_name) {
653 odsState.addOperands(pod_ref);
654 odsState.getOrAddProperties<Properties>().record_name = record_name;
655 odsState.addTypes(result);
656}
657
658void ReadPodOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pod_ref, ::mlir::FlatSymbolRefAttr record_name) {
659 odsState.addOperands(pod_ref);
660 odsState.getOrAddProperties<Properties>().record_name = record_name;
661 assert(resultTypes.size() == 1u && "mismatched number of results");
662 odsState.addTypes(resultTypes);
663}
664
665void ReadPodOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value pod_ref, ::llvm::StringRef record_name) {
666 odsState.addOperands(pod_ref);
667 odsState.getOrAddProperties<Properties>().record_name = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), record_name);
668 odsState.addTypes(result);
669}
670
671void ReadPodOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pod_ref, ::llvm::StringRef record_name) {
672 odsState.addOperands(pod_ref);
673 odsState.getOrAddProperties<Properties>().record_name = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), record_name);
674 assert(resultTypes.size() == 1u && "mismatched number of results");
675 odsState.addTypes(resultTypes);
676}
677
678void ReadPodOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
679 assert(operands.size() == 1u && "mismatched number of parameters");
680 odsState.addOperands(operands);
681 odsState.addAttributes(attributes);
682 assert(resultTypes.size() == 1u && "mismatched number of return types");
683 odsState.addTypes(resultTypes);
684
685 if (!attributes.empty()) {
686 ::mlir::OpaqueProperties properties =
687 &odsState.getOrAddProperties<ReadPodOp::Properties>();
688 std::optional<::mlir::RegisteredOperationName> info =
689 odsState.name.getRegisteredInfo();
690 if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
691 odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
692 ::llvm::report_fatal_error("Property conversion failed.");
693 }
694}
695
696::llvm::LogicalResult ReadPodOp::verifyInvariantsImpl() {
697 auto tblgen_record_name = getProperties().record_name; (void)tblgen_record_name;
698 if (!tblgen_record_name) return emitOpError("requires attribute 'record_name'");
699
700 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops3(*this, tblgen_record_name, "record_name")))
701 return ::mlir::failure();
702 {
703 unsigned index = 0; (void)index;
704 auto valueGroup0 = getODSOperands(0);
705
706 for (auto v : valueGroup0) {
707 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops3(*this, v.getType(), "operand", index++)))
708 return ::mlir::failure();
709 }
710 }
711 {
712 unsigned index = 0; (void)index;
713 auto valueGroup0 = getODSResults(0);
714
715 for (auto v : valueGroup0) {
716 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops4(*this, v.getType(), "result", index++)))
717 return ::mlir::failure();
718 }
719 }
720 return ::mlir::success();
721}
722
723::llvm::LogicalResult ReadPodOp::verifyInvariants() {
724 if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
725 return ::mlir::success();
726 return ::mlir::failure();
727}
728
729::mlir::ParseResult ReadPodOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
730 ::mlir::OpAsmParser::UnresolvedOperand pod_refRawOperand{};
731 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> pod_refOperands(&pod_refRawOperand, 1); ::llvm::SMLoc pod_refOperandsLoc;
732 (void)pod_refOperandsLoc;
733 ::mlir::FlatSymbolRefAttr record_nameAttr;
734 ::mlir::Type pod_refRawType{};
735 ::llvm::ArrayRef<::mlir::Type> pod_refTypes(&pod_refRawType, 1);
736 ::mlir::Type resultRawType{};
737 ::llvm::ArrayRef<::mlir::Type> resultTypes(&resultRawType, 1);
738
739 pod_refOperandsLoc = parser.getCurrentLocation();
740 if (parser.parseOperand(pod_refRawOperand))
741 return ::mlir::failure();
742 if (parser.parseLSquare())
743 return ::mlir::failure();
744 {
745 auto odsResult = parseRecordName(parser, record_nameAttr);
746 if (odsResult) return ::mlir::failure();
747 result.getOrAddProperties<ReadPodOp::Properties>().record_name = record_nameAttr;
748 }
749 if (parser.parseRSquare())
750 return ::mlir::failure();
751 if (parser.parseColon())
752 return ::mlir::failure();
753
754 {
756 if (parser.parseCustomTypeWithFallback(type))
757 return ::mlir::failure();
758 pod_refRawType = type;
759 }
760 if (parser.parseComma())
761 return ::mlir::failure();
762
763 {
764 ::mlir::Type type;
765 if (parser.parseCustomTypeWithFallback(type))
766 return ::mlir::failure();
767 resultRawType = type;
768 }
769 {
770 auto loc = parser.getCurrentLocation();(void)loc;
771 if (parser.parseOptionalAttrDict(result.attributes))
772 return ::mlir::failure();
773 if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
774 return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
775 })))
776 return ::mlir::failure();
777 }
778 result.addTypes(resultTypes);
779 if (parser.resolveOperands(pod_refOperands, pod_refTypes, pod_refOperandsLoc, result.operands))
780 return ::mlir::failure();
781 return ::mlir::success();
782}
783
784void ReadPodOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
785 _odsPrinter << ' ';
786 _odsPrinter << getPodRef();
787 _odsPrinter << "[";
788 printRecordName(_odsPrinter, *this, getRecordNameAttr());
789 _odsPrinter << "]";
790 _odsPrinter << ' ' << ":";
791 _odsPrinter << ' ';
792 {
793 auto type = getPodRef().getType();
794 if (auto validType = ::llvm::dyn_cast<::llzk::pod::PodType>(type))
795 _odsPrinter.printStrippedAttrOrType(validType);
796 else
797 _odsPrinter << type;
798 }
799 _odsPrinter << ",";
800 _odsPrinter << ' ';
801 {
802 auto type = getResult().getType();
803 if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
804 _odsPrinter.printStrippedAttrOrType(validType);
805 else
806 _odsPrinter << type;
807 }
808 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
809 elidedAttrs.push_back("record_name");
810 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
811}
812
813} // namespace pod
814} // namespace llzk
815MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::pod::ReadPodOp)
816
817namespace llzk {
818namespace pod {
819
820//===----------------------------------------------------------------------===//
821// ::llzk::pod::WritePodOp definitions
822//===----------------------------------------------------------------------===//
823
824namespace detail {
825WritePodOpGenericAdaptorBase::WritePodOpGenericAdaptorBase(WritePodOp op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), properties(op.getProperties()), odsRegions(op->getRegions()) {}
826
828 auto attr = getRecordNameAttr();
829 return attr.getValue();
830}
831
832} // namespace detail
834
835::llvm::LogicalResult WritePodOpAdaptor::verify(::mlir::Location loc) {
836 auto tblgen_record_name = getProperties().record_name; (void)tblgen_record_name;
837 if (!tblgen_record_name) return emitError(loc, "'pod.write' op ""requires attribute 'record_name'");
838
839 if (tblgen_record_name && !((::llvm::isa<::mlir::FlatSymbolRefAttr>(tblgen_record_name))))
840 return emitError(loc, "'pod.write' op ""attribute 'record_name' failed to satisfy constraint: flat symbol reference attribute");
841 return ::mlir::success();
842}
843
844::llvm::LogicalResult WritePodOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
845 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
846 if (!dict) {
847 emitError() << "expected DictionaryAttr to set properties";
848 return ::mlir::failure();
849 }
850
851 {
852 auto &propStorage = prop.record_name;
853 auto attr = dict.get("record_name");
854 if (attr) {
855 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
856 if (convertedAttr) {
857 propStorage = convertedAttr;
858 } else {
859 emitError() << "Invalid attribute `record_name` in property conversion: " << attr;
860 return ::mlir::failure();
861 }
862 }
863 }
864 return ::mlir::success();
865}
866
867::mlir::Attribute WritePodOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
868 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
869 ::mlir::Builder odsBuilder{ctx};
870
871 {
872 const auto &propStorage = prop.record_name;
873 if (propStorage)
874 attrs.push_back(odsBuilder.getNamedAttr("record_name",
875 propStorage));
876 }
877
878 if (!attrs.empty())
879 return odsBuilder.getDictionaryAttr(attrs);
880 return {};
881}
882
883llvm::hash_code WritePodOp::computePropertiesHash(const Properties &prop) {
884 return llvm::hash_combine(
885 llvm::hash_value(prop.record_name.getAsOpaquePointer()));
886}
887
888std::optional<mlir::Attribute> WritePodOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
889 if (name == "record_name")
890 return prop.record_name;
891 return std::nullopt;
892}
893
894void WritePodOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
895 if (name == "record_name") {
896 prop.record_name = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.record_name)>>(value);
897 return;
898 }
899}
900
901void WritePodOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
902 if (prop.record_name) attrs.append("record_name", prop.record_name);
903}
904
905::llvm::LogicalResult WritePodOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
906 {
907 ::mlir::Attribute attr = attrs.get(getRecordNameAttrName(opName));
908 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops3(attr, "record_name", emitError)))
909 return ::mlir::failure();
910 }
911 return ::mlir::success();
912}
913
914::llvm::LogicalResult WritePodOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
915 auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
916 if (::mlir::failed(reader.readAttribute(prop.record_name)))
917 return ::mlir::failure();
918 return ::mlir::success();
919}
920
921void WritePodOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
922 auto &prop = getProperties(); (void)prop;
923 writer.writeAttribute(prop.record_name);
924}
925
926::llvm::StringRef WritePodOp::getRecordName() {
927 auto attr = getRecordNameAttr();
928 return attr.getValue();
929}
930
931void WritePodOp::setRecordName(::llvm::StringRef attrValue) {
932 getProperties().record_name = ::mlir::SymbolRefAttr::get(::mlir::Builder((*this)->getContext()).getContext(), attrValue);
933}
934
935void WritePodOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value pod_ref, ::mlir::FlatSymbolRefAttr record_name, ::mlir::Value value) {
936 odsState.addOperands(pod_ref);
937 odsState.addOperands(value);
938 odsState.getOrAddProperties<Properties>().record_name = record_name;
939}
940
941void WritePodOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pod_ref, ::mlir::FlatSymbolRefAttr record_name, ::mlir::Value value) {
942 odsState.addOperands(pod_ref);
943 odsState.addOperands(value);
944 odsState.getOrAddProperties<Properties>().record_name = record_name;
945 assert(resultTypes.size() == 0u && "mismatched number of results");
946 odsState.addTypes(resultTypes);
947}
948
949void WritePodOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value pod_ref, ::llvm::StringRef record_name, ::mlir::Value value) {
950 odsState.addOperands(pod_ref);
951 odsState.addOperands(value);
952 odsState.getOrAddProperties<Properties>().record_name = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), record_name);
953}
954
955void WritePodOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pod_ref, ::llvm::StringRef record_name, ::mlir::Value value) {
956 odsState.addOperands(pod_ref);
957 odsState.addOperands(value);
958 odsState.getOrAddProperties<Properties>().record_name = ::mlir::SymbolRefAttr::get(odsBuilder.getContext(), record_name);
959 assert(resultTypes.size() == 0u && "mismatched number of results");
960 odsState.addTypes(resultTypes);
961}
962
963void WritePodOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
964 assert(operands.size() == 2u && "mismatched number of parameters");
965 odsState.addOperands(operands);
966 odsState.addAttributes(attributes);
967 assert(resultTypes.size() == 0u && "mismatched number of return types");
968 odsState.addTypes(resultTypes);
969
970 if (!attributes.empty()) {
971 ::mlir::OpaqueProperties properties =
972 &odsState.getOrAddProperties<WritePodOp::Properties>();
973 std::optional<::mlir::RegisteredOperationName> info =
974 odsState.name.getRegisteredInfo();
975 if (failed(info->setOpPropertiesFromAttribute(odsState.name, properties,
976 odsState.attributes.getDictionary(odsState.getContext()), nullptr)))
977 ::llvm::report_fatal_error("Property conversion failed.");
978 }
979}
980
981::llvm::LogicalResult WritePodOp::verifyInvariantsImpl() {
982 auto tblgen_record_name = getProperties().record_name; (void)tblgen_record_name;
983 if (!tblgen_record_name) return emitOpError("requires attribute 'record_name'");
984
985 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops3(*this, tblgen_record_name, "record_name")))
986 return ::mlir::failure();
987 {
988 unsigned index = 0; (void)index;
989 auto valueGroup0 = getODSOperands(0);
990
991 for (auto v : valueGroup0) {
992 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops3(*this, v.getType(), "operand", index++)))
993 return ::mlir::failure();
994 }
995 auto valueGroup1 = getODSOperands(1);
996
997 for (auto v : valueGroup1) {
998 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops4(*this, v.getType(), "operand", index++)))
999 return ::mlir::failure();
1000 }
1001 }
1002 return ::mlir::success();
1003}
1004
1005::llvm::LogicalResult WritePodOp::verifyInvariants() {
1006 if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
1007 return ::mlir::success();
1008 return ::mlir::failure();
1009}
1010
1011::mlir::ParseResult WritePodOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
1012 ::mlir::OpAsmParser::UnresolvedOperand pod_refRawOperand{};
1013 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> pod_refOperands(&pod_refRawOperand, 1); ::llvm::SMLoc pod_refOperandsLoc;
1014 (void)pod_refOperandsLoc;
1015 ::mlir::FlatSymbolRefAttr record_nameAttr;
1016 ::mlir::OpAsmParser::UnresolvedOperand valueRawOperand{};
1017 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> valueOperands(&valueRawOperand, 1); ::llvm::SMLoc valueOperandsLoc;
1018 (void)valueOperandsLoc;
1019 ::mlir::Type pod_refRawType{};
1020 ::llvm::ArrayRef<::mlir::Type> pod_refTypes(&pod_refRawType, 1);
1021 ::mlir::Type valueRawType{};
1022 ::llvm::ArrayRef<::mlir::Type> valueTypes(&valueRawType, 1);
1023
1024 pod_refOperandsLoc = parser.getCurrentLocation();
1025 if (parser.parseOperand(pod_refRawOperand))
1026 return ::mlir::failure();
1027 if (parser.parseLSquare())
1028 return ::mlir::failure();
1029 {
1030 auto odsResult = parseRecordName(parser, record_nameAttr);
1031 if (odsResult) return ::mlir::failure();
1032 result.getOrAddProperties<WritePodOp::Properties>().record_name = record_nameAttr;
1033 }
1034 if (parser.parseRSquare())
1035 return ::mlir::failure();
1036 if (parser.parseEqual())
1037 return ::mlir::failure();
1038
1039 valueOperandsLoc = parser.getCurrentLocation();
1040 if (parser.parseOperand(valueRawOperand))
1041 return ::mlir::failure();
1042 if (parser.parseColon())
1043 return ::mlir::failure();
1044
1045 {
1047 if (parser.parseCustomTypeWithFallback(type))
1048 return ::mlir::failure();
1049 pod_refRawType = type;
1050 }
1051 if (parser.parseComma())
1052 return ::mlir::failure();
1053
1054 {
1055 ::mlir::Type type;
1056 if (parser.parseCustomTypeWithFallback(type))
1057 return ::mlir::failure();
1058 valueRawType = type;
1059 }
1060 {
1061 auto loc = parser.getCurrentLocation();(void)loc;
1062 if (parser.parseOptionalAttrDict(result.attributes))
1063 return ::mlir::failure();
1064 if (failed(verifyInherentAttrs(result.name, result.attributes, [&]() {
1065 return parser.emitError(loc) << "'" << result.name.getStringRef() << "' op ";
1066 })))
1067 return ::mlir::failure();
1068 }
1069 if (parser.resolveOperands(pod_refOperands, pod_refTypes, pod_refOperandsLoc, result.operands))
1070 return ::mlir::failure();
1071 if (parser.resolveOperands(valueOperands, valueTypes, valueOperandsLoc, result.operands))
1072 return ::mlir::failure();
1073 return ::mlir::success();
1074}
1075
1076void WritePodOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
1077 _odsPrinter << ' ';
1078 _odsPrinter << getPodRef();
1079 _odsPrinter << "[";
1080 printRecordName(_odsPrinter, *this, getRecordNameAttr());
1081 _odsPrinter << "]";
1082 _odsPrinter << ' ' << "=";
1083 _odsPrinter << ' ';
1084 _odsPrinter << getValue();
1085 _odsPrinter << ' ' << ":";
1086 _odsPrinter << ' ';
1087 {
1088 auto type = getPodRef().getType();
1089 if (auto validType = ::llvm::dyn_cast<::llzk::pod::PodType>(type))
1090 _odsPrinter.printStrippedAttrOrType(validType);
1091 else
1092 _odsPrinter << type;
1093 }
1094 _odsPrinter << ",";
1095 _odsPrinter << ' ';
1096 {
1097 auto type = getValue().getType();
1098 if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
1099 _odsPrinter.printStrippedAttrOrType(validType);
1100 else
1101 _odsPrinter << type;
1102 }
1103 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
1104 elidedAttrs.push_back("record_name");
1105 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
1106}
1107
1108} // namespace pod
1109} // namespace llzk
1110MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::pod::WritePodOp)
1111
1112
1113#endif // GET_OP_CLASSES
1114
::llvm::LogicalResult verify(::mlir::Location loc)
Definition Ops.cpp.inc:159
NewPodOpAdaptor(NewPodOp op)
Definition Ops.cpp.inc:157
NewPodOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
Definition Ops.h.inc:129
::llvm::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:521
::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:197
static llvm::hash_code computePropertiesHash(const Properties &prop)
Definition Ops.cpp.inc:297
void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect > > &effects)
Definition Ops.cpp.inc:527
::mlir::ArrayAttr getInitializedRecordsAttr()
Definition Ops.h.inc:270
::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state)
Definition Ops.cpp.inc:376
::llvm::LogicalResult verifyInvariantsImpl()
Definition Ops.cpp.inc:478
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
Definition Ops.cpp.inc:308
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
Definition Ops.cpp.inc:259
static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties)
Definition Ops.cpp.inc:470
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
Definition Ops.cpp.inc:321
void setMapOpGroupSizes(::llvm::ArrayRef< int32_t > attrValue)
Definition Ops.cpp.inc:454
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llzk::pod::InitializedRecords initialValues={})
Definition Ops.cpp.inc:458
::llvm::ArrayRef< int32_t > getNumDimsPerMap()
Definition Ops.cpp.inc:440
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
Definition Ops.cpp.inc:346
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index)
Definition Ops.cpp.inc:176
::mlir::DenseI32ArrayAttr getNumDimsPerMapAttr()
Definition Ops.h.inc:275
::mlir::Operation::result_range getODSResults(unsigned index)
Definition Ops.h.inc:251
::mlir::StringAttr getInitializedRecordsAttrName()
Definition Ops.h.inc:194
::llvm::ArrayRef< int32_t > getMapOpGroupSizes()
Definition Ops.cpp.inc:445
::mlir::Operation::operand_range getODSOperands(unsigned index)
Definition Ops.h.inc:231
::mlir::StringAttr getMapOpGroupSizesAttrName()
Definition Ops.h.inc:202
::mlir::DenseI32ArrayAttr getMapOpGroupSizesAttr()
Definition Ops.h.inc:280
::mlir::MutableOperandRange getInitialValuesMutable()
Definition Ops.cpp.inc:185
void setNumDimsPerMap(::llvm::ArrayRef< int32_t > attrValue)
Definition Ops.cpp.inc:450
FoldAdaptor::Properties Properties
Definition Ops.h.inc:188
::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:355
::mlir::MutableOperandRangeRange getMapOperandsMutable()
Definition Ops.cpp.inc:191
::llvm::LogicalResult verify()
Definition Ops.cpp:176
void writeProperties(::mlir::DialectBytecodeWriter &writer)
Definition Ops.cpp.inc:413
::mlir::ArrayAttr getInitializedRecords()
Definition Ops.cpp.inc:435
::mlir::StringAttr getNumDimsPerMapAttrName()
Definition Ops.h.inc:210
static PodType fromInitialValues(::mlir::MLIRContext *ctx, InitializedRecords init)
Creates a new type from a set of initialized records.
Definition Types.cpp:42
ReadPodOpAdaptor(ReadPodOp op)
Definition Ops.cpp.inc:550
ReadPodOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
Definition Ops.h.inc:398
::llvm::LogicalResult verify(::mlir::Location loc)
Definition Ops.cpp.inc:552
::llvm::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:723
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
Definition Ops.cpp.inc:584
::llvm::StringRef getRecordName()
Definition Ops.cpp.inc:643
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
Definition Ops.cpp.inc:618
::mlir::TypedValue<::mlir::Type > getResult()
Definition Ops.h.inc:492
::mlir::Operation::operand_range getODSOperands(unsigned index)
Definition Ops.h.inc:467
::mlir::FlatSymbolRefAttr getRecordNameAttr()
Definition Ops.h.inc:505
::llvm::LogicalResult verifyInvariantsImpl()
Definition Ops.cpp.inc:696
void writeProperties(::mlir::DialectBytecodeWriter &writer)
Definition Ops.cpp.inc:638
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
Definition Ops.cpp.inc:729
::llvm::LogicalResult verify()
Definition Ops.cpp:349
FoldAdaptor::Properties Properties
Definition Ops.h.inc:445
::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:561
::mlir::TypedValue<::llzk::pod::PodType > getPodRef()
Definition Ops.h.inc:473
void print(::mlir::OpAsmPrinter &_odsPrinter)
Definition Ops.cpp.inc:784
static llvm::hash_code computePropertiesHash(const Properties &prop)
Definition Ops.cpp.inc:600
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
Definition Ops.cpp.inc:611
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
Definition Ops.cpp.inc:605
::mlir::Operation::result_range getODSResults(unsigned index)
Definition Ops.h.inc:486
::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state)
Definition Ops.cpp.inc:631
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value pod_ref, ::mlir::FlatSymbolRefAttr record_name)
Definition Ops.cpp.inc:652
::mlir::StringAttr getRecordNameAttrName()
Definition Ops.h.inc:451
void setRecordName(::llvm::StringRef attrValue)
Definition Ops.cpp.inc:648
::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:622
WritePodOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
Definition Ops.h.inc:611
::llvm::LogicalResult verify(::mlir::Location loc)
Definition Ops.cpp.inc:835
WritePodOpAdaptor(WritePodOp op)
Definition Ops.cpp.inc:833
::mlir::FlatSymbolRefAttr getRecordNameAttr()
Definition Ops.h.inc:727
::llvm::LogicalResult verify()
Definition Ops.cpp:373
static llvm::hash_code computePropertiesHash(const Properties &prop)
Definition Ops.cpp.inc:883
void print(::mlir::OpAsmPrinter &_odsPrinter)
Definition Ops.cpp.inc:1076
::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state)
Definition Ops.cpp.inc:914
::llvm::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:1005
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
Definition Ops.cpp.inc:1011
::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:905
::mlir::TypedValue<::mlir::Type > getValue()
Definition Ops.h.inc:694
void setRecordName(::llvm::StringRef attrValue)
Definition Ops.cpp.inc:931
::mlir::TypedValue<::llzk::pod::PodType > getPodRef()
Definition Ops.h.inc:690
FoldAdaptor::Properties Properties
Definition Ops.h.inc:662
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
Definition Ops.cpp.inc:888
::mlir::Operation::operand_range getODSOperands(unsigned index)
Definition Ops.h.inc:684
::llvm::LogicalResult verifyInvariantsImpl()
Definition Ops.cpp.inc:981
void writeProperties(::mlir::DialectBytecodeWriter &writer)
Definition Ops.cpp.inc:921
::llvm::StringRef getRecordName()
Definition Ops.cpp.inc:926
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
Definition Ops.cpp.inc:901
::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:844
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
Definition Ops.cpp.inc:894
::mlir::StringAttr getRecordNameAttrName()
Definition Ops.h.inc:668
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value pod_ref, ::mlir::FlatSymbolRefAttr record_name, ::mlir::Value value)
Definition Ops.cpp.inc:935
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
Definition Ops.cpp.inc:867
::mlir::DenseI32ArrayAttr getMapOpGroupSizesAttr()
Definition Ops.h.inc:116
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize)
Definition Ops.cpp.inc:122
::llvm::ArrayRef< int32_t > getMapOpGroupSizes()
Definition Ops.cpp.inc:151
NewPodOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
Definition Ops.h.inc:97
::llvm::ArrayRef< int32_t > getNumDimsPerMap()
Definition Ops.cpp.inc:146
::mlir::DenseI32ArrayAttr getNumDimsPerMapAttr()
Definition Ops.cpp.inc:141
::std::optional<::mlir::OperationName > odsOpName
Definition Ops.h.inc:93
::mlir::FlatSymbolRefAttr getRecordNameAttr()
Definition Ops.h.inc:385
::std::optional<::mlir::OperationName > odsOpName
Definition Ops.h.inc:363
ReadPodOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
Definition Ops.h.inc:367
::mlir::FlatSymbolRefAttr getRecordNameAttr()
Definition Ops.h.inc:598
::std::optional<::mlir::OperationName > odsOpName
Definition Ops.h.inc:576
WritePodOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
Definition Ops.h.inc:580
mlir::ArrayRef< RecordValue > InitializedRecords
Definition Types.h:23
ParseResult parseRecordName(AsmParser &parser, FlatSymbolRefAttr &name)
Definition Ops.cpp:397
void printRecordName(AsmPrinter &printer, Operation *, FlatSymbolRefAttr name)
Definition Ops.cpp:401
bool isValidType(Type type)