26static ::llvm::LogicalResult __mlir_ods_local_type_constraint_Ops1(
27 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
28 unsigned valueIndex) {
29 if (!((::llvm::isa<::llzk::array::ArrayType>(type)))) {
30 return op->emitOpError(valueKind) <<
" #" << valueIndex
31 <<
" must be n-dimensional array, but got " << type;
33 return ::mlir::success();
36static ::llvm::LogicalResult __mlir_ods_local_type_constraint_Ops2(
37 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
38 unsigned valueIndex) {
40 return op->emitOpError(valueKind) <<
" #" << valueIndex
41 <<
" must be a valid LLZK type, but got " << type;
43 return ::mlir::success();
46static ::llvm::LogicalResult __mlir_ods_local_type_constraint_Ops3(
47 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
48 unsigned valueIndex) {
50 return op->emitOpError(valueKind) <<
" #" << valueIndex
51 <<
" must be any LLZK type, excluding struct and string types, but got " << type;
53 return ::mlir::success();
71 return ::mlir::success();
75 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
77 emitError() <<
"expected DictionaryAttr to set properties";
78 return ::mlir::failure();
80 return ::mlir::success();
84 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
85 ::mlir::Builder odsBuilder{ctx};
88 return odsBuilder.getDictionaryAttr(attrs);
93 using llvm::hash_value;
94 return llvm::hash_combine();
108 return ::mlir::success();
111void EmitContainmentOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) {
112 odsState.addOperands(lhs);
113 odsState.addOperands(rhs);
118 build(builder, __state__, std::forward<
decltype(lhs)>(lhs), std::forward<
decltype(rhs)>(rhs));
119 auto __res__ = ::llvm::dyn_cast<EmitContainmentOp>(builder.create(__state__));
120 assert(__res__ &&
"builder didn't return the right type");
125 return create(builder, builder.getLoc(), std::forward<
decltype(lhs)>(lhs), std::forward<
decltype(rhs)>(rhs));
128void EmitContainmentOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
129 odsState.addOperands(lhs);
130 odsState.addOperands(rhs);
131 assert(resultTypes.size() == 0u &&
"mismatched number of results");
132 odsState.addTypes(resultTypes);
137 build(builder, __state__, std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(lhs)>(lhs), std::forward<
decltype(rhs)>(rhs));
138 auto __res__ = ::llvm::dyn_cast<EmitContainmentOp>(builder.create(__state__));
139 assert(__res__ &&
"builder didn't return the right type");
144 return create(builder, builder.getLoc(), std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(lhs)>(lhs), std::forward<
decltype(rhs)>(rhs));
147void EmitContainmentOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
148 assert(operands.size() == 2u &&
"mismatched number of parameters");
149 odsState.addOperands(operands);
150 odsState.addAttributes(attributes);
151 assert(resultTypes.size() == 0u &&
"mismatched number of return types");
152 odsState.addTypes(resultTypes);
157 build(builder, __state__, std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(operands)>(operands), std::forward<
decltype(attributes)>(attributes));
158 auto __res__ = ::llvm::dyn_cast<EmitContainmentOp>(builder.create(__state__));
159 assert(__res__ &&
"builder didn't return the right type");
164 return create(builder, builder.getLoc(), std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(operands)>(operands), std::forward<
decltype(attributes)>(attributes));
167void EmitContainmentOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands,
const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
168 assert(operands.size() == 2u &&
"mismatched number of parameters");
169 odsState.addOperands(operands);
170 odsState.useProperties(
const_cast<Properties&
>(properties));
171 odsState.addAttributes(discardableAttributes);
172 assert(resultTypes.size() == 0u &&
"mismatched number of return types");
173 odsState.addTypes(resultTypes);
178 build(builder, __state__, std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(operands)>(operands), std::forward<
decltype(properties)>(properties), std::forward<
decltype(discardableAttributes)>(discardableAttributes));
179 auto __res__ = ::llvm::dyn_cast<EmitContainmentOp>(builder.create(__state__));
180 assert(__res__ &&
"builder didn't return the right type");
185 return create(builder, builder.getLoc(), std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(operands)>(operands), std::forward<
decltype(properties)>(properties), std::forward<
decltype(discardableAttributes)>(discardableAttributes));
190 unsigned index = 0; (void)index;
193 for (
auto v : valueGroup0) {
194 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*
this, v.getType(),
"operand", index++)))
195 return ::mlir::failure();
199 for (
auto v : valueGroup1) {
200 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops2(*
this, v.getType(),
"operand", index++)))
201 return ::mlir::failure();
204 return ::mlir::success();
209 return ::mlir::success();
210 return ::mlir::failure();
214 ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperand{};
215 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(&lhsRawOperand, 1); ::llvm::SMLoc lhsOperandsLoc;
216 (void)lhsOperandsLoc;
217 ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperand{};
218 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(&rhsRawOperand, 1); ::llvm::SMLoc rhsOperandsLoc;
219 (void)rhsOperandsLoc;
220 ::mlir::Type lhsRawType{};
221 ::llvm::ArrayRef<::mlir::Type> lhsTypes(&lhsRawType, 1);
222 ::mlir::Type rhsRawType{};
223 ::llvm::ArrayRef<::mlir::Type> rhsTypes(&rhsRawType, 1);
225 lhsOperandsLoc = parser.getCurrentLocation();
226 if (parser.parseOperand(lhsRawOperand))
227 return ::mlir::failure();
228 if (parser.parseComma())
229 return ::mlir::failure();
231 rhsOperandsLoc = parser.getCurrentLocation();
232 if (parser.parseOperand(rhsRawOperand))
233 return ::mlir::failure();
234 if (parser.parseColon())
235 return ::mlir::failure();
239 if (parser.parseCustomTypeWithFallback(type))
240 return ::mlir::failure();
243 if (parser.parseComma())
244 return ::mlir::failure();
248 if (parser.parseCustomTypeWithFallback(type))
249 return ::mlir::failure();
253 auto loc = parser.getCurrentLocation();(void)loc;
254 if (parser.parseOptionalAttrDict(result.attributes))
255 return ::mlir::failure();
257 return parser.emitError(loc) <<
"'" << result.name.getStringRef() <<
"' op ";
259 return ::mlir::failure();
261 if (parser.resolveOperands(lhsOperands, lhsTypes, lhsOperandsLoc, result.operands))
262 return ::mlir::failure();
263 if (parser.resolveOperands(rhsOperands, rhsTypes, rhsOperandsLoc, result.operands))
264 return ::mlir::failure();
265 return ::mlir::success();
274 _odsPrinter <<
' ' <<
":";
277 auto type =
getLhs().getType();
278 if (
auto validType = ::llvm::dyn_cast<::llzk::array::ArrayType>(type))
279 _odsPrinter.printStrippedAttrOrType(validType);
286 auto type =
getRhs().getType();
287 if (
auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
288 _odsPrinter.printStrippedAttrOrType(validType);
292 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
293 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
316 return ::mlir::success();
320 ::mlir::DictionaryAttr dict = ::llvm::dyn_cast<::mlir::DictionaryAttr>(attr);
322 emitError() <<
"expected DictionaryAttr to set properties";
323 return ::mlir::failure();
325 return ::mlir::success();
329 ::mlir::SmallVector<::mlir::NamedAttribute> attrs;
330 ::mlir::Builder odsBuilder{ctx};
333 return odsBuilder.getDictionaryAttr(attrs);
338 using llvm::hash_value;
339 return llvm::hash_combine();
353 return ::mlir::success();
356void EmitEqualityOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) {
357 odsState.addOperands(lhs);
358 odsState.addOperands(rhs);
363 build(builder, __state__, std::forward<
decltype(lhs)>(lhs), std::forward<
decltype(rhs)>(rhs));
364 auto __res__ = ::llvm::dyn_cast<EmitEqualityOp>(builder.create(__state__));
365 assert(__res__ &&
"builder didn't return the right type");
370 return create(builder, builder.getLoc(), std::forward<
decltype(lhs)>(lhs), std::forward<
decltype(rhs)>(rhs));
373void EmitEqualityOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
374 odsState.addOperands(lhs);
375 odsState.addOperands(rhs);
376 assert(resultTypes.size() == 0u &&
"mismatched number of results");
377 odsState.addTypes(resultTypes);
382 build(builder, __state__, std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(lhs)>(lhs), std::forward<
decltype(rhs)>(rhs));
383 auto __res__ = ::llvm::dyn_cast<EmitEqualityOp>(builder.create(__state__));
384 assert(__res__ &&
"builder didn't return the right type");
389 return create(builder, builder.getLoc(), std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(lhs)>(lhs), std::forward<
decltype(rhs)>(rhs));
392void EmitEqualityOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
393 assert(operands.size() == 2u &&
"mismatched number of parameters");
394 odsState.addOperands(operands);
395 odsState.addAttributes(attributes);
396 assert(resultTypes.size() == 0u &&
"mismatched number of return types");
397 odsState.addTypes(resultTypes);
400EmitEqualityOp EmitEqualityOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
402 build(builder, __state__, std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(operands)>(operands), std::forward<
decltype(attributes)>(attributes));
403 auto __res__ = ::llvm::dyn_cast<EmitEqualityOp>(builder.create(__state__));
404 assert(__res__ &&
"builder didn't return the right type");
409 return create(builder, builder.getLoc(), std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(operands)>(operands), std::forward<
decltype(attributes)>(attributes));
412void EmitEqualityOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands,
const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
413 assert(operands.size() == 2u &&
"mismatched number of parameters");
414 odsState.addOperands(operands);
415 odsState.useProperties(
const_cast<Properties&
>(properties));
416 odsState.addAttributes(discardableAttributes);
417 assert(resultTypes.size() == 0u &&
"mismatched number of return types");
418 odsState.addTypes(resultTypes);
421EmitEqualityOp EmitEqualityOp::create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands,
const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes) {
423 build(builder, __state__, std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(operands)>(operands), std::forward<
decltype(properties)>(properties), std::forward<
decltype(discardableAttributes)>(discardableAttributes));
424 auto __res__ = ::llvm::dyn_cast<EmitEqualityOp>(builder.create(__state__));
425 assert(__res__ &&
"builder didn't return the right type");
430 return create(builder, builder.getLoc(), std::forward<
decltype(resultTypes)>(resultTypes), std::forward<
decltype(operands)>(operands), std::forward<
decltype(properties)>(properties), std::forward<
decltype(discardableAttributes)>(discardableAttributes));
435 unsigned index = 0; (void)index;
438 for (
auto v : valueGroup0) {
439 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops3(*
this, v.getType(),
"operand", index++)))
440 return ::mlir::failure();
444 for (
auto v : valueGroup1) {
445 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops3(*
this, v.getType(),
"operand", index++)))
446 return ::mlir::failure();
450 return emitOpError(
"failed to verify that rhs type matches with lhs type");
451 return ::mlir::success();
459 ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperand{};
460 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(&lhsRawOperand, 1); ::llvm::SMLoc lhsOperandsLoc;
461 (void)lhsOperandsLoc;
462 ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperand{};
463 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(&rhsRawOperand, 1); ::llvm::SMLoc rhsOperandsLoc;
464 (void)rhsOperandsLoc;
465 ::mlir::Type lhsRawType{};
466 ::llvm::ArrayRef<::mlir::Type> lhsTypes(&lhsRawType, 1);
467 ::mlir::Type rhsRawType{};
468 ::llvm::ArrayRef<::mlir::Type> rhsTypes(&rhsRawType, 1);
470 lhsOperandsLoc = parser.getCurrentLocation();
471 if (parser.parseOperand(lhsRawOperand))
472 return ::mlir::failure();
473 if (parser.parseComma())
474 return ::mlir::failure();
476 rhsOperandsLoc = parser.getCurrentLocation();
477 if (parser.parseOperand(rhsRawOperand))
478 return ::mlir::failure();
479 if (parser.parseColon())
480 return ::mlir::failure();
484 if (parser.parseCustomTypeWithFallback(type))
485 return ::mlir::failure();
489 auto odsResult = parseInferredOrParsedType(parser, rhsRawType, lhsRawType);
490 if (odsResult) return ::mlir::failure();
493 auto loc = parser.getCurrentLocation();(void)loc;
494 if (parser.parseOptionalAttrDict(result.attributes))
495 return ::mlir::failure();
497 return parser.emitError(loc) <<
"'" << result.name.getStringRef() <<
"' op ";
499 return ::mlir::failure();
501 if (parser.resolveOperands(lhsOperands, lhsTypes, lhsOperandsLoc, result.operands))
502 return ::mlir::failure();
503 if (parser.resolveOperands(rhsOperands, rhsTypes, rhsOperandsLoc, result.operands))
504 return ::mlir::failure();
505 return ::mlir::success();
514 _odsPrinter <<
' ' <<
":";
517 auto type =
getLhs().getType();
518 if (
auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
519 _odsPrinter.printStrippedAttrOrType(validType);
523 printInferredOrParsedType(_odsPrinter, *
this,
getRhs().getType(),
getLhs().getType());
524 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
525 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
EmitContainmentOpAdaptor(EmitContainmentOp op)
EmitContainmentOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
::llvm::LogicalResult verify(::mlir::Location loc)
::mlir::ValueRange getOperands()
static EmitContainmentOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs)
::llvm::LogicalResult verifyInvariantsImpl()
::llvm::LogicalResult verifyInvariants()
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs)
::llvm::LogicalResult verify()
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
static constexpr ::llvm::StringLiteral getOperationName()
::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
::mlir::TypedValue<::mlir::Type > getRhs()
FoldAdaptor::Properties Properties
::mlir::Operation::operand_range getODSOperands(unsigned index)
static llvm::hash_code computePropertiesHash(const Properties &prop)
void print(::mlir::OpAsmPrinter &_odsPrinter)
::mlir::TypedValue<::llzk::array::ArrayType > getLhs()
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
EmitEqualityOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
::llvm::LogicalResult verify(::mlir::Location loc)
EmitEqualityOpAdaptor(EmitEqualityOp op)
::mlir::ValueRange getOperands()
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
static constexpr ::llvm::StringLiteral getOperationName()
FoldAdaptor::Properties Properties
::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
static llvm::hash_code computePropertiesHash(const Properties &prop)
::mlir::TypedValue<::mlir::Type > getLhs()
::mlir::Operation::operand_range getODSOperands(unsigned index)
void print(::mlir::OpAsmPrinter &_odsPrinter)
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
::llvm::LogicalResult verifyInvariants()
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs)
::llvm::LogicalResult verifyInvariantsImpl()
static EmitEqualityOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value lhs, ::mlir::Value rhs)
::mlir::TypedValue<::mlir::Type > getRhs()
::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
::mlir::RegionRange odsRegions
const Properties & getProperties()
::std::optional<::mlir::OperationName > odsOpName
EmitContainmentOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
::mlir::DictionaryAttr odsAttrs
::std::optional<::mlir::OperationName > odsOpName
::mlir::DictionaryAttr odsAttrs
EmitEqualityOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
::mlir::RegionRange odsRegions
const Properties & getProperties()
Common interface for operations that produce a constraint.
Common interface for constant parameter-like symbol operations that can be defined within a TemplateO...
bool isValidEmitEqType(Type type)
bool isValidType(Type type)
bool typesUnify(Type lhs, Type rhs, ArrayRef< StringRef > rhsReversePrefix, UnificationMap *unifications)