28static ::llvm::LogicalResult __mlir_ods_local_type_constraint_Ops1(
29 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
30 unsigned valueIndex) {
31 if (!((::llvm::isa<::llzk::array::ArrayType>(type)))) {
32 return op->emitOpError(valueKind) <<
" #" << valueIndex
33 <<
" must be n-dimensional array, but got " << type;
35 return ::mlir::success();
38static ::llvm::LogicalResult __mlir_ods_local_type_constraint_Ops2(
39 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
40 unsigned valueIndex) {
42 return op->emitOpError(valueKind) <<
" #" << valueIndex
43 <<
" must be a valid LLZK type, but got " << type;
45 return ::mlir::success();
48static ::llvm::LogicalResult __mlir_ods_local_type_constraint_Ops3(
49 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
50 unsigned valueIndex) {
52 return op->emitOpError(valueKind) <<
" #" << valueIndex
53 <<
" must be any LLZK type, excluding non-Signal struct and string types, but got " << type;
55 return ::mlir::success();
71 return ::mlir::success();
74void EmitContainmentOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) {
75 odsState.addOperands(lhs);
76 odsState.addOperands(rhs);
79void EmitContainmentOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
80 odsState.addOperands(lhs);
81 odsState.addOperands(rhs);
82 assert(resultTypes.size() == 0u &&
"mismatched number of results");
83 odsState.addTypes(resultTypes);
86void EmitContainmentOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
87 assert(operands.size() == 2u &&
"mismatched number of parameters");
88 odsState.addOperands(operands);
89 odsState.addAttributes(attributes);
90 assert(resultTypes.size() == 0u &&
"mismatched number of return types");
91 odsState.addTypes(resultTypes);
96 unsigned index = 0; (void)index;
99 for (
auto v : valueGroup0) {
100 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*
this, v.getType(),
"operand", index++)))
101 return ::mlir::failure();
105 for (
auto v : valueGroup1) {
106 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops2(*
this, v.getType(),
"operand", index++)))
107 return ::mlir::failure();
110 return ::mlir::success();
115 return ::mlir::success();
116 return ::mlir::failure();
120 ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperand{};
121 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(&lhsRawOperand, 1); ::llvm::SMLoc lhsOperandsLoc;
122 (void)lhsOperandsLoc;
123 ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperand{};
124 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(&rhsRawOperand, 1); ::llvm::SMLoc rhsOperandsLoc;
125 (void)rhsOperandsLoc;
126 ::mlir::Type lhsRawType{};
127 ::llvm::ArrayRef<::mlir::Type> lhsTypes(&lhsRawType, 1);
128 ::mlir::Type rhsRawType{};
129 ::llvm::ArrayRef<::mlir::Type> rhsTypes(&rhsRawType, 1);
131 lhsOperandsLoc = parser.getCurrentLocation();
132 if (parser.parseOperand(lhsRawOperand))
133 return ::mlir::failure();
134 if (parser.parseComma())
135 return ::mlir::failure();
137 rhsOperandsLoc = parser.getCurrentLocation();
138 if (parser.parseOperand(rhsRawOperand))
139 return ::mlir::failure();
140 if (parser.parseColon())
141 return ::mlir::failure();
145 if (parser.parseCustomTypeWithFallback(type))
146 return ::mlir::failure();
149 if (parser.parseComma())
150 return ::mlir::failure();
154 if (parser.parseCustomTypeWithFallback(type))
155 return ::mlir::failure();
159 auto loc = parser.getCurrentLocation();(void)loc;
160 if (parser.parseOptionalAttrDict(result.attributes))
161 return ::mlir::failure();
163 if (parser.resolveOperands(lhsOperands, lhsTypes, lhsOperandsLoc, result.operands))
164 return ::mlir::failure();
165 if (parser.resolveOperands(rhsOperands, rhsTypes, rhsOperandsLoc, result.operands))
166 return ::mlir::failure();
167 return ::mlir::success();
176 _odsPrinter <<
' ' <<
":";
179 auto type =
getLhs().getType();
180 if (
auto validType = ::llvm::dyn_cast<::llzk::array::ArrayType>(type))
181 _odsPrinter.printStrippedAttrOrType(validType);
188 auto type =
getRhs().getType();
189 if (
auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
190 _odsPrinter.printStrippedAttrOrType(validType);
194 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
195 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
214 return ::mlir::success();
217void EmitEqualityOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) {
218 odsState.addOperands(lhs);
219 odsState.addOperands(rhs);
222void EmitEqualityOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
223 odsState.addOperands(lhs);
224 odsState.addOperands(rhs);
225 assert(resultTypes.size() == 0u &&
"mismatched number of results");
226 odsState.addTypes(resultTypes);
229void EmitEqualityOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
230 assert(operands.size() == 2u &&
"mismatched number of parameters");
231 odsState.addOperands(operands);
232 odsState.addAttributes(attributes);
233 assert(resultTypes.size() == 0u &&
"mismatched number of return types");
234 odsState.addTypes(resultTypes);
239 unsigned index = 0; (void)index;
242 for (
auto v : valueGroup0) {
243 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops3(*
this, v.getType(),
"operand", index++)))
244 return ::mlir::failure();
248 for (
auto v : valueGroup1) {
249 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops3(*
this, v.getType(),
"operand", index++)))
250 return ::mlir::failure();
254 return emitOpError(
"failed to verify that rhs type matches with lhs type");
255 return ::mlir::success();
263 ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperand{};
264 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(&lhsRawOperand, 1); ::llvm::SMLoc lhsOperandsLoc;
265 (void)lhsOperandsLoc;
266 ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperand{};
267 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(&rhsRawOperand, 1); ::llvm::SMLoc rhsOperandsLoc;
268 (void)rhsOperandsLoc;
269 ::mlir::Type lhsRawType{};
270 ::llvm::ArrayRef<::mlir::Type> lhsTypes(&lhsRawType, 1);
271 ::mlir::Type rhsRawType{};
272 ::llvm::ArrayRef<::mlir::Type> rhsTypes(&rhsRawType, 1);
274 lhsOperandsLoc = parser.getCurrentLocation();
275 if (parser.parseOperand(lhsRawOperand))
276 return ::mlir::failure();
277 if (parser.parseComma())
278 return ::mlir::failure();
280 rhsOperandsLoc = parser.getCurrentLocation();
281 if (parser.parseOperand(rhsRawOperand))
282 return ::mlir::failure();
283 if (parser.parseColon())
284 return ::mlir::failure();
288 if (parser.parseCustomTypeWithFallback(type))
289 return ::mlir::failure();
294 if (odsResult) return ::mlir::failure();
297 auto loc = parser.getCurrentLocation();(void)loc;
298 if (parser.parseOptionalAttrDict(result.attributes))
299 return ::mlir::failure();
301 if (parser.resolveOperands(lhsOperands, lhsTypes, lhsOperandsLoc, result.operands))
302 return ::mlir::failure();
303 if (parser.resolveOperands(rhsOperands, rhsTypes, rhsOperandsLoc, result.operands))
304 return ::mlir::failure();
305 return ::mlir::success();
314 _odsPrinter <<
' ' <<
":";
317 auto type =
getLhs().getType();
318 if (
auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
319 _odsPrinter.printStrippedAttrOrType(validType);
324 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
325 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
EmitContainmentOpAdaptor(EmitContainmentOp op)
::llvm::LogicalResult verify(::mlir::Location loc)
EmitContainmentOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs={}, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
::mlir::ValueRange getOperands()
::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::TypedValue<::mlir::Type > getRhs()
::mlir::Operation::operand_range getODSOperands(unsigned index)
void print(::mlir::OpAsmPrinter &_odsPrinter)
::mlir::TypedValue<::llzk::array::ArrayType > getLhs()
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
::llvm::LogicalResult verify(::mlir::Location loc)
EmitEqualityOpAdaptor(EmitEqualityOp op)
EmitEqualityOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs={}, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
::mlir::ValueRange getOperands()
static void printInferredOrParsedType(::mlir::OpAsmPrinter &printer, ::mlir::Operation *op, ::mlir::Type rhsType, ::mlir::Type lhsType)
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
::mlir::TypedValue<::mlir::Type > getLhs()
::mlir::Operation::operand_range getODSOperands(unsigned index)
void print(::mlir::OpAsmPrinter &_odsPrinter)
::mlir::ParseResult parseInferredOrParsedType(::mlir::OpAsmParser &parser, ::mlir::Type &rhsType, ::mlir::Type lhsType)
::llvm::LogicalResult verifyInvariants()
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs)
::llvm::LogicalResult verifyInvariantsImpl()
::mlir::TypedValue<::mlir::Type > getRhs()
bool isValidEmitEqType(Type type)
bool isValidType(Type type)
bool typesUnify(Type lhs, Type rhs, ArrayRef< StringRef > rhsReversePrefix, UnificationMap *unifications)