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
14#endif // GET_OP_LIST
15
16#ifdef GET_OP_CLASSES
17#undef GET_OP_CLASSES
18
19
20//===----------------------------------------------------------------------===//
21// Local Utility Method Definitions
22//===----------------------------------------------------------------------===//
23
24namespace llzk {
25namespace undef {
26
27static ::mlir::LogicalResult __mlir_ods_local_type_constraint_Ops0(
28 ::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
29 unsigned valueIndex) {
30 if (!((::llzk::isValidType(type)))) {
31 return op->emitOpError(valueKind) << " #" << valueIndex
32 << " must be a valid LLZK type, but got " << type;
33 }
34 return ::mlir::success();
35}
36} // namespace undef
37} // namespace llzk
38namespace llzk {
39namespace undef {
40
41//===----------------------------------------------------------------------===//
42// ::llzk::undef::UndefOp definitions
43//===----------------------------------------------------------------------===//
44
45namespace detail {
46UndefOpGenericAdaptorBase::UndefOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties, ::mlir::RegionRange regions) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs)
47 odsOpName.emplace("undef.undef", odsAttrs.getContext());
48}
49
50UndefOpGenericAdaptorBase::UndefOpGenericAdaptorBase(UndefOp op) : UndefOpGenericAdaptorBase(op->getAttrDictionary(), op.getProperties(), op->getRegions()) {}
51
52std::pair<unsigned, unsigned> UndefOpGenericAdaptorBase::getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
53 return {index, 1};
54}
55
57 return odsAttrs;
58}
59
60} // namespace detail
62
63::mlir::LogicalResult UndefOpAdaptor::verify(::mlir::Location loc) {
64 return ::mlir::success();
65}
66
67std::pair<unsigned, unsigned> UndefOp::getODSOperandIndexAndLength(unsigned index) {
68 return {index, 1};
69}
70
71::mlir::Operation::operand_range UndefOp::getODSOperands(unsigned index) {
72 auto valueRange = getODSOperandIndexAndLength(index);
73 return {std::next(getOperation()->operand_begin(), valueRange.first),
74 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
75}
76
77std::pair<unsigned, unsigned> UndefOp::getODSResultIndexAndLength(unsigned index) {
78 return {index, 1};
79}
80
81::mlir::Operation::result_range UndefOp::getODSResults(unsigned index) {
82 auto valueRange = getODSResultIndexAndLength(index);
83 return {std::next(getOperation()->result_begin(), valueRange.first),
84 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
85}
86
87::mlir::Value UndefOp::getRes() {
88 return ::llvm::cast<::mlir::Value>(*getODSResults(0).begin());
89}
90
91void UndefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res) {
92 odsState.addTypes(res);
93}
94
95void UndefOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes) {
96 assert(resultTypes.size() == 1u && "mismatched number of results");
97 odsState.addTypes(resultTypes);
98}
99
100void UndefOp::build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes) {
101 assert(operands.size() == 0u && "mismatched number of parameters");
102 odsState.addOperands(operands);
103 odsState.addAttributes(attributes);
104 assert(resultTypes.size() == 1u && "mismatched number of return types");
105 odsState.addTypes(resultTypes);
106}
107
108::mlir::LogicalResult UndefOp::verifyInvariantsImpl() {
109 {
110 unsigned index = 0; (void)index;
111 auto valueGroup0 = getODSResults(0);
112
113 for (auto v : valueGroup0) {
114 if (::mlir::failed(__mlir_ods_local_type_constraint_Ops0(*this, v.getType(), "result", index++)))
115 return ::mlir::failure();
116 }
117 }
118 return ::mlir::success();
119}
120
121::mlir::LogicalResult UndefOp::verifyInvariants() {
122 return verifyInvariantsImpl();
123}
124
125::mlir::ParseResult UndefOp::parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result) {
126 ::mlir::Type resRawTypes[1];
127 ::llvm::ArrayRef<::mlir::Type> resTypes(resRawTypes);
128 if (parser.parseColon())
129 return ::mlir::failure();
130
131 {
132 ::mlir::Type type;
133 if (parser.parseCustomTypeWithFallback(type))
134 return ::mlir::failure();
135 resRawTypes[0] = type;
136 }
137 {
138 auto loc = parser.getCurrentLocation();(void)loc;
139 if (parser.parseOptionalAttrDict(result.attributes))
140 return ::mlir::failure();
141 }
142 result.addTypes(resTypes);
143 return ::mlir::success();
144}
145
146void UndefOp::print(::mlir::OpAsmPrinter &_odsPrinter) {
147 _odsPrinter << ' ' << ":";
148 _odsPrinter << ' ';
149 {
150 auto type = getRes().getType();
151 if (auto validType = ::llvm::dyn_cast<::mlir::Type>(type))
152 _odsPrinter.printStrippedAttrOrType(validType);
153 else
154 _odsPrinter << type;
155 }
156 ::llvm::SmallVector<::llvm::StringRef, 2> elidedAttrs;
157 _odsPrinter.printOptionalAttrDict((*this)->getAttrs(), elidedAttrs);
158}
159
160void UndefOp::getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects) {
161}
162
163} // namespace undef
164} // namespace llzk
165MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::undef::UndefOp)
166
167
168#endif // GET_OP_CLASSES
169
::mlir::LogicalResult verify(::mlir::Location loc)
Definition Ops.cpp.inc:63
UndefOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs=nullptr, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
Definition Ops.h.inc:55
::mlir::Value getRes()
Definition Ops.cpp.inc:87
void print(::mlir::OpAsmPrinter &_odsPrinter)
Definition Ops.cpp.inc:146
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index)
Definition Ops.cpp.inc:67
::mlir::Operation::operand_range getODSOperands(unsigned index)
Definition Ops.cpp.inc:71
void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect > > &effects)
Definition Ops.cpp.inc:160
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res)
Definition Ops.cpp.inc:91
::mlir::LogicalResult verifyInvariantsImpl()
Definition Ops.cpp.inc:108
::mlir::Operation::result_range getODSResults(unsigned index)
Definition Ops.cpp.inc:81
std::pair< unsigned, unsigned > getODSResultIndexAndLength(unsigned index)
Definition Ops.cpp.inc:77
::mlir::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:121
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
Definition Ops.cpp.inc:125
::std::optional<::mlir::OperationName > odsOpName
Definition Ops.h.inc:39
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize)
Definition Ops.cpp.inc:52
UndefOpGenericAdaptorBase(::mlir::DictionaryAttr attrs=nullptr, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
Definition Ops.cpp.inc:46
bool isValidType(Type type)