LLZK 0.1.0
Veridise's ZK Language IR
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 function {
28
29static ::mlir::LogicalResult __mlir_ods_local_type_constraint_Ops0(
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 ::mlir::LogicalResult __mlir_ods_local_type_constraint_Ops1(
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 ::mlir::LogicalResult __mlir_ods_local_attr_constraint_Ops0(
50 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
51 if (attr && !((::llvm::isa<::mlir::SymbolRefAttr>(attr))))
52 return emitError() << "attribute '" << attrName
53 << "' failed to satisfy constraint: symbol reference attribute";
54 return ::mlir::success();
55}
56static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_Ops0(
57 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
58 return __mlir_ods_local_attr_constraint_Ops0(attr, attrName, [op]() {
59 return op->emitOpError();
60 });
61}
62
63static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_Ops1(
64 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
65 if (attr && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(attr))))
66 return emitError() << "attribute '" << attrName
67 << "' failed to satisfy constraint: i32 dense array attribute";
68 return ::mlir::success();
69}
70static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_Ops1(
71 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
72 return __mlir_ods_local_attr_constraint_Ops1(attr, attrName, [op]() {
73 return op->emitOpError();
74 });
75}
76
77static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_Ops2(
78 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
79 if (attr && !((::llvm::isa<::mlir::StringAttr>(attr))))
80 return emitError() << "attribute '" << attrName
81 << "' failed to satisfy constraint: string attribute";
82 return ::mlir::success();
83}
84static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_Ops2(
85 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
86 return __mlir_ods_local_attr_constraint_Ops2(attr, attrName, [op]() {
87 return op->emitOpError();
88 });
89}
90
91static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_Ops3(
92 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
93 if (attr && !(((::llvm::isa<::mlir::TypeAttr>(attr))) && ((::llvm::isa<::mlir::FunctionType>(::llvm::cast<::mlir::TypeAttr>(attr).getValue()))) && ((::llvm::isa<::mlir::FunctionType>(::llvm::cast<::mlir::TypeAttr>(attr).getValue())))))
94 return emitError() << "attribute '" << attrName
95 << "' failed to satisfy constraint: type attribute of function type";
96 return ::mlir::success();
97}
98static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_Ops3(
99 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
100 return __mlir_ods_local_attr_constraint_Ops3(attr, attrName, [op]() {
101 return op->emitOpError();
102 });
103}
104
105static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_Ops4(
106 ::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
107 if (attr && !(((::llvm::isa<::mlir::ArrayAttr>(attr))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(attr), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::DictionaryAttr>(attr))); }))))
108 return emitError() << "attribute '" << attrName
109 << "' failed to satisfy constraint: Array of dictionary attributes";
110 return ::mlir::success();
111}
112static ::mlir::LogicalResult __mlir_ods_local_attr_constraint_Ops4(
113 ::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {
114 return __mlir_ods_local_attr_constraint_Ops4(attr, attrName, [op]() {
115 return op->emitOpError();
116 });
117}
118
119static ::mlir::LogicalResult __mlir_ods_local_region_constraint_Ops0(
120 ::mlir::Operation *op, ::mlir::Region &region, ::llvm::StringRef regionName,
121 unsigned regionIndex) {
122 if (!((true))) {
123 return op->emitOpError("region #") << regionIndex
124 << (regionName.empty() ? " " : " ('" + regionName + "') ")
125 << "failed to verify constraint: any region";
126 }
127 return ::mlir::success();
128}
129} // namespace function
130} // namespace llzk
131namespace llzk {
132namespace function {
133
134//===----------------------------------------------------------------------===//
135// ::llzk::function::CallOp definitions
136//===----------------------------------------------------------------------===//
137
138namespace detail {
139CallOpGenericAdaptorBase::CallOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
140 odsOpName.emplace("function.call", odsAttrs.getContext());
141}
142
143CallOpGenericAdaptorBase::CallOpGenericAdaptorBase(CallOp op) : CallOpGenericAdaptorBase(op->getDiscardableAttrDictionary(), op.getProperties(), op->getRegions()) {}
144
145std::pair<unsigned, unsigned> CallOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
146 ::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
147
148 unsigned start = 0;
149 for (unsigned i = 0; i < index; ++i)
150 start += sizeAttr[i];
151 return {start, sizeAttr[index]};
152}
153
155 return odsAttrs;
156}
157
159 auto attr = ::llvm::cast<::mlir::SymbolRefAttr>(getProperties().callee);
160 return attr;
161}
162
163::mlir::SymbolRefAttr CallOpGenericAdaptorBase::getCallee() {
164 auto attr = getCalleeAttr();
165 return attr;
166}
167
169 auto attr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(getProperties().numDimsPerMap);
170 return attr;
171}
172
174 auto attr = getNumDimsPerMapAttr();
175 return attr;
176}
177
179 auto attr = ::llvm::cast<::mlir::DenseI32ArrayAttr>(getProperties().mapOpGroupSizes);
180 return attr;
181}
182
184 auto attr = getMapOpGroupSizesAttr();
185 return attr;
186}
187
188} // namespace detail
190
191::mlir::LogicalResult CallOpAdaptor::verify(::mlir::Location loc) {
192 auto tblgen_callee = getProperties().callee; (void)tblgen_callee;
193 if (!tblgen_callee) return emitError(loc, "'function.call' op ""requires attribute 'callee'");
194 auto tblgen_mapOpGroupSizes = getProperties().mapOpGroupSizes; (void)tblgen_mapOpGroupSizes;
195 if (!tblgen_mapOpGroupSizes) return emitError(loc, "'function.call' op ""requires attribute 'mapOpGroupSizes'");
196 auto tblgen_numDimsPerMap = getProperties().numDimsPerMap; (void)tblgen_numDimsPerMap;
197
198 if (tblgen_callee && !((::llvm::isa<::mlir::SymbolRefAttr>(tblgen_callee))))
199 return emitError(loc, "'function.call' op ""attribute 'callee' failed to satisfy constraint: symbol reference attribute");
200
201 if (tblgen_numDimsPerMap && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(tblgen_numDimsPerMap))))
202 return emitError(loc, "'function.call' op ""attribute 'numDimsPerMap' failed to satisfy constraint: i32 dense array attribute");
203
204 if (tblgen_mapOpGroupSizes && !((::llvm::isa<::mlir::DenseI32ArrayAttr>(tblgen_mapOpGroupSizes))))
205 return emitError(loc, "'function.call' op ""attribute 'mapOpGroupSizes' failed to satisfy constraint: i32 dense array attribute");
206 return ::mlir::success();
207}
208
209std::pair<unsigned, unsigned> CallOp::getODSOperandIndexAndLength(unsigned index) {
210 ::llvm::ArrayRef<int32_t> sizeAttr = getProperties().operandSegmentSizes;
211
212 unsigned start = 0;
213 for (unsigned i = 0; i < index; ++i)
214 start += sizeAttr[i];
215 return {start, sizeAttr[index]};
216}
217
218::mlir::Operation::operand_range CallOp::getODSOperands(unsigned index) {
219 auto valueRange = getODSOperandIndexAndLength(index);
220 return {std::next(getOperation()->operand_begin(), valueRange.first),
221 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
222}
223
224::mlir::Operation::operand_range CallOp::getArgOperands() {
225 return getODSOperands(0);
226}
227
228::mlir::OperandRangeRange CallOp::getMapOperands() {
229 return getODSOperands(1).split(getMapOpGroupSizesAttr());
230}
231
232::mlir::MutableOperandRange CallOp::getArgOperandsMutable() {
233 auto range = getODSOperandIndexAndLength(0);
234 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(0u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
235 return mutableRange;
236}
237
238::mlir::MutableOperandRangeRange CallOp::getMapOperandsMutable() {
239 auto range = getODSOperandIndexAndLength(1);
240 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second, ::mlir::MutableOperandRange::OperandSegment(1u, {getOperandSegmentSizesAttrName(), ::mlir::DenseI32ArrayAttr::get(getContext(), getProperties().operandSegmentSizes)}));
241 return mutableRange.split(*(*this)->getAttrDictionary().getNamed(getMapOpGroupSizesAttrName()));
242}
243
244std::pair<unsigned, unsigned> CallOp::getODSResultIndexAndLength(unsigned index) {
245 bool isVariadic[] = {true};
246 int prevVariadicCount = 0;
247 for (unsigned i = 0; i < index; ++i)
248 if (isVariadic[i]) ++prevVariadicCount;
249
250 // Calculate how many dynamic values a static variadic operand corresponds to.
251 // This assumes all static variadic operands have the same dynamic value count.
252 int variadicSize = (getOperation()->getNumResults() - 0) / 1;
253 // `index` passed in as the parameter is the static index which counts each
254 // operand (variadic or not) as size 1. So here for each previous static variadic
255 // operand, we need to offset by (variadicSize - 1) to get where the dynamic
256 // value pack for this static operand starts.
257 int start = index + (variadicSize - 1) * prevVariadicCount;
258 int size = isVariadic[index] ? variadicSize : 1;
259 return {start, size};
260}
261
262::mlir::Operation::result_range CallOp::getODSResults(unsigned index) {
263 auto valueRange = getODSResultIndexAndLength(index);
264 return {std::next(getOperation()->result_begin(), valueRange.first),
265 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
266}
267
268::mlir::LogicalResult CallOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
269 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
270 if (!dict) {
271 emitError() << "expected DictionaryAttr to set properties";
272 return ::mlir::failure();
273 }
274
275 {
276 auto &propStorage = prop.callee;
277 auto attr = dict.get("callee");
278 if (attr || /*isRequired=*/true) {
279 if (!attr) {
280 emitError() << "expected key entry for callee in DictionaryAttr to set "
281 "Properties.";
282 return ::mlir::failure();
283 }
284 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
285 if (convertedAttr) {
286 propStorage = convertedAttr;
287 } else {
288 emitError() << "Invalid attribute `callee` in property conversion: " << attr;
289 return ::mlir::failure();
290 }
291 }
292 }
293
294 {
295 auto &propStorage = prop.mapOpGroupSizes;
296 auto attr = dict.get("mapOpGroupSizes");
297 if (attr || /*isRequired=*/true) {
298 if (!attr) {
299 emitError() << "expected key entry for mapOpGroupSizes in DictionaryAttr to set "
300 "Properties.";
301 return ::mlir::failure();
302 }
303 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
304 if (convertedAttr) {
305 propStorage = convertedAttr;
306 } else {
307 emitError() << "Invalid attribute `mapOpGroupSizes` in property conversion: " << attr;
308 return ::mlir::failure();
309 }
310 }
311 }
312
313 {
314 auto &propStorage = prop.numDimsPerMap;
315 auto attr = dict.get("numDimsPerMap");
316 if (attr || /*isRequired=*/false) {
317 if (!attr) {
318 emitError() << "expected key entry for numDimsPerMap in DictionaryAttr to set "
319 "Properties.";
320 return ::mlir::failure();
321 }
322 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
323 if (convertedAttr) {
324 propStorage = convertedAttr;
325 } else {
326 emitError() << "Invalid attribute `numDimsPerMap` in property conversion: " << attr;
327 return ::mlir::failure();
328 }
329 }
330 }
331;
332 {
333 auto setFromAttr = [] (auto &propStorage, ::mlir::Attribute propAttr,
334 ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
335 return convertFromAttribute(propStorage, propAttr, emitError);;
336 };
337 auto attr = dict.get("operandSegmentSizes"); if (!attr) attr = dict.get("operand_segment_sizes");;
338 if (!attr) {
339 emitError() << "expected key entry for operandSegmentSizes in DictionaryAttr to set "
340 "Properties.";
341 return ::mlir::failure();
342 }
343 if (::mlir::failed(setFromAttr(prop.operandSegmentSizes, attr, emitError)))
344 return ::mlir::failure();
345 }
346 return ::mlir::success();
347}
348
349::mlir::Attribute CallOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
350 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
351 ::mlir::Builder odsBuilder{ctx};
352
353 {
354 const auto &propStorage = prop.callee;
355 if (propStorage)
356 attrs.push_back(odsBuilder.getNamedAttr("callee",
357 propStorage));
358 }
359
360 {
361 const auto &propStorage = prop.mapOpGroupSizes;
362 if (propStorage)
363 attrs.push_back(odsBuilder.getNamedAttr("mapOpGroupSizes",
364 propStorage));
365 }
366
367 {
368 const auto &propStorage = prop.numDimsPerMap;
369 if (propStorage)
370 attrs.push_back(odsBuilder.getNamedAttr("numDimsPerMap",
371 propStorage));
372 }
373
374 {
375 const auto &propStorage = prop.operandSegmentSizes;
376 attrs.push_back(odsBuilder.getNamedAttr("operandSegmentSizes",
377 ::mlir::DenseI32ArrayAttr::get(ctx, propStorage)));
378 }
379
380 if (!attrs.empty())
381 return odsBuilder.getDictionaryAttr(attrs);
382 return {};
383}
384
385llvm::hash_code CallOp::computePropertiesHash(const Properties &prop) {
386 auto hash_operandSegmentSizes = [] (const auto &propStorage) -> llvm::hash_code {
387 return ::llvm::hash_combine_range(std::begin(propStorage), std::end(propStorage));;
388 };
389 return llvm::hash_combine(
390 llvm::hash_value(prop.callee.getAsOpaquePointer()),
391 llvm::hash_value(prop.mapOpGroupSizes.getAsOpaquePointer()),
392 llvm::hash_value(prop.numDimsPerMap.getAsOpaquePointer()),
393 hash_operandSegmentSizes(prop.operandSegmentSizes));
394}
395
396std::optional<mlir::Attribute> CallOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
397 if (name == "callee")
398 return prop.callee;
399
400 if (name == "mapOpGroupSizes")
401 return prop.mapOpGroupSizes;
402
403 if (name == "numDimsPerMap")
404 return prop.numDimsPerMap;
405 if (name == "operand_segment_sizes" || name == "operandSegmentSizes") return ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes);
406 return std::nullopt;
407}
408
409void CallOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
410 if (name == "callee") {
411 prop.callee = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.callee)>>(value);
412 return;
413 }
414
415 if (name == "mapOpGroupSizes") {
416 prop.mapOpGroupSizes = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.mapOpGroupSizes)>>(value);
417 return;
418 }
419
420 if (name == "numDimsPerMap") {
421 prop.numDimsPerMap = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.numDimsPerMap)>>(value);
422 return;
423 }
424 if (name == "operand_segment_sizes" || name == "operandSegmentSizes") {
425 auto arrAttr = ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(value);
426 if (!arrAttr) return;
427 if (arrAttr.size() != sizeof(prop.operandSegmentSizes) / sizeof(int32_t))
428 return;
429 llvm::copy(arrAttr.asArrayRef(), prop.operandSegmentSizes.begin());
430 return;
431 }
432}
433
434void CallOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
435 if (prop.callee) attrs.append("callee", prop.callee);
436
437 if (prop.mapOpGroupSizes) attrs.append("mapOpGroupSizes", prop.mapOpGroupSizes);
438
439 if (prop.numDimsPerMap) attrs.append("numDimsPerMap", prop.numDimsPerMap);
440 attrs.append("operandSegmentSizes", ::mlir::DenseI32ArrayAttr::get(ctx, prop.operandSegmentSizes));
441}
442
443::mlir::LogicalResult CallOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
444 {
445 ::mlir::Attribute attr = attrs.get(getCalleeAttrName(opName));
446 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops0(attr, "callee", emitError)))
447 return ::mlir::failure();
448 }
449
450 {
451 ::mlir::Attribute attr = attrs.get(getMapOpGroupSizesAttrName(opName));
452 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(attr, "mapOpGroupSizes", emitError)))
453 return ::mlir::failure();
454 }
455
456 {
457 ::mlir::Attribute attr = attrs.get(getNumDimsPerMapAttrName(opName));
458 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(attr, "numDimsPerMap", emitError)))
459 return ::mlir::failure();
460 }
461 return ::mlir::success();
462}
463
464::mlir::LogicalResult CallOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
465 auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
466 if (::mlir::failed(reader.readAttribute(prop.callee)))
467 return ::mlir::failure();
468
469 if (::mlir::failed(reader.readAttribute(prop.mapOpGroupSizes)))
470 return ::mlir::failure();
471
472 if (::mlir::failed(reader.readOptionalAttribute(prop.numDimsPerMap)))
473 return ::mlir::failure();
474
475 if (reader.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) {
476 auto &propStorage = prop.operandSegmentSizes;
477 ::mlir::DenseI32ArrayAttr attr;
478 if (::mlir::failed(reader.readAttribute(attr))) return ::mlir::failure();
479 if (attr.size() > static_cast<int64_t>(sizeof(propStorage) / sizeof(int32_t))) {
480 reader.emitError("size mismatch for operand/result_segment_size");
481 return ::mlir::failure();
482 }
483 ::llvm::copy(::llvm::ArrayRef<int32_t>(attr), propStorage.begin());
484 }
485
486 {
487 auto &propStorage = prop.operandSegmentSizes;
488 auto readProp = [&]() {
489
490 if (reader.getBytecodeVersion() >= /*kNativePropertiesODSSegmentSize=*/6)
491 return reader.readSparseArray(::llvm::MutableArrayRef(propStorage));
492;
493 return ::mlir::success();
494 };
495 if (::mlir::failed(readProp()))
496 return ::mlir::failure();
497 }
498 return ::mlir::success();
499}
500
501void CallOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
502 auto &prop = getProperties(); (void)prop;
503 writer.writeAttribute(prop.callee);
504 writer.writeAttribute(prop.mapOpGroupSizes);
505
506 writer.writeOptionalAttribute(prop.numDimsPerMap);
507
508if (writer.getBytecodeVersion() < /*kNativePropertiesODSSegmentSize=*/6) {
509 auto &propStorage = prop.operandSegmentSizes;
510 writer.writeAttribute(::mlir::DenseI32ArrayAttr::get(this->getContext(), propStorage));
511}
512
513 {
514 auto &propStorage = prop.operandSegmentSizes;
515
516 if (writer.getBytecodeVersion() >= /*kNativePropertiesODSSegmentSize=*/6)
517 writer.writeSparseArray(::llvm::ArrayRef(propStorage));
518;
519 }
520}
521
522::mlir::SymbolRefAttr CallOp::getCalleeAttr() {
523 return ::llvm::cast<::mlir::SymbolRefAttr>(getProperties().callee);
524}
525
526::mlir::SymbolRefAttr CallOp::getCallee() {
527 auto attr = getCalleeAttr();
528 return attr;
529}
530
531::mlir::DenseI32ArrayAttr CallOp::getNumDimsPerMapAttr() {
532 return ::llvm::dyn_cast_or_null<::mlir::DenseI32ArrayAttr>(getProperties().numDimsPerMap);
533}
534
535::llvm::ArrayRef<int32_t> CallOp::getNumDimsPerMap() {
536 auto attr = getNumDimsPerMapAttr();
537 return attr;
538}
539
540::mlir::DenseI32ArrayAttr CallOp::getMapOpGroupSizesAttr() {
541 return ::llvm::cast<::mlir::DenseI32ArrayAttr>(getProperties().mapOpGroupSizes);
542}
543
544::llvm::ArrayRef<int32_t> CallOp::getMapOpGroupSizes() {
545 auto attr = getMapOpGroupSizesAttr();
546 return attr;
547}
548
549void CallOp::setCalleeAttr(::mlir::SymbolRefAttr attr) {
550 (*this)->setAttr(getCalleeAttrName(), attr);
551}
552
553void CallOp::setNumDimsPerMapAttr(::mlir::DenseI32ArrayAttr attr) {
554 (*this)->setAttr(getNumDimsPerMapAttrName(), attr);
555}
556
557void CallOp::setNumDimsPerMap(::llvm::ArrayRef<int32_t> attrValue) {
558 (*this)->setAttr(getNumDimsPerMapAttrName(), ::mlir::Builder((*this)->getContext()).getDenseI32ArrayAttr(attrValue));
559}
560
561void CallOp::setMapOpGroupSizesAttr(::mlir::DenseI32ArrayAttr attr) {
562 (*this)->setAttr(getMapOpGroupSizesAttrName(), attr);
563}
564
565void CallOp::setMapOpGroupSizes(::llvm::ArrayRef<int32_t> attrValue) {
566 (*this)->setAttr(getMapOpGroupSizesAttrName(), ::mlir::Builder((*this)->getContext()).getDenseI32ArrayAttr(attrValue));
567}
568
569void CallOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llzk::function::FuncDefOp callee, ::mlir::ValueRange argOperands) {
570 build(odsBuilder, odsState, callee.getFunctionType().getResults(),
571 ::mlir::SymbolRefAttr::get(callee), argOperands);
572
573}
574
575void CallOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::SymbolRefAttr callee, ::llvm::ArrayRef<::mlir::ValueRange> mapOperands, ::llvm::ArrayRef<int32_t> numDimsPerMap, ::mlir::ValueRange argOperands) {
576 build(odsBuilder, odsState, resultTypes, callee, mapOperands,
577 odsBuilder.getDenseI32ArrayAttr(numDimsPerMap), argOperands);
578
579}
580
581void CallOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llzk::function::FuncDefOp callee, ::llvm::ArrayRef<::mlir::ValueRange> mapOperands, ::mlir::DenseI32ArrayAttr numDimsPerMap, ::mlir::ValueRange argOperands) {
582 build(odsBuilder, odsState, callee.getFunctionType().getResults(),
583 ::mlir::SymbolRefAttr::get(callee), mapOperands, numDimsPerMap, argOperands);
584
585}
586
587void CallOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llzk::function::FuncDefOp callee, ::llvm::ArrayRef<::mlir::ValueRange> mapOperands, ::llvm::ArrayRef<int32_t> numDimsPerMap, ::mlir::ValueRange argOperands) {
588 build(odsBuilder, odsState, callee, mapOperands,
589 odsBuilder.getDenseI32ArrayAttr(numDimsPerMap), argOperands);
590
591}
592
593void CallOp::populateDefaultProperties(::mlir::OperationName opName, Properties &properties) {
594 ::mlir::Builder odsBuilder(opName.getContext());
595 if (!properties.numDimsPerMap)
596 properties.numDimsPerMap = odsBuilder.getDenseI32ArrayAttr({});
597}
598
599::mlir::LogicalResult CallOp::verifyInvariantsImpl() {
600 auto tblgen_callee = getProperties().callee; (void)tblgen_callee;
601 if (!tblgen_callee) return emitOpError("requires attribute 'callee'");
602 auto tblgen_mapOpGroupSizes = getProperties().mapOpGroupSizes; (void)tblgen_mapOpGroupSizes;
603 if (!tblgen_mapOpGroupSizes) return emitOpError("requires attribute 'mapOpGroupSizes'");
604 auto tblgen_numDimsPerMap = getProperties().numDimsPerMap; (void)tblgen_numDimsPerMap;
605
606 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops0(*this, tblgen_callee, "callee")))
607 return ::mlir::failure();
608
609 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(*this, tblgen_numDimsPerMap, "numDimsPerMap")))
610 return ::mlir::failure();
611
612 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops1(*this, tblgen_mapOpGroupSizes, "mapOpGroupSizes")))
613 return ::mlir::failure();
614 {
615 unsigned index = 0; (void)index;
616 auto valueGroup0 = getODSOperands(0);
617
618 for (auto v : valueGroup0) {
619 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops0(*this, v.getType(), "operand", index++)))
620 return ::mlir::failure();
621 }
622 auto valueGroup1 = getODSOperands(1);
623 if (::mlir::failed(::mlir::OpTrait::impl::verifyValueSizeAttr(*this, "mapOpGroupSizes", "mapOperands", valueGroup1.size())))
624 return ::mlir::failure();
625
626 for (auto v : valueGroup1) {
627 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*this, v.getType(), "operand", index++)))
628 return ::mlir::failure();
629 }
630 }
631 {
632 unsigned index = 0; (void)index;
633 auto valueGroup0 = getODSResults(0);
634
635 for (auto v : valueGroup0) {
636 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops0(*this, v.getType(), "result", index++)))
637 return ::mlir::failure();
638 }
639 }
640 return ::mlir::success();
641}
642
643::mlir::LogicalResult CallOp::verifyInvariants() {
644 return verifyInvariantsImpl();
645}
646
647::mlir::ParseResult CallOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
648 ::mlir::SymbolRefAttr calleeAttr;
649 ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> argOperandsOperands;
650 ::llvm::SMLoc argOperandsOperandsLoc;
651 (void)argOperandsOperandsLoc;
652 ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> mapOperandsOperands;
653 llvm::SmallVector<int32_t> mapOperandsOperandGroupSizes;
654 ::llvm::SMLoc mapOperandsOperandsLoc;
655 (void)mapOperandsOperandsLoc;
656 ::mlir::DenseI32ArrayAttr numDimsPerMapAttr;
657 ::llvm::ArrayRef<::mlir::Type> argOperandsTypes;
658 ::llvm::ArrayRef<::mlir::Type> allResultTypes;
659
660 if (parser.parseCustomAttributeWithFallback(calleeAttr, parser.getBuilder().getType<::mlir::NoneType>())) {
661 return ::mlir::failure();
662 }
663 if (calleeAttr) result.getOrAddProperties<CallOp::Properties>().callee = calleeAttr;
664 if (parser.parseLParen())
665 return ::mlir::failure();
666
667 argOperandsOperandsLoc = parser.getCurrentLocation();
668 if (parser.parseOperandList(argOperandsOperands))
669 return ::mlir::failure();
670 if (parser.parseRParen())
671 return ::mlir::failure();
672 if (::mlir::succeeded(parser.parseOptionalLBrace())) {
673 {
674 mapOperandsOperandsLoc = parser.getCurrentLocation();
675 ::llvm::SmallVector<::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand>> mapOperandsOperandGroups;
676 auto odsResult = parseMultiDimAndSymbolList(parser, mapOperandsOperandGroups, numDimsPerMapAttr);
677 if (odsResult) return ::mlir::failure();
678 for (const auto &subRange : mapOperandsOperandGroups) {
679 mapOperandsOperands.append(subRange.begin(), subRange.end());
680 mapOperandsOperandGroupSizes.push_back(subRange.size());
681 }
682 if (numDimsPerMapAttr)
683 result.getOrAddProperties<CallOp::Properties>().numDimsPerMap = numDimsPerMapAttr;
684 }
685 if (parser.parseRBrace())
686 return ::mlir::failure();
687 }
688 if (parser.parseColon())
689 return ::mlir::failure();
690
691 ::mlir::FunctionType argOperands__allResult_functionType;
692 if (parser.parseType(argOperands__allResult_functionType))
693 return ::mlir::failure();
694 argOperandsTypes = argOperands__allResult_functionType.getInputs();
695 allResultTypes = argOperands__allResult_functionType.getResults();
696 {
697 auto odsResult = parseAttrDictWithWarnings(parser, result.attributes, result);
698 if (odsResult) return ::mlir::failure();
699 }
700::llvm::copy(::llvm::ArrayRef<int32_t>({static_cast<int32_t>(argOperandsOperands.size()), static_cast<int32_t>(mapOperandsOperands.size())}), result.getOrAddProperties<CallOp::Properties>().operandSegmentSizes.begin());
701 result.getOrAddProperties<CallOp::Properties>().mapOpGroupSizes = parser.getBuilder().getDenseI32ArrayAttr(mapOperandsOperandGroupSizes);
702 ::mlir::Type odsBuildableType0 = parser.getBuilder().getIndexType();
703 result.addTypes(allResultTypes);
704 if (parser.resolveOperands(argOperandsOperands, argOperandsTypes, argOperandsOperandsLoc, result.operands))
705 return ::mlir::failure();
706 if (parser.resolveOperands(mapOperandsOperands, odsBuildableType0, mapOperandsOperandsLoc, result.operands))
707 return ::mlir::failure();
708 return ::mlir::success();
709}
710
711void CallOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
712 _odsPrinter << ' ';
713 _odsPrinter.printAttributeWithoutType(getCalleeAttr());
714 _odsPrinter << "(";
715 _odsPrinter << getArgOperands();
716 _odsPrinter << ")";
717 if (((!getMapOperands().empty()) || (getNumDimsPerMapAttr() && getNumDimsPerMapAttr() != ::mlir::OpBuilder((*this)->getContext()).getDenseI32ArrayAttr({})))) {
718 _odsPrinter << ' ' << "{";
720 _odsPrinter << "}";
721 }
722 _odsPrinter << ' ' << ":";
723 _odsPrinter << ' ';
724 _odsPrinter.printFunctionalType(getArgOperands().getTypes(), getOperation()->getResultTypes());
725 _odsPrinter << ' ';
726 printAttrDictWithWarnings(_odsPrinter, *this, getOperation()->getAttrDictionary(), getProperties());
727}
728
729} // namespace function
730} // namespace llzk
731MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::function::CallOp)
732
733namespace llzk {
734namespace function {
735
736//===----------------------------------------------------------------------===//
737// ::llzk::function::FuncDefOp definitions
738//===----------------------------------------------------------------------===//
739
740namespace detail {
741FuncDefOpGenericAdaptorBase::FuncDefOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
742 odsOpName.emplace("function.def", odsAttrs.getContext());
743}
744
746
747std::pair<unsigned, unsigned> FuncDefOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
748 return {index, 1};
749}
750
752 return odsAttrs;
753}
754
756 auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name);
757 return attr;
758}
759
761 auto attr = getSymNameAttr();
762 return attr.getValue();
763}
764
766 auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().function_type);
767 return attr;
768}
769
771 auto attr = getFunctionTypeAttr();
772 return ::llvm::cast<::mlir::FunctionType>(attr.getValue());
773}
774
776 auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().arg_attrs);
777 return attr;
778}
779
780::std::optional< ::mlir::ArrayAttr > FuncDefOpGenericAdaptorBase::getArgAttrs() {
781 auto attr = getArgAttrsAttr();
782 return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
783}
784
786 auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().res_attrs);
787 return attr;
788}
789
790::std::optional< ::mlir::ArrayAttr > FuncDefOpGenericAdaptorBase::getResAttrs() {
791 auto attr = getResAttrsAttr();
792 return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
793}
794
796 return *odsRegions[0];
797}
798
800 return odsRegions;
801}
802
803} // namespace detail
805
806::mlir::LogicalResult FuncDefOpAdaptor::verify(::mlir::Location loc) {
807 auto tblgen_arg_attrs = getProperties().arg_attrs; (void)tblgen_arg_attrs;
808 auto tblgen_function_type = getProperties().function_type; (void)tblgen_function_type;
809 if (!tblgen_function_type) return emitError(loc, "'function.def' op ""requires attribute 'function_type'");
810 auto tblgen_res_attrs = getProperties().res_attrs; (void)tblgen_res_attrs;
811 auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
812 if (!tblgen_sym_name) return emitError(loc, "'function.def' op ""requires attribute 'sym_name'");
813
814 if (tblgen_sym_name && !((::llvm::isa<::mlir::StringAttr>(tblgen_sym_name))))
815 return emitError(loc, "'function.def' op ""attribute 'sym_name' failed to satisfy constraint: string attribute");
816
817 if (tblgen_function_type && !(((::llvm::isa<::mlir::TypeAttr>(tblgen_function_type))) && ((::llvm::isa<::mlir::FunctionType>(::llvm::cast<::mlir::TypeAttr>(tblgen_function_type).getValue()))) && ((::llvm::isa<::mlir::FunctionType>(::llvm::cast<::mlir::TypeAttr>(tblgen_function_type).getValue())))))
818 return emitError(loc, "'function.def' op ""attribute 'function_type' failed to satisfy constraint: type attribute of function type");
819
820 if (tblgen_arg_attrs && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_arg_attrs))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_arg_attrs), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::DictionaryAttr>(attr))); }))))
821 return emitError(loc, "'function.def' op ""attribute 'arg_attrs' failed to satisfy constraint: Array of dictionary attributes");
822
823 if (tblgen_res_attrs && !(((::llvm::isa<::mlir::ArrayAttr>(tblgen_res_attrs))) && (::llvm::all_of(::llvm::cast<::mlir::ArrayAttr>(tblgen_res_attrs), [&](::mlir::Attribute attr) { return attr && ((::llvm::isa<::mlir::DictionaryAttr>(attr))); }))))
824 return emitError(loc, "'function.def' op ""attribute 'res_attrs' failed to satisfy constraint: Array of dictionary attributes");
825 return ::mlir::success();
826}
827
828std::pair<unsigned, unsigned> FuncDefOp::getODSOperandIndexAndLength(unsigned index) {
829 return {index, 1};
830}
831
832::mlir::Operation::operand_range FuncDefOp::getODSOperands(unsigned index) {
833 auto valueRange = getODSOperandIndexAndLength(index);
834 return {std::next(getOperation()->operand_begin(), valueRange.first),
835 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
836}
837
838std::pair<unsigned, unsigned> FuncDefOp::getODSResultIndexAndLength(unsigned index) {
839 return {index, 1};
840}
841
842::mlir::Operation::result_range FuncDefOp::getODSResults(unsigned index) {
843 auto valueRange = getODSResultIndexAndLength(index);
844 return {std::next(getOperation()->result_begin(), valueRange.first),
845 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
846}
847
848::mlir::Region &FuncDefOp::getBody() {
849 return (*this)->getRegion(0);
850}
851
852::mlir::LogicalResult FuncDefOp::setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
853 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
854 if (!dict) {
855 emitError() << "expected DictionaryAttr to set properties";
856 return ::mlir::failure();
857 }
858
859 {
860 auto &propStorage = prop.arg_attrs;
861 auto attr = dict.get("arg_attrs");
862 if (attr || /*isRequired=*/false) {
863 if (!attr) {
864 emitError() << "expected key entry for arg_attrs in DictionaryAttr to set "
865 "Properties.";
866 return ::mlir::failure();
867 }
868 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
869 if (convertedAttr) {
870 propStorage = convertedAttr;
871 } else {
872 emitError() << "Invalid attribute `arg_attrs` in property conversion: " << attr;
873 return ::mlir::failure();
874 }
875 }
876 }
877
878 {
879 auto &propStorage = prop.function_type;
880 auto attr = dict.get("function_type");
881 if (attr || /*isRequired=*/true) {
882 if (!attr) {
883 emitError() << "expected key entry for function_type in DictionaryAttr to set "
884 "Properties.";
885 return ::mlir::failure();
886 }
887 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
888 if (convertedAttr) {
889 propStorage = convertedAttr;
890 } else {
891 emitError() << "Invalid attribute `function_type` in property conversion: " << attr;
892 return ::mlir::failure();
893 }
894 }
895 }
896
897 {
898 auto &propStorage = prop.res_attrs;
899 auto attr = dict.get("res_attrs");
900 if (attr || /*isRequired=*/false) {
901 if (!attr) {
902 emitError() << "expected key entry for res_attrs in DictionaryAttr to set "
903 "Properties.";
904 return ::mlir::failure();
905 }
906 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
907 if (convertedAttr) {
908 propStorage = convertedAttr;
909 } else {
910 emitError() << "Invalid attribute `res_attrs` in property conversion: " << attr;
911 return ::mlir::failure();
912 }
913 }
914 }
915
916 {
917 auto &propStorage = prop.sym_name;
918 auto attr = dict.get("sym_name");
919 if (attr || /*isRequired=*/true) {
920 if (!attr) {
921 emitError() << "expected key entry for sym_name in DictionaryAttr to set "
922 "Properties.";
923 return ::mlir::failure();
924 }
925 auto convertedAttr = ::llvm::dyn_cast<std::remove_reference_t<decltype(propStorage)>>(attr);
926 if (convertedAttr) {
927 propStorage = convertedAttr;
928 } else {
929 emitError() << "Invalid attribute `sym_name` in property conversion: " << attr;
930 return ::mlir::failure();
931 }
932 }
933 }
934 return ::mlir::success();
935}
936
937::mlir::Attribute FuncDefOp::getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop) {
938 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
939 ::mlir::Builder odsBuilder{ctx};
940
941 {
942 const auto &propStorage = prop.arg_attrs;
943 if (propStorage)
944 attrs.push_back(odsBuilder.getNamedAttr("arg_attrs",
945 propStorage));
946 }
947
948 {
949 const auto &propStorage = prop.function_type;
950 if (propStorage)
951 attrs.push_back(odsBuilder.getNamedAttr("function_type",
952 propStorage));
953 }
954
955 {
956 const auto &propStorage = prop.res_attrs;
957 if (propStorage)
958 attrs.push_back(odsBuilder.getNamedAttr("res_attrs",
959 propStorage));
960 }
961
962 {
963 const auto &propStorage = prop.sym_name;
964 if (propStorage)
965 attrs.push_back(odsBuilder.getNamedAttr("sym_name",
966 propStorage));
967 }
968
969 if (!attrs.empty())
970 return odsBuilder.getDictionaryAttr(attrs);
971 return {};
972}
973
974llvm::hash_code FuncDefOp::computePropertiesHash(const Properties &prop) {
975 return llvm::hash_combine(
976 llvm::hash_value(prop.arg_attrs.getAsOpaquePointer()),
977 llvm::hash_value(prop.function_type.getAsOpaquePointer()),
978 llvm::hash_value(prop.res_attrs.getAsOpaquePointer()),
979 llvm::hash_value(prop.sym_name.getAsOpaquePointer()));
980}
981
982std::optional<mlir::Attribute> FuncDefOp::getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name) {
983 if (name == "arg_attrs")
984 return prop.arg_attrs;
985
986 if (name == "function_type")
987 return prop.function_type;
988
989 if (name == "res_attrs")
990 return prop.res_attrs;
991
992 if (name == "sym_name")
993 return prop.sym_name;
994 return std::nullopt;
995}
996
997void FuncDefOp::setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value) {
998 if (name == "arg_attrs") {
999 prop.arg_attrs = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.arg_attrs)>>(value);
1000 return;
1001 }
1002
1003 if (name == "function_type") {
1004 prop.function_type = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.function_type)>>(value);
1005 return;
1006 }
1007
1008 if (name == "res_attrs") {
1009 prop.res_attrs = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.res_attrs)>>(value);
1010 return;
1011 }
1012
1013 if (name == "sym_name") {
1014 prop.sym_name = ::llvm::dyn_cast_or_null<std::remove_reference_t<decltype(prop.sym_name)>>(value);
1015 return;
1016 }
1017}
1018
1019void FuncDefOp::populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs) {
1020 if (prop.arg_attrs) attrs.append("arg_attrs", prop.arg_attrs);
1021
1022 if (prop.function_type) attrs.append("function_type", prop.function_type);
1023
1024 if (prop.res_attrs) attrs.append("res_attrs", prop.res_attrs);
1025
1026 if (prop.sym_name) attrs.append("sym_name", prop.sym_name);
1027}
1028
1029::mlir::LogicalResult FuncDefOp::verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {
1030 {
1031 ::mlir::Attribute attr = attrs.get(getArgAttrsAttrName(opName));
1032 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops4(attr, "arg_attrs", emitError)))
1033 return ::mlir::failure();
1034 }
1035
1036 {
1037 ::mlir::Attribute attr = attrs.get(getFunctionTypeAttrName(opName));
1038 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops3(attr, "function_type", emitError)))
1039 return ::mlir::failure();
1040 }
1041
1042 {
1043 ::mlir::Attribute attr = attrs.get(getResAttrsAttrName(opName));
1044 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops4(attr, "res_attrs", emitError)))
1045 return ::mlir::failure();
1046 }
1047
1048 {
1049 ::mlir::Attribute attr = attrs.get(getSymNameAttrName(opName));
1050 if (attr && ::mlir::failed(__mlir_ods_local_attr_constraint_Ops2(attr, "sym_name", emitError)))
1051 return ::mlir::failure();
1052 }
1053 return ::mlir::success();
1054}
1055
1056::mlir::LogicalResult FuncDefOp::readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state) {
1057 auto &prop = state.getOrAddProperties<Properties>(); (void)prop;
1058 if (::mlir::failed(reader.readOptionalAttribute(prop.arg_attrs)))
1059 return ::mlir::failure();
1060
1061 if (::mlir::failed(reader.readAttribute(prop.function_type)))
1062 return ::mlir::failure();
1063
1064 if (::mlir::failed(reader.readOptionalAttribute(prop.res_attrs)))
1065 return ::mlir::failure();
1066
1067 if (::mlir::failed(reader.readAttribute(prop.sym_name)))
1068 return ::mlir::failure();
1069 return ::mlir::success();
1070}
1071
1072void FuncDefOp::writeProperties(::mlir::DialectBytecodeWriter &writer) {
1073 auto &prop = getProperties(); (void)prop;
1074
1075 writer.writeOptionalAttribute(prop.arg_attrs);
1076 writer.writeAttribute(prop.function_type);
1077
1078 writer.writeOptionalAttribute(prop.res_attrs);
1079 writer.writeAttribute(prop.sym_name);
1080}
1081
1082::mlir::StringAttr FuncDefOp::getSymNameAttr() {
1083 return ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name);
1084}
1085
1086::llvm::StringRef FuncDefOp::getSymName() {
1087 auto attr = getSymNameAttr();
1088 return attr.getValue();
1089}
1090
1092 return ::llvm::cast<::mlir::TypeAttr>(getProperties().function_type);
1093}
1094
1095::mlir::FunctionType FuncDefOp::getFunctionType() {
1096 auto attr = getFunctionTypeAttr();
1097 return ::llvm::cast<::mlir::FunctionType>(attr.getValue());
1098}
1099
1100::mlir::ArrayAttr FuncDefOp::getArgAttrsAttr() {
1101 return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().arg_attrs);
1102}
1103
1104::std::optional< ::mlir::ArrayAttr > FuncDefOp::getArgAttrs() {
1105 auto attr = getArgAttrsAttr();
1106 return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
1107}
1108
1109::mlir::ArrayAttr FuncDefOp::getResAttrsAttr() {
1110 return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().res_attrs);
1111}
1112
1113::std::optional< ::mlir::ArrayAttr > FuncDefOp::getResAttrs() {
1114 auto attr = getResAttrsAttr();
1115 return attr ? ::std::optional< ::mlir::ArrayAttr >(attr) : (::std::nullopt);
1116}
1117
1118void FuncDefOp::setSymNameAttr(::mlir::StringAttr attr) {
1119 (*this)->setAttr(getSymNameAttrName(), attr);
1120}
1121
1122void FuncDefOp::setSymName(::llvm::StringRef attrValue) {
1123 (*this)->setAttr(getSymNameAttrName(), ::mlir::Builder((*this)->getContext()).getStringAttr(attrValue));
1124}
1125
1126void FuncDefOp::setFunctionTypeAttr(::mlir::TypeAttr attr) {
1127 (*this)->setAttr(getFunctionTypeAttrName(), attr);
1128}
1129
1130void FuncDefOp::setFunctionType(::mlir::FunctionType attrValue) {
1131 (*this)->setAttr(getFunctionTypeAttrName(), ::mlir::TypeAttr::get(attrValue));
1132}
1133
1134void FuncDefOp::setArgAttrsAttr(::mlir::ArrayAttr attr) {
1135 (*this)->setAttr(getArgAttrsAttrName(), attr);
1136}
1137
1138void FuncDefOp::setResAttrsAttr(::mlir::ArrayAttr attr) {
1139 (*this)->setAttr(getResAttrsAttrName(), attr);
1140}
1141
1143 auto &attr = getProperties().arg_attrs;
1144 attr = {};
1145 return attr;
1146}
1147
1149 auto &attr = getProperties().res_attrs;
1150 attr = {};
1151 return attr;
1152}
1153
1154void FuncDefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::TypeAttr function_type, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) {
1155 odsState.getOrAddProperties<Properties>().sym_name = sym_name;
1156 odsState.getOrAddProperties<Properties>().function_type = function_type;
1157 if (arg_attrs) {
1158 odsState.getOrAddProperties<Properties>().arg_attrs = arg_attrs;
1159 }
1160 if (res_attrs) {
1161 odsState.getOrAddProperties<Properties>().res_attrs = res_attrs;
1162 }
1163 (void)odsState.addRegion();
1164}
1165
1166void FuncDefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr function_type, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) {
1167 odsState.getOrAddProperties<Properties>().sym_name = sym_name;
1168 odsState.getOrAddProperties<Properties>().function_type = function_type;
1169 if (arg_attrs) {
1170 odsState.getOrAddProperties<Properties>().arg_attrs = arg_attrs;
1171 }
1172 if (res_attrs) {
1173 odsState.getOrAddProperties<Properties>().res_attrs = res_attrs;
1174 }
1175 (void)odsState.addRegion();
1176 assert(resultTypes.size() == 0u && "mismatched number of results");
1177 odsState.addTypes(resultTypes);
1178}
1179
1180void FuncDefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, ::mlir::FunctionType function_type, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) {
1181 odsState.getOrAddProperties<Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
1182 odsState.getOrAddProperties<Properties>().function_type = ::mlir::TypeAttr::get(function_type);
1183 if (arg_attrs) {
1184 odsState.getOrAddProperties<Properties>().arg_attrs = arg_attrs;
1185 }
1186 if (res_attrs) {
1187 odsState.getOrAddProperties<Properties>().res_attrs = res_attrs;
1188 }
1189 (void)odsState.addRegion();
1190}
1191
1192void FuncDefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::FunctionType function_type, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs) {
1193 odsState.getOrAddProperties<Properties>().sym_name = odsBuilder.getStringAttr(sym_name);
1194 odsState.getOrAddProperties<Properties>().function_type = ::mlir::TypeAttr::get(function_type);
1195 if (arg_attrs) {
1196 odsState.getOrAddProperties<Properties>().arg_attrs = arg_attrs;
1197 }
1198 if (res_attrs) {
1199 odsState.getOrAddProperties<Properties>().res_attrs = res_attrs;
1200 }
1201 (void)odsState.addRegion();
1202 assert(resultTypes.size() == 0u && "mismatched number of results");
1203 odsState.addTypes(resultTypes);
1204}
1205
1206void FuncDefOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
1207 assert(operands.size() == 0u && "mismatched number of parameters");
1208 odsState.addOperands(operands);
1209 odsState.addAttributes(attributes);
1210 for (unsigned i = 0; i != 1; ++i)
1211 (void)odsState.addRegion();
1212 assert(resultTypes.size() == 0u && "mismatched number of return types");
1213 odsState.addTypes(resultTypes);
1214}
1215
1216::mlir::LogicalResult FuncDefOp::verifyInvariantsImpl() {
1217 auto tblgen_arg_attrs = getProperties().arg_attrs; (void)tblgen_arg_attrs;
1218 auto tblgen_function_type = getProperties().function_type; (void)tblgen_function_type;
1219 if (!tblgen_function_type) return emitOpError("requires attribute 'function_type'");
1220 auto tblgen_res_attrs = getProperties().res_attrs; (void)tblgen_res_attrs;
1221 auto tblgen_sym_name = getProperties().sym_name; (void)tblgen_sym_name;
1222 if (!tblgen_sym_name) return emitOpError("requires attribute 'sym_name'");
1223
1224 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops2(*this, tblgen_sym_name, "sym_name")))
1225 return ::mlir::failure();
1226
1227 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops3(*this, tblgen_function_type, "function_type")))
1228 return ::mlir::failure();
1229
1230 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops4(*this, tblgen_arg_attrs, "arg_attrs")))
1231 return ::mlir::failure();
1232
1233 if (::mlir::failed(__mlir_ods_local_attr_constraint_Ops4(*this, tblgen_res_attrs, "res_attrs")))
1234 return ::mlir::failure();
1235 {
1236 unsigned index = 0; (void)index;
1237
1238 for (auto &region : ::llvm::MutableArrayRef((*this)->getRegion(0)))
1239 if (::mlir::failed(__mlir_ods_local_region_constraint_Ops0(*this, region, "body", index++)))
1240 return ::mlir::failure();
1241 }
1242 return ::mlir::success();
1243}
1244
1245::mlir::LogicalResult FuncDefOp::verifyInvariants() {
1246 if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
1247 return ::mlir::success();
1248 return ::mlir::failure();
1249}
1250
1251} // namespace function
1252} // namespace llzk
1253MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::function::FuncDefOp)
1254
1255namespace llzk {
1256namespace function {
1257
1258//===----------------------------------------------------------------------===//
1259// ::llzk::function::ReturnOp definitions
1260//===----------------------------------------------------------------------===//
1261
1262namespace detail {
1263ReturnOpGenericAdaptorBase::ReturnOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs)
1264 odsOpName.emplace("function.return", odsAttrs.getContext());
1265}
1266
1267ReturnOpGenericAdaptorBase::ReturnOpGenericAdaptorBase(ReturnOp op) : ReturnOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {}
1268
1269std::pair<unsigned, unsigned> ReturnOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
1270 bool isVariadic[] = {true};
1271 int prevVariadicCount = 0;
1272 for (unsigned i = 0; i < index; ++i)
1273 if (isVariadic[i]) ++prevVariadicCount;
1274
1275 // Calculate how many dynamic values a static variadic operand corresponds to.
1276 // This assumes all static variadic operands have the same dynamic value count.
1277 int variadicSize = (odsOperandsSize - 0) / 1;
1278 // `index` passed in as the parameter is the static index which counts each
1279 // operand (variadic or not) as size 1. So here for each previous static variadic
1280 // operand, we need to offset by (variadicSize - 1) to get where the dynamic
1281 // value pack for this static operand starts.
1282 int start = index + (variadicSize - 1) * prevVariadicCount;
1283 int size = isVariadic[index] ? variadicSize : 1;
1284 return {start, size};
1285}
1286
1288 return odsAttrs;
1289}
1290
1291} // namespace detail
1293
1294::mlir::LogicalResult ReturnOpAdaptor::verify(::mlir::Location loc) {
1295 return ::mlir::success();
1296}
1297
1298std::pair<unsigned, unsigned> ReturnOp::getODSOperandIndexAndLength(unsigned index) {
1299 bool isVariadic[] = {true};
1300 int prevVariadicCount = 0;
1301 for (unsigned i = 0; i < index; ++i)
1302 if (isVariadic[i]) ++prevVariadicCount;
1303
1304 // Calculate how many dynamic values a static variadic operand corresponds to.
1305 // This assumes all static variadic operands have the same dynamic value count.
1306 int variadicSize = (getOperation()->getNumOperands() - 0) / 1;
1307 // `index` passed in as the parameter is the static index which counts each
1308 // operand (variadic or not) as size 1. So here for each previous static variadic
1309 // operand, we need to offset by (variadicSize - 1) to get where the dynamic
1310 // value pack for this static operand starts.
1311 int start = index + (variadicSize - 1) * prevVariadicCount;
1312 int size = isVariadic[index] ? variadicSize : 1;
1313 return {start, size};
1314}
1315
1316::mlir::Operation::operand_range ReturnOp::getODSOperands(unsigned index) {
1317 auto valueRange = getODSOperandIndexAndLength(index);
1318 return {std::next(getOperation()->operand_begin(), valueRange.first),
1319 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
1320}
1321
1322::mlir::Operation::operand_range ReturnOp::getOperands() {
1323 return getODSOperands(0);
1324}
1325
1326::mlir::MutableOperandRange ReturnOp::getOperandsMutable() {
1327 auto range = getODSOperandIndexAndLength(0);
1328 auto mutableRange = ::mlir::MutableOperandRange(getOperation(), range.first, range.second);
1329 return mutableRange;
1330}
1331
1332std::pair<unsigned, unsigned> ReturnOp::getODSResultIndexAndLength(unsigned index) {
1333 return {index, 1};
1334}
1335
1336::mlir::Operation::result_range ReturnOp::getODSResults(unsigned index) {
1337 auto valueRange = getODSResultIndexAndLength(index);
1338 return {std::next(getOperation()->result_begin(), valueRange.first),
1339 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
1340}
1341
1342void ReturnOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) {
1343 build(odsBuilder, odsState, std::nullopt);
1344
1345}
1346
1347void ReturnOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands) {
1348 odsState.addOperands(operands);
1349}
1350
1351void ReturnOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
1352 odsState.addOperands(operands);
1353 odsState.addAttributes(attributes);
1354 assert(resultTypes.size() == 0u && "mismatched number of return types");
1355 odsState.addTypes(resultTypes);
1356}
1357
1358::mlir::LogicalResult ReturnOp::verifyInvariantsImpl() {
1359 {
1360 unsigned index = 0; (void)index;
1361 auto valueGroup0 = getODSOperands(0);
1362
1363 for (auto v : valueGroup0) {
1364 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops0(*this, v.getType(), "operand", index++)))
1365 return ::mlir::failure();
1366 }
1367 }
1368 return ::mlir::success();
1369}
1370
1371::mlir::LogicalResult ReturnOp::verifyInvariants() {
1372 if(::mlir::succeeded(verifyInvariantsImpl()) && ::mlir::succeeded(verify()))
1373 return ::mlir::success();
1374 return ::mlir::failure();
1375}
1376
1377::mlir::ParseResult ReturnOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
1378 ::llvm::SmallVector<::mlir::OpAsmParser::UnresolvedOperand, 4> operandsOperands;
1379 ::llvm::SMLoc operandsOperandsLoc;
1380 (void)operandsOperandsLoc;
1381 ::llvm::SmallVector<::mlir::Type, 1> operandsTypes;
1382 {
1383 auto loc = parser.getCurrentLocation();(void)loc;
1384 if (parser.parseOptionalAttrDict(result.attributes))
1385 return ::mlir::failure();
1386 }
1387
1388 operandsOperandsLoc = parser.getCurrentLocation();
1389 if (parser.parseOperandList(operandsOperands))
1390 return ::mlir::failure();
1391 if (!operandsOperands.empty()) {
1392 if (parser.parseColon())
1393 return ::mlir::failure();
1394
1395 if (parser.parseTypeList(operandsTypes))
1396 return ::mlir::failure();
1397 }
1398 if (parser.resolveOperands(operandsOperands, operandsTypes, operandsOperandsLoc, result.operands))
1399 return ::mlir::failure();
1400 return ::mlir::success();
1401}
1402
1403void ReturnOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
1404 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
1405 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
1406 if (!getOperands().empty()) {
1407 _odsPrinter << ' ';
1408 _odsPrinter << getOperands();
1409 _odsPrinter << ' ' << ":";
1410 _odsPrinter << ' ';
1411 _odsPrinter << getOperands().getTypes();
1412 }
1413}
1414
1415void ReturnOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
1416}
1417
1418::mlir::MutableOperandRange ReturnOp::getMutableSuccessorOperands(
1419 ::mlir::RegionBranchPoint point) {
1420 return ::mlir::MutableOperandRange(*this);
1421}
1422
1423} // namespace function
1424} // namespace llzk
1425MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::function::ReturnOp)
1426
1427
1428#endif // GET_OP_CLASSES
1429
::mlir::LogicalResult verify(::mlir::Location loc)
Definition Ops.cpp.inc:191
CallOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties={}, ::mlir::RegionRange regions={})
Definition Ops.h.inc:129
::mlir::OperandRangeRange getMapOperands()
Definition Ops.cpp.inc:228
void setNumDimsPerMap(::llvm::ArrayRef< int32_t > attrValue)
Definition Ops.cpp.inc:557
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
Definition Ops.cpp.inc:434
static llvm::hash_code computePropertiesHash(const Properties &prop)
Definition Ops.cpp.inc:385
::mlir::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:643
static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties)
Definition Ops.cpp.inc:593
::mlir::SymbolRefAttr getCallee()
Definition Ops.cpp.inc:526
std::pair< unsigned, unsigned > getODSResultIndexAndLength(unsigned index)
Definition Ops.cpp.inc:244
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
Definition Ops.cpp.inc:396
void setMapOpGroupSizesAttr(::mlir::DenseI32ArrayAttr attr)
Definition Ops.cpp.inc:561
::mlir::LogicalResult verifyInvariantsImpl()
Definition Ops.cpp.inc:599
::mlir::Operation::result_range getODSResults(unsigned index)
Definition Ops.cpp.inc:262
void writeProperties(::mlir::DialectBytecodeWriter &writer)
Definition Ops.cpp.inc:501
void setMapOpGroupSizes(::llvm::ArrayRef< int32_t > attrValue)
Definition Ops.cpp.inc:565
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
Definition Ops.cpp.inc:409
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::SymbolRefAttr callee, ::mlir::ValueRange argOperands={})
::llvm::ArrayRef< int32_t > getMapOpGroupSizes()
Definition Ops.cpp.inc:544
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index)
Definition Ops.cpp.inc:209
::mlir::MutableOperandRange getArgOperandsMutable()
Definition Ops.cpp.inc:232
::mlir::DenseI32ArrayAttr getNumDimsPerMapAttr()
Definition Ops.cpp.inc:531
::llvm::ArrayRef< int32_t > getNumDimsPerMap()
Definition Ops.cpp.inc:535
::mlir::StringAttr getMapOpGroupSizesAttrName()
Definition Ops.h.inc:198
::mlir::SymbolRefAttr getCalleeAttr()
Definition Ops.cpp.inc:522
::mlir::DenseI32ArrayAttr getMapOpGroupSizesAttr()
Definition Ops.cpp.inc:540
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
Definition Ops.cpp.inc:647
void print(::mlir::OpAsmPrinter &_odsPrinter)
Definition Ops.cpp.inc:711
FoldAdaptor::Properties Properties
Definition Ops.h.inc:184
void setCalleeAttr(::mlir::SymbolRefAttr attr)
Definition Ops.cpp.inc:549
void setNumDimsPerMapAttr(::mlir::DenseI32ArrayAttr attr)
Definition Ops.cpp.inc:553
::mlir::StringAttr getNumDimsPerMapAttrName()
Definition Ops.h.inc:206
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
Definition Ops.cpp.inc:349
::mlir::MutableOperandRangeRange getMapOperandsMutable()
Definition Ops.cpp.inc:238
::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:268
::mlir::StringAttr getCalleeAttrName()
Definition Ops.h.inc:190
::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:443
::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state)
Definition Ops.cpp.inc:464
::mlir::Operation::operand_range getArgOperands()
Definition Ops.cpp.inc:224
::mlir::Operation::operand_range getODSOperands(unsigned index)
Definition Ops.cpp.inc:218
::mlir::LogicalResult verify(::mlir::Location loc)
Definition Ops.cpp.inc:806
FuncDefOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs=nullptr, const Properties &properties={}, ::mlir::RegionRange regions={})
Definition Ops.h.inc:401
::mlir::ArrayAttr getArgAttrsAttr()
Definition Ops.cpp.inc:1100
::mlir::Operation::operand_range getODSOperands(unsigned index)
Definition Ops.cpp.inc:832
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
Definition Ops.cpp.inc:997
static llvm::hash_code computePropertiesHash(const Properties &prop)
Definition Ops.cpp.inc:974
FoldAdaptor::Properties Properties
Definition Ops.h.inc:440
::mlir::FunctionType getFunctionType()
Definition Ops.cpp.inc:1095
void setArgAttrsAttr(::mlir::ArrayAttr attr)
Definition Ops.cpp.inc:1134
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef name, ::mlir::FunctionType type, ::llvm::ArrayRef<::mlir::NamedAttribute > attrs={}, ::llvm::ArrayRef<::mlir::DictionaryAttr > argAttrs={})
::mlir::StringAttr getSymNameAttrName()
Definition Ops.h.inc:470
::mlir::Attribute removeArgAttrsAttr()
Definition Ops.cpp.inc:1142
::mlir::StringAttr getSymNameAttr()
Definition Ops.cpp.inc:1082
void setSymNameAttr(::mlir::StringAttr attr)
Definition Ops.cpp.inc:1118
::mlir::StringAttr getFunctionTypeAttrName()
Definition Ops.h.inc:454
::mlir::TypeAttr getFunctionTypeAttr()
Definition Ops.cpp.inc:1091
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
Definition Ops.cpp.inc:982
::mlir::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:1245
::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:1029
::mlir::Operation::result_range getODSResults(unsigned index)
Definition Ops.cpp.inc:842
void setResAttrsAttr(::mlir::ArrayAttr attr)
Definition Ops.cpp.inc:1138
::mlir::StringAttr getResAttrsAttrName()
Definition Ops.h.inc:462
::std::optional< ::mlir::ArrayAttr > getResAttrs()
Definition Ops.cpp.inc:1113
::std::optional< ::mlir::ArrayAttr > getArgAttrs()
Definition Ops.cpp.inc:1104
::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state)
Definition Ops.cpp.inc:1056
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
Definition Ops.cpp.inc:937
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
Definition Ops.cpp.inc:1019
void writeProperties(::mlir::DialectBytecodeWriter &writer)
Definition Ops.cpp.inc:1072
::llvm::StringRef getSymName()
Definition Ops.cpp.inc:1086
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index)
Definition Ops.cpp.inc:828
::mlir::LogicalResult verifyInvariantsImpl()
Definition Ops.cpp.inc:1216
std::pair< unsigned, unsigned > getODSResultIndexAndLength(unsigned index)
Definition Ops.cpp.inc:838
::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:852
::mlir::Attribute removeResAttrsAttr()
Definition Ops.cpp.inc:1148
void setFunctionType(::mlir::FunctionType attrValue)
Definition Ops.cpp.inc:1130
void setSymName(::llvm::StringRef attrValue)
Definition Ops.cpp.inc:1122
::mlir::Region & getBody()
Definition Ops.cpp.inc:848
::mlir::ArrayAttr getResAttrsAttr()
Definition Ops.cpp.inc:1109
::mlir::LogicalResult verify()
Definition Ops.cpp:212
void setFunctionTypeAttr(::mlir::TypeAttr attr)
Definition Ops.cpp.inc:1126
::mlir::StringAttr getArgAttrsAttrName()
Definition Ops.h.inc:446
::mlir::LogicalResult verify(::mlir::Location loc)
Definition Ops.cpp.inc:1294
ReturnOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs=nullptr, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
Definition Ops.h.inc:662
void print(::mlir::OpAsmPrinter &_odsPrinter)
Definition Ops.cpp.inc:1403
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index)
Definition Ops.cpp.inc:1298
::mlir::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:1371
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState)
Definition Ops.cpp.inc:1342
::mlir::MutableOperandRange getMutableSuccessorOperands(::mlir::RegionBranchPoint point)
Definition Ops.cpp.inc:1418
::mlir::Operation::operand_range getODSOperands(unsigned index)
Definition Ops.cpp.inc:1316
std::pair< unsigned, unsigned > getODSResultIndexAndLength(unsigned index)
Definition Ops.cpp.inc:1332
void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect > > &effects)
Definition Ops.cpp.inc:1415
::mlir::LogicalResult verify()
Definition Ops.cpp:318
::mlir::LogicalResult verifyInvariantsImpl()
Definition Ops.cpp.inc:1358
::mlir::Operation::result_range getODSResults(unsigned index)
Definition Ops.cpp.inc:1336
::mlir::Operation::operand_range getOperands()
Definition Ops.cpp.inc:1322
::mlir::MutableOperandRange getOperandsMutable()
Definition Ops.cpp.inc:1326
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
Definition Ops.cpp.inc:1377
::llvm::ArrayRef< int32_t > getMapOpGroupSizes()
Definition Ops.cpp.inc:183
::mlir::DenseI32ArrayAttr getNumDimsPerMapAttr()
Definition Ops.cpp.inc:168
::std::optional<::mlir::OperationName > odsOpName
Definition Ops.h.inc:102
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize)
Definition Ops.cpp.inc:145
::mlir::DenseI32ArrayAttr getMapOpGroupSizesAttr()
Definition Ops.cpp.inc:178
::llvm::ArrayRef< int32_t > getNumDimsPerMap()
Definition Ops.cpp.inc:173
CallOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties={}, ::mlir::RegionRange regions={})
Definition Ops.cpp.inc:139
::std::optional< ::mlir::ArrayAttr > getResAttrs()
Definition Ops.cpp.inc:790
::std::optional< ::mlir::ArrayAttr > getArgAttrs()
Definition Ops.cpp.inc:780
FuncDefOpGenericAdaptorBase(::mlir::DictionaryAttr attrs=nullptr, const Properties &properties={}, ::mlir::RegionRange regions={})
Definition Ops.cpp.inc:741
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize)
Definition Ops.cpp.inc:747
::std::optional<::mlir::OperationName > odsOpName
Definition Ops.h.inc:370
::std::optional<::mlir::OperationName > odsOpName
Definition Ops.h.inc:646
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize)
Definition Ops.cpp.inc:1269
ReturnOpGenericAdaptorBase(::mlir::DictionaryAttr attrs=nullptr, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
Definition Ops.cpp.inc:1263
mlir::ParseResult parseAttrDictWithWarnings(mlir::OpAsmParser &parser, mlir::NamedAttrList &extraAttrs, mlir::OperationState &state)
Definition OpHelpers.h:109
bool isValidType(Type type)
void printMultiDimAndSymbolList(mlir::OpAsmPrinter &printer, mlir::Operation *op, mlir::OperandRangeRange multiMapOperands, mlir::DenseI32ArrayAttr numDimsPerMap)
Definition OpHelpers.h:102
void printAttrDictWithWarnings(mlir::OpAsmPrinter &printer, ConcreteOp op, mlir::DictionaryAttr extraAttrs, typename mlir::PropertiesSelector< ConcreteOp >::type state)
Definition OpHelpers.h:116
mlir::ParseResult parseMultiDimAndSymbolList(mlir::OpAsmParser &parser, mlir::SmallVector< mlir::SmallVector< mlir::OpAsmParser::UnresolvedOperand > > &multiMapOperands, mlir::DenseI32ArrayAttr &numDimsPerMap)
Definition OpHelpers.h:94