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
15#endif // GET_OP_LIST
16
17#ifdef GET_OP_CLASSES
18#undef GET_OP_CLASSES
19
20
21//===----------------------------------------------------------------------===//
22// Local Utility Method Definitions
23//===----------------------------------------------------------------------===//
24
25namespace llzk {
26namespace constrain {
27
28static ::mlir::LogicalResult __mlir_ods_local_type_constraint_Ops0(
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;
34 }
35 return ::mlir::success();
36}
37
38static ::mlir::LogicalResult __mlir_ods_local_type_constraint_Ops1(
39 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
40 unsigned valueIndex) {
41 if (!((::llzk::isValidArrayElemType(type)))) {
42 return op->emitOpError(valueKind) << " #" << valueIndex
43 << " must be a valid array element type, but got " << type;
44 }
45 return ::mlir::success();
46}
47
48static ::mlir::LogicalResult __mlir_ods_local_type_constraint_Ops2(
49 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
50 unsigned valueIndex) {
51 if (!((::llzk::isValidEmitEqType(type)))) {
52 return op->emitOpError(valueKind) << " #" << valueIndex
53 << " must be any LLZK type, excluding non-Signal struct and string types, but got " << type;
54 }
55 return ::mlir::success();
56}
57} // namespace constrain
58} // namespace llzk
59namespace llzk {
60namespace constrain {
61
62//===----------------------------------------------------------------------===//
63// ::llzk::constrain::EmitContainmentOp definitions
64//===----------------------------------------------------------------------===//
65
66namespace detail {
67EmitContainmentOpGenericAdaptorBase::EmitContainmentOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs)
68 odsOpName.emplace("constrain.in", odsAttrs.getContext());
69}
70
72
73std::pair<unsigned, unsigned> EmitContainmentOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
74 return {index, 1};
75}
76
78 return odsAttrs;
79}
80
81} // namespace detail
83
84::mlir::LogicalResult EmitContainmentOpAdaptor::verify(::mlir::Location loc) {
85 return ::mlir::success();
86}
87
88std::pair<unsigned, unsigned> EmitContainmentOp::getODSOperandIndexAndLength(unsigned index) {
89 return {index, 1};
90}
91
92::mlir::Operation::operand_range EmitContainmentOp::getODSOperands(unsigned index) {
93 auto valueRange = getODSOperandIndexAndLength(index);
94 return {std::next(getOperation()->operand_begin(), valueRange.first),
95 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
96}
97
98::mlir::TypedValue<::llzk::array::ArrayType> EmitContainmentOp::getLhs() {
99 return ::llvm::cast<::mlir::TypedValue<::llzk::array::ArrayType>>(*getODSOperands(0).begin());
100}
101
103 return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin());
104}
105
107 auto range = getODSOperandIndexAndLength(0);
108 return getOperation()->getOpOperand(range.first);
109}
110
112 auto range = getODSOperandIndexAndLength(1);
113 return getOperation()->getOpOperand(range.first);
114}
115
116std::pair<unsigned, unsigned> EmitContainmentOp::getODSResultIndexAndLength(unsigned index) {
117 return {index, 1};
118}
119
120::mlir::Operation::result_range EmitContainmentOp::getODSResults(unsigned index) {
121 auto valueRange = getODSResultIndexAndLength(index);
122 return {std::next(getOperation()->result_begin(), valueRange.first),
123 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
124}
125
126void EmitContainmentOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) {
127 odsState.addOperands(lhs);
128 odsState.addOperands(rhs);
129}
130
131void EmitContainmentOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
132 odsState.addOperands(lhs);
133 odsState.addOperands(rhs);
134 assert(resultTypes.size() == 0u && "mismatched number of results");
135 odsState.addTypes(resultTypes);
136}
137
138void EmitContainmentOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
139 assert(operands.size() == 2u && "mismatched number of parameters");
140 odsState.addOperands(operands);
141 odsState.addAttributes(attributes);
142 assert(resultTypes.size() == 0u && "mismatched number of return types");
143 odsState.addTypes(resultTypes);
144}
145
147 {
148 unsigned index = 0; (void)index;
149 auto valueGroup0 = getODSOperands(0);
150
151 for (auto v : valueGroup0) {
152 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops0(*this, v.getType(), "operand", index++)))
153 return ::mlir::failure();
154 }
155 auto valueGroup1 = getODSOperands(1);
156
157 for (auto v : valueGroup1) {
158 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops1(*this, v.getType(), "operand", index++)))
159 return ::mlir::failure();
160 }
161 }
162 if (!((::llzk::typesUnify(::llvm::cast<::llzk::array::ArrayType>((*this->getODSOperands(0).begin()).getType()).getElementType(), (*this->getODSOperands(1).begin()).getType()))))
163 return emitOpError("failed to verify that rhs type matches with lhs element type");
164 return ::mlir::success();
165}
166
167::mlir::LogicalResult EmitContainmentOp::verifyInvariants() {
168 return verifyInvariantsImpl();
169}
170
171::mlir::ParseResult EmitContainmentOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
172 ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1];
173 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc;
174 (void)lhsOperandsLoc;
175 ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1];
176 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc;
177 (void)rhsOperandsLoc;
178 ::mlir::Type lhsRawTypes[1];
179 ::llvm::ArrayRef<::mlir::Type> lhsTypes(lhsRawTypes);
180 ::mlir::Type rhsRawTypes[1];
181 ::llvm::ArrayRef<::mlir::Type> rhsTypes(rhsRawTypes);
182
183 lhsOperandsLoc = parser.getCurrentLocation();
184 if (parser.parseOperand(lhsRawOperands[0]))
185 return ::mlir::failure();
186 if (parser.parseComma())
187 return ::mlir::failure();
188
189 rhsOperandsLoc = parser.getCurrentLocation();
190 if (parser.parseOperand(rhsRawOperands[0]))
191 return ::mlir::failure();
192 if (parser.parseColon())
193 return ::mlir::failure();
194
195 {
197 if (parser.parseCustomTypeWithFallback(type))
198 return ::mlir::failure();
199 lhsRawTypes[0] = type;
200 }
201 {
202 auto odsResult = parseInferredOrParsedType(parser, rhsRawTypes[0], lhsRawTypes[0]);
203 if (odsResult) return ::mlir::failure();
204 }
205 {
206 auto loc = parser.getCurrentLocation();(void)loc;
207 if (parser.parseOptionalAttrDict(result.attributes))
208 return ::mlir::failure();
209 }
210 if (parser.resolveOperands(lhsOperands, lhsTypes, lhsOperandsLoc, result.operands))
211 return ::mlir::failure();
212 if (parser.resolveOperands(rhsOperands, rhsTypes, rhsOperandsLoc, result.operands))
213 return ::mlir::failure();
214 return ::mlir::success();
215}
216
217void EmitContainmentOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
218 _odsPrinter << ' ';
219 _odsPrinter << getLhs();
220 _odsPrinter << ",";
221 _odsPrinter << ' ';
222 _odsPrinter << getRhs();
223 _odsPrinter << ' ' << ":";
224 _odsPrinter << ' ';
225 {
226 auto type = getLhs().getType();
227 if (auto validType = ::llvm::dyn_cast<::llzk::array::ArrayType>(type))
228 _odsPrinter.printStrippedAttrOrType(validType);
229 else
230 _odsPrinter << type;
231 }
232 printInferredOrParsedType(_odsPrinter, *this, getRhs().getType(), getLhs().getType());
233 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
234 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
235}
236
237} // namespace constrain
238} // namespace llzk
239MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::constrain::EmitContainmentOp)
240
241namespace llzk {
242namespace constrain {
243
244//===----------------------------------------------------------------------===//
245// ::llzk::constrain::EmitEqualityOp definitions
246//===----------------------------------------------------------------------===//
247
248namespace detail {
249EmitEqualityOpGenericAdaptorBase::EmitEqualityOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs)
250 odsOpName.emplace("constrain.eq", odsAttrs.getContext());
251}
252
254
255std::pair<unsigned, unsigned> EmitEqualityOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
256 return {index, 1};
257}
258
260 return odsAttrs;
261}
262
263} // namespace detail
265
266::mlir::LogicalResult EmitEqualityOpAdaptor::verify(::mlir::Location loc) {
267 return ::mlir::success();
268}
269
270std::pair<unsigned, unsigned> EmitEqualityOp::getODSOperandIndexAndLength(unsigned index) {
271 return {index, 1};
272}
273
274::mlir::Operation::operand_range EmitEqualityOp::getODSOperands(unsigned index) {
275 auto valueRange = getODSOperandIndexAndLength(index);
276 return {std::next(getOperation()->operand_begin(), valueRange.first),
277 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
278}
279
280::mlir::Value EmitEqualityOp::getLhs() {
281 return ::llvm::cast<::mlir::Value>(*getODSOperands(0).begin());
282}
283
284::mlir::Value EmitEqualityOp::getRhs() {
285 return ::llvm::cast<::mlir::Value>(*getODSOperands(1).begin());
286}
287
288::mlir::OpOperand &EmitEqualityOp::getLhsMutable() {
289 auto range = getODSOperandIndexAndLength(0);
290 return getOperation()->getOpOperand(range.first);
291}
292
293::mlir::OpOperand &EmitEqualityOp::getRhsMutable() {
294 auto range = getODSOperandIndexAndLength(1);
295 return getOperation()->getOpOperand(range.first);
296}
297
298std::pair<unsigned, unsigned> EmitEqualityOp::getODSResultIndexAndLength(unsigned index) {
299 return {index, 1};
300}
301
302::mlir::Operation::result_range EmitEqualityOp::getODSResults(unsigned index) {
303 auto valueRange = getODSResultIndexAndLength(index);
304 return {std::next(getOperation()->result_begin(), valueRange.first),
305 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
306}
307
308void EmitEqualityOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs) {
309 odsState.addOperands(lhs);
310 odsState.addOperands(rhs);
311}
312
313void EmitEqualityOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs) {
314 odsState.addOperands(lhs);
315 odsState.addOperands(rhs);
316 assert(resultTypes.size() == 0u && "mismatched number of results");
317 odsState.addTypes(resultTypes);
318}
319
320void EmitEqualityOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
321 assert(operands.size() == 2u && "mismatched number of parameters");
322 odsState.addOperands(operands);
323 odsState.addAttributes(attributes);
324 assert(resultTypes.size() == 0u && "mismatched number of return types");
325 odsState.addTypes(resultTypes);
326}
327
329 {
330 unsigned index = 0; (void)index;
331 auto valueGroup0 = getODSOperands(0);
332
333 for (auto v : valueGroup0) {
334 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops2(*this, v.getType(), "operand", index++)))
335 return ::mlir::failure();
336 }
337 auto valueGroup1 = getODSOperands(1);
338
339 for (auto v : valueGroup1) {
340 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops2(*this, v.getType(), "operand", index++)))
341 return ::mlir::failure();
342 }
343 }
344 if (!((::llzk::typesUnify((*this->getODSOperands(0).begin()).getType(), (*this->getODSOperands(1).begin()).getType()))))
345 return emitOpError("failed to verify that rhs type matches with lhs type");
346 return ::mlir::success();
347}
348
349::mlir::LogicalResult EmitEqualityOp::verifyInvariants() {
350 return verifyInvariantsImpl();
351}
352
353::mlir::ParseResult EmitEqualityOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
354 ::mlir::OpAsmParser::UnresolvedOperand lhsRawOperands[1];
355 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> lhsOperands(lhsRawOperands); ::llvm::SMLoc lhsOperandsLoc;
356 (void)lhsOperandsLoc;
357 ::mlir::OpAsmParser::UnresolvedOperand rhsRawOperands[1];
358 ::llvm::ArrayRef<::mlir::OpAsmParser::UnresolvedOperand> rhsOperands(rhsRawOperands); ::llvm::SMLoc rhsOperandsLoc;
359 (void)rhsOperandsLoc;
360 ::mlir::Type lhsRawTypes[1];
361 ::llvm::ArrayRef<::mlir::Type> lhsTypes(lhsRawTypes);
362 ::mlir::Type rhsRawTypes[1];
363 ::llvm::ArrayRef<::mlir::Type> rhsTypes(rhsRawTypes);
364
365 lhsOperandsLoc = parser.getCurrentLocation();
366 if (parser.parseOperand(lhsRawOperands[0]))
367 return ::mlir::failure();
368 if (parser.parseComma())
369 return ::mlir::failure();
370
371 rhsOperandsLoc = parser.getCurrentLocation();
372 if (parser.parseOperand(rhsRawOperands[0]))
373 return ::mlir::failure();
374 if (parser.parseColon())
375 return ::mlir::failure();
376
377 {
378 ::mlir::Type type;
379 if (parser.parseCustomTypeWithFallback(type))
380 return ::mlir::failure();
381 lhsRawTypes[0] = type;
382 }
383 {
384 auto odsResult = parseInferredOrParsedType(parser, rhsRawTypes[0], lhsRawTypes[0]);
385 if (odsResult) return ::mlir::failure();
386 }
387 {
388 auto loc = parser.getCurrentLocation();(void)loc;
389 if (parser.parseOptionalAttrDict(result.attributes))
390 return ::mlir::failure();
391 }
392 if (parser.resolveOperands(lhsOperands, lhsTypes, lhsOperandsLoc, result.operands))
393 return ::mlir::failure();
394 if (parser.resolveOperands(rhsOperands, rhsTypes, rhsOperandsLoc, result.operands))
395 return ::mlir::failure();
396 return ::mlir::success();
397}
398
399void EmitEqualityOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
400 _odsPrinter << ' ';
401 _odsPrinter << getLhs();
402 _odsPrinter << ",";
403 _odsPrinter << ' ';
404 _odsPrinter << getRhs();
405 _odsPrinter << ' ' << ":";
406 _odsPrinter << ' ';
407 {
408 auto type = getLhs().getType();
409 if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
410 _odsPrinter.printStrippedAttrOrType(validType);
411 else
412 _odsPrinter << type;
413 }
414 printInferredOrParsedType(_odsPrinter, *this, getRhs().getType(), getLhs().getType());
415 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
416 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
417}
418
419} // namespace constrain
420} // namespace llzk
421MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::constrain::EmitEqualityOp)
422
423
424#endif // GET_OP_CLASSES
425
EmitContainmentOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs=nullptr, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
Definition Ops.h.inc:60
EmitContainmentOpAdaptor(EmitContainmentOp op)
Definition Ops.cpp.inc:82
::mlir::LogicalResult verify(::mlir::Location loc)
Definition Ops.cpp.inc:84
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs)
Definition Ops.cpp.inc:126
::mlir::OpOperand & getRhsMutable()
Definition Ops.cpp.inc:111
std::pair< unsigned, unsigned > getODSResultIndexAndLength(unsigned index)
Definition Ops.cpp.inc:116
static void printInferredOrParsedType(::mlir::OpAsmPrinter &printer, ::mlir::Operation *op, ::mlir::Type rhsType, ::mlir::Type lhsType)
Definition Ops.h.inc:151
::mlir::Operation::operand_range getODSOperands(unsigned index)
Definition Ops.cpp.inc:92
::mlir::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:167
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index)
Definition Ops.cpp.inc:88
::mlir::LogicalResult verifyInvariantsImpl()
Definition Ops.cpp.inc:146
void print(::mlir::OpAsmPrinter &_odsPrinter)
Definition Ops.cpp.inc:217
::mlir::Operation::result_range getODSResults(unsigned index)
Definition Ops.cpp.inc:120
::mlir::ParseResult parseInferredOrParsedType(::mlir::OpAsmParser &parser, ::mlir::Type &rhsType, ::mlir::Type lhsType)
Definition Ops.h.inc:134
::mlir::OpOperand & getLhsMutable()
Definition Ops.cpp.inc:106
::mlir::TypedValue<::llzk::array::ArrayType > getLhs()
Definition Ops.cpp.inc:98
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
Definition Ops.cpp.inc:171
::mlir::LogicalResult verify(::mlir::Location loc)
Definition Ops.cpp.inc:266
EmitEqualityOpAdaptor(EmitEqualityOp op)
Definition Ops.cpp.inc:264
EmitEqualityOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs=nullptr, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
Definition Ops.h.inc:190
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index)
Definition Ops.cpp.inc:270
::mlir::LogicalResult verifyInvariantsImpl()
Definition Ops.cpp.inc:328
::mlir::OpOperand & getRhsMutable()
Definition Ops.cpp.inc:293
static void printInferredOrParsedType(::mlir::OpAsmPrinter &printer, ::mlir::Operation *op, ::mlir::Type rhsType, ::mlir::Type lhsType)
Definition Ops.h.inc:281
::mlir::Operation::operand_range getODSOperands(unsigned index)
Definition Ops.cpp.inc:274
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
Definition Ops.cpp.inc:353
::mlir::Operation::result_range getODSResults(unsigned index)
Definition Ops.cpp.inc:302
void print(::mlir::OpAsmPrinter &_odsPrinter)
Definition Ops.cpp.inc:399
::mlir::OpOperand & getLhsMutable()
Definition Ops.cpp.inc:288
::mlir::ParseResult parseInferredOrParsedType(::mlir::OpAsmParser &parser, ::mlir::Type &rhsType, ::mlir::Type lhsType)
Definition Ops.h.inc:264
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs)
Definition Ops.cpp.inc:308
std::pair< unsigned, unsigned > getODSResultIndexAndLength(unsigned index)
Definition Ops.cpp.inc:298
::mlir::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:349
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize)
Definition Ops.cpp.inc:73
::std::optional<::mlir::OperationName > odsOpName
Definition Ops.h.inc:44
EmitContainmentOpGenericAdaptorBase(::mlir::DictionaryAttr attrs=nullptr, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
Definition Ops.cpp.inc:67
::std::optional<::mlir::OperationName > odsOpName
Definition Ops.h.inc:174
EmitEqualityOpGenericAdaptorBase(::mlir::DictionaryAttr attrs=nullptr, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
Definition Ops.cpp.inc:249
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize)
Definition Ops.cpp.inc:255
bool isValidArrayElemType(Type type)
bool isValidEmitEqType(Type type)
bool typesUnify(Type lhs, Type rhs, ArrayRef< StringRef > rhsReversePrefix, UnificationMap *unifications)