LLZK 0.1.0
An open-source IR for Zero Knowledge (ZK) circuits
Loading...
Searching...
No Matches
Ops.h.inc
Go to the documentation of this file.
1/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
2|* *|
3|* Op Declarations *|
4|* *|
5|* Automatically generated file, do not edit! *|
6|* From: Ops.td *|
7|* *|
8\*===----------------------------------------------------------------------===*/
9
10namespace llzk {
11namespace cast {
12class FeltToIndexOp;
13} // namespace cast
14} // namespace llzk
15namespace llzk {
16namespace cast {
17class IntToFeltOp;
18} // namespace cast
19} // namespace llzk
20#ifdef GET_OP_CLASSES
21#undef GET_OP_CLASSES
22
23namespace llzk {
24namespace cast {
25
26//===----------------------------------------------------------------------===//
27// ::llzk::cast::FeltToIndexOp declarations
28//===----------------------------------------------------------------------===//
29
30namespace detail {
32public:
33protected:
34 ::mlir::DictionaryAttr odsAttrs;
35 ::std::optional<::mlir::OperationName> odsOpName;
36 ::mlir::RegionRange odsRegions;
37public:
38 FeltToIndexOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = {}, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs)
39 odsOpName.emplace("cast.toindex", odsAttrs.getContext());
40 }
41
42 FeltToIndexOpGenericAdaptorBase(::mlir::Operation *op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), odsRegions(op->getRegions()) {}
43
44 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
45 return {index, 1};
46 }
47
48 ::mlir::DictionaryAttr getAttributes() {
49 return odsAttrs;
50 }
51
52};
53} // namespace detail
54template <typename RangeT>
56 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
58public:
59 FeltToIndexOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = {}, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
60
61 FeltToIndexOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FeltToIndexOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {}
62
63 FeltToIndexOpGenericAdaptor(RangeT values, const FeltToIndexOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
64
65 template <typename LateInst = FeltToIndexOp, typename = std::enable_if_t<std::is_same_v<LateInst, FeltToIndexOp>>>
66 FeltToIndexOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
67
68 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
69 return Base::getODSOperandIndexAndLength(index, odsOperands.size());
70 }
71
72 RangeT getODSOperands(unsigned index) {
73 auto valueRange = getODSOperandIndexAndLength(index);
74 return {std::next(odsOperands.begin(), valueRange.first),
75 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
76 }
77
78 ValueT getValue() {
79 return (*getODSOperands(0).begin());
80 }
81
82 RangeT getOperands() {
83 return odsOperands;
84 }
85
86private:
87 RangeT odsOperands;
88};
89class FeltToIndexOpAdaptor : public FeltToIndexOpGenericAdaptor<::mlir::ValueRange> {
90public:
93
94 ::llvm::LogicalResult verify(::mlir::Location loc);
95};
96class FeltToIndexOp : public ::mlir::Op<FeltToIndexOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::IndexType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::llzk::function::NotFieldNative, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> {
97public:
98 using Op::Op;
99 using Op::print;
101 template <typename RangeT>
104 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
105 return {};
106 }
107
108 static constexpr ::llvm::StringLiteral getOperationName() {
109 return ::llvm::StringLiteral("cast.toindex");
110 }
111
112 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
113 return {index, 1};
114 }
115
116 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
117 auto valueRange = getODSOperandIndexAndLength(index);
118 return {std::next(getOperation()->operand_begin(), valueRange.first),
119 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
120 }
121
122 ::mlir::TypedValue<::llzk::felt::FeltType> getValue() {
123 return ::llvm::cast<::mlir::TypedValue<::llzk::felt::FeltType>>(*getODSOperands(0).begin());
124 }
125
126 ::mlir::OpOperand &getValueMutable() {
127 auto range = getODSOperandIndexAndLength(0);
128 return getOperation()->getOpOperand(range.first);
129 }
130
131 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
132 return {index, 1};
133 }
134
135 ::mlir::Operation::result_range getODSResults(unsigned index) {
136 auto valueRange = getODSResultIndexAndLength(index);
137 return {std::next(getOperation()->result_begin(), valueRange.first),
138 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
139 }
140
141 ::mlir::TypedValue<::mlir::IndexType> getResult() {
142 return ::llvm::cast<::mlir::TypedValue<::mlir::IndexType>>(*getODSResults(0).begin());
143 }
144
145 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value value);
146 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value);
147 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
148 ::llvm::LogicalResult verifyInvariantsImpl();
149 ::llvm::LogicalResult verifyInvariants();
150 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
151 void print(::mlir::OpAsmPrinter &_odsPrinter);
152 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
153public:
154};
155} // namespace cast
156} // namespace llzk
157MLIR_DECLARE_EXPLICIT_TYPE_ID(::llzk::cast::FeltToIndexOp)
158
159namespace llzk {
160namespace cast {
161
162//===----------------------------------------------------------------------===//
163// ::llzk::cast::IntToFeltOp declarations
164//===----------------------------------------------------------------------===//
165
166namespace detail {
168public:
169protected:
170 ::mlir::DictionaryAttr odsAttrs;
171 ::std::optional<::mlir::OperationName> odsOpName;
172 ::mlir::RegionRange odsRegions;
173public:
174 IntToFeltOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = {}, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), odsRegions(regions) { if (odsAttrs)
175 odsOpName.emplace("cast.tofelt", odsAttrs.getContext());
176 }
177
178 IntToFeltOpGenericAdaptorBase(::mlir::Operation *op) : odsAttrs(op->getRawDictionaryAttrs()), odsOpName(op->getName()), odsRegions(op->getRegions()) {}
179
180 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
181 return {index, 1};
182 }
183
184 ::mlir::DictionaryAttr getAttributes() {
185 return odsAttrs;
186 }
187
188};
189} // namespace detail
190template <typename RangeT>
192 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
194public:
195 IntToFeltOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = {}, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
196
197 IntToFeltOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IntToFeltOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {}
198
199 IntToFeltOpGenericAdaptor(RangeT values, const IntToFeltOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
200
201 template <typename LateInst = IntToFeltOp, typename = std::enable_if_t<std::is_same_v<LateInst, IntToFeltOp>>>
202 IntToFeltOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
203
204 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
205 return Base::getODSOperandIndexAndLength(index, odsOperands.size());
206 }
207
208 RangeT getODSOperands(unsigned index) {
209 auto valueRange = getODSOperandIndexAndLength(index);
210 return {std::next(odsOperands.begin(), valueRange.first),
211 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
212 }
213
214 ValueT getValue() {
215 return (*getODSOperands(0).begin());
216 }
217
218 RangeT getOperands() {
219 return odsOperands;
220 }
221
222private:
223 RangeT odsOperands;
224};
225class IntToFeltOpAdaptor : public IntToFeltOpGenericAdaptor<::mlir::ValueRange> {
226public:
229
230 ::llvm::LogicalResult verify(::mlir::Location loc);
231};
232class IntToFeltOp : public ::mlir::Op<IntToFeltOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::llzk::felt::FeltType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> {
233public:
234 using Op::Op;
235 using Op::print;
237 template <typename RangeT>
240 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
241 return {};
242 }
243
244 static constexpr ::llvm::StringLiteral getOperationName() {
245 return ::llvm::StringLiteral("cast.tofelt");
246 }
247
248 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
249 return {index, 1};
250 }
251
252 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
253 auto valueRange = getODSOperandIndexAndLength(index);
254 return {std::next(getOperation()->operand_begin(), valueRange.first),
255 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
256 }
257
258 ::mlir::TypedValue<::mlir::Type> getValue() {
259 return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(0).begin());
260 }
261
262 ::mlir::OpOperand &getValueMutable() {
263 auto range = getODSOperandIndexAndLength(0);
264 return getOperation()->getOpOperand(range.first);
265 }
266
267 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
268 return {index, 1};
269 }
270
271 ::mlir::Operation::result_range getODSResults(unsigned index) {
272 auto valueRange = getODSResultIndexAndLength(index);
273 return {std::next(getOperation()->result_begin(), valueRange.first),
274 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
275 }
276
277 ::mlir::TypedValue<::llzk::felt::FeltType> getResult() {
278 return ::llvm::cast<::mlir::TypedValue<::llzk::felt::FeltType>>(*getODSResults(0).begin());
279 }
280
281 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value value);
282 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value);
283 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
284 ::llvm::LogicalResult verifyInvariantsImpl();
285 ::llvm::LogicalResult verifyInvariants();
286 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
287 void print(::mlir::OpAsmPrinter &_odsPrinter);
288 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
289public:
290};
291} // namespace cast
292} // namespace llzk
293MLIR_DECLARE_EXPLICIT_TYPE_ID(::llzk::cast::IntToFeltOp)
294
295
296#endif // GET_OP_CLASSES
297
::llvm::LogicalResult verify(::mlir::Location loc)
Definition Ops.cpp.inc:70
FeltToIndexOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs={}, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
Definition Ops.h.inc:59
FeltToIndexOpAdaptor(FeltToIndexOp op)
Definition Ops.cpp.inc:68
FeltToIndexOpGenericAdaptor(RangeT values, LateInst op)
Definition Ops.h.inc:66
FeltToIndexOpGenericAdaptor(RangeT values, const FeltToIndexOpGenericAdaptorBase &base)
Definition Ops.h.inc:63
FeltToIndexOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs={}, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
Definition Ops.h.inc:59
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index)
Definition Ops.h.inc:68
FeltToIndexOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions={})
Definition Ops.h.inc:61
RangeT getODSOperands(unsigned index)
Definition Ops.h.inc:72
::llvm::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:115
static ::llvm::ArrayRef<::llvm::StringRef > getAttributeNames()
Definition Ops.h.inc:104
void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect > > &effects)
Definition Ops.cpp.inc:147
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value value)
Definition Ops.cpp.inc:74
std::pair< unsigned, unsigned > getODSResultIndexAndLength(unsigned index)
Definition Ops.h.inc:131
::mlir::OpOperand & getValueMutable()
Definition Ops.h.inc:126
::mlir::TypedValue<::llzk::felt::FeltType > getValue()
Definition Ops.h.inc:122
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index)
Definition Ops.h.inc:112
void print(::mlir::OpAsmPrinter &_odsPrinter)
Definition Ops.cpp.inc:140
::mlir::TypedValue<::mlir::IndexType > getResult()
Definition Ops.h.inc:141
::mlir::Operation::result_range getODSResults(unsigned index)
Definition Ops.h.inc:135
FeltToIndexOpAdaptor Adaptor
Definition Ops.h.inc:100
FeltToIndexOpGenericAdaptor< RangeT > GenericAdaptor
Definition Ops.h.inc:102
GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute > > FoldAdaptor
Definition Ops.h.inc:103
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
Definition Ops.cpp.inc:119
::mlir::Operation::operand_range getODSOperands(unsigned index)
Definition Ops.h.inc:116
::llvm::LogicalResult verifyInvariantsImpl()
Definition Ops.cpp.inc:93
static constexpr ::llvm::StringLiteral getOperationName()
Definition Ops.h.inc:108
::llvm::LogicalResult verify(::mlir::Location loc)
Definition Ops.cpp.inc:165
IntToFeltOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs={}, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
Definition Ops.h.inc:195
IntToFeltOpAdaptor(IntToFeltOp op)
Definition Ops.cpp.inc:163
IntToFeltOpGenericAdaptor(RangeT values, LateInst op)
Definition Ops.h.inc:202
IntToFeltOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs={}, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
Definition Ops.h.inc:195
IntToFeltOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions={})
Definition Ops.h.inc:197
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index)
Definition Ops.h.inc:204
IntToFeltOpGenericAdaptor(RangeT values, const IntToFeltOpGenericAdaptorBase &base)
Definition Ops.h.inc:199
RangeT getODSOperands(unsigned index)
Definition Ops.h.inc:208
GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute > > FoldAdaptor
Definition Ops.h.inc:239
void print(::mlir::OpAsmPrinter &_odsPrinter)
Definition Ops.cpp.inc:245
::llvm::LogicalResult verifyInvariantsImpl()
Definition Ops.cpp.inc:188
static constexpr ::llvm::StringLiteral getOperationName()
Definition Ops.h.inc:244
void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect > > &effects)
Definition Ops.cpp.inc:261
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index)
Definition Ops.h.inc:248
static ::llvm::ArrayRef<::llvm::StringRef > getAttributeNames()
Definition Ops.h.inc:240
std::pair< unsigned, unsigned > getODSResultIndexAndLength(unsigned index)
Definition Ops.h.inc:267
IntToFeltOpAdaptor Adaptor
Definition Ops.h.inc:236
::mlir::Operation::operand_range getODSOperands(unsigned index)
Definition Ops.h.inc:252
::mlir::TypedValue<::llzk::felt::FeltType > getResult()
Definition Ops.h.inc:277
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
Definition Ops.cpp.inc:214
IntToFeltOpGenericAdaptor< RangeT > GenericAdaptor
Definition Ops.h.inc:238
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value value)
Definition Ops.cpp.inc:169
::mlir::Operation::result_range getODSResults(unsigned index)
Definition Ops.h.inc:271
::llvm::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:210
::mlir::TypedValue<::mlir::Type > getValue()
Definition Ops.h.inc:258
::mlir::OpOperand & getValueMutable()
Definition Ops.h.inc:262
FeltToIndexOpGenericAdaptorBase(::mlir::DictionaryAttr attrs={}, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
Definition Ops.h.inc:38
::std::optional<::mlir::OperationName > odsOpName
Definition Ops.h.inc:35
FeltToIndexOpGenericAdaptorBase(::mlir::Operation *op)
Definition Ops.h.inc:42
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize)
Definition Ops.h.inc:44
::std::optional<::mlir::OperationName > odsOpName
Definition Ops.h.inc:171
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize)
Definition Ops.h.inc:180
IntToFeltOpGenericAdaptorBase(::mlir::Operation *op)
Definition Ops.h.inc:178
IntToFeltOpGenericAdaptorBase(::mlir::DictionaryAttr attrs={}, const ::mlir::EmptyProperties &properties={}, ::mlir::RegionRange regions={})
Definition Ops.h.inc:174