LLZK 3.0.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::string {
11
13class LitStringOp;
14
15} // namespace llzk::string
16#ifdef GET_OP_CLASSES
17#undef GET_OP_CLASSES
18
19namespace llzk::string {
20
21
22//===----------------------------------------------------------------------===//
23// ::llzk::string::LitStringOp declarations
24//===----------------------------------------------------------------------===//
25
26namespace detail {
27
29public:
30 struct Properties {
31 using valueTy = ::mlir::StringAttr;
33
34 auto getValue() const {
35 auto &propStorage = this->value;
36 return ::llvm::cast<::mlir::StringAttr>(propStorage);
37 }
38 void setValue(const ::mlir::StringAttr &propValue) {
39 this->value = propValue;
40 }
41 bool operator==(const Properties &rhs) const {
42 return
43 rhs.value == this->value &&
44 true;
45 }
46 bool operator!=(const Properties &rhs) const {
47 return !(*this == rhs);
48 }
49 };
50protected:
51 ::mlir::DictionaryAttr odsAttrs;
52 ::std::optional<::mlir::OperationName> odsOpName;
54 ::mlir::RegionRange odsRegions;
55public:
56 LitStringOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs)
57 odsOpName.emplace("string.new", odsAttrs.getContext());
58 }
59
61
62 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) {
63 return {index, 1};
64 }
65
67 return properties;
68 }
69
70 ::mlir::DictionaryAttr getAttributes() {
71 return odsAttrs;
72 }
73
74 ::mlir::StringAttr getValueAttr() {
75 auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().value);
76 return attr;
77 }
78
79 ::llvm::StringRef getValue();
80};
81
82} // namespace detail
83template <typename RangeT>
85 using ValueT = ::llvm::detail::ValueOfRange<RangeT>;
87public:
88 LitStringOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {}
89
90 LitStringOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : LitStringOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {}
91
92 LitStringOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : LitStringOpGenericAdaptor(values, attrs, Properties{}, {}) {}
93
94 LitStringOpGenericAdaptor(RangeT values, const LitStringOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {}
95
96 template <typename LateInst = LitStringOp, typename = std::enable_if_t<std::is_same_v<LateInst, LitStringOp>>>
97 LitStringOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {}
98
99 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
100 return Base::getODSOperandIndexAndLength(index, odsOperands.size());
101 }
102
103 RangeT getODSOperands(unsigned index) {
104 auto valueRange = getODSOperandIndexAndLength(index);
105 return {std::next(odsOperands.begin(), valueRange.first),
106 std::next(odsOperands.begin(), valueRange.first + valueRange.second)};
107 }
108
109 RangeT getOperands() {
110 return odsOperands;
111 }
112
113private:
114 RangeT odsOperands;
115};
116class LitStringOpAdaptor : public LitStringOpGenericAdaptor<::mlir::ValueRange> {
117public:
120
121 ::llvm::LogicalResult verify(::mlir::Location loc);
122};
123class LitStringOp : public ::mlir::Op<LitStringOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::llzk::string::StringType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ConstantLike> {
124public:
125 using Op::Op;
126 using Op::print;
128 template <typename RangeT>
132 static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() {
133 static ::llvm::StringRef attrNames[] = {::llvm::StringRef("value")};
134 return ::llvm::ArrayRef(attrNames);
135 }
136
137 ::mlir::StringAttr getValueAttrName() {
138 return getAttributeNameForIndex(0);
139 }
140
141 static ::mlir::StringAttr getValueAttrName(::mlir::OperationName name) {
142 return getAttributeNameForIndex(name, 0);
143 }
144
145 static constexpr ::llvm::StringLiteral getOperationName() {
146 return ::llvm::StringLiteral("string.new");
147 }
148
149 std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) {
150 return {index, 1};
151 }
152
153 ::mlir::Operation::operand_range getODSOperands(unsigned index) {
154 auto valueRange = getODSOperandIndexAndLength(index);
155 return {std::next(getOperation()->operand_begin(), valueRange.first),
156 std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)};
157 }
158
159 std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) {
160 return {index, 1};
161 }
162
163 ::mlir::Operation::result_range getODSResults(unsigned index) {
164 auto valueRange = getODSResultIndexAndLength(index);
165 return {std::next(getOperation()->result_begin(), valueRange.first),
166 std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)};
167 }
168
169 ::mlir::TypedValue<::llzk::string::StringType> getResult() {
170 return ::llvm::cast<::mlir::TypedValue<::llzk::string::StringType>>(*getODSResults(0).begin());
171 }
172
173 static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
174 static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop);
175 static llvm::hash_code computePropertiesHash(const Properties &prop);
176 static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name);
177 static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value);
178 static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs);
179 static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError);
180 static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state);
181 void writeProperties(::mlir::DialectBytecodeWriter &writer);
182 ::mlir::StringAttr getValueAttr() {
183 return ::llvm::cast<::mlir::StringAttr>(getProperties().value);
184 }
185
186 ::llvm::StringRef getValue();
187 void setValueAttr(::mlir::StringAttr attr) {
188 getProperties().value = attr;
189 }
190
191 void setValue(::llvm::StringRef attrValue);
192 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::StringAttr value);
193 static LitStringOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::StringAttr value);
194 static LitStringOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::StringAttr value);
195 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr value);
196 static LitStringOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::StringAttr value);
197 static LitStringOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::StringAttr value);
198 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::llvm::StringRef value);
199 static LitStringOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::llvm::StringRef value);
200 static LitStringOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::llvm::StringRef value);
201 static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef value);
202 static LitStringOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef value);
203 static LitStringOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef value);
204 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
205 static LitStringOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
206 static LitStringOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {});
207 static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
208 static LitStringOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
209 static LitStringOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {});
210 ::llvm::LogicalResult verifyInvariantsImpl();
211 ::llvm::LogicalResult verifyInvariants();
212 ::mlir::OpFoldResult fold(FoldAdaptor adaptor);
213 static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
214 void print(::mlir::OpAsmPrinter &_odsPrinter);
215 void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects);
216private:
217 ::mlir::StringAttr getAttributeNameForIndex(unsigned index) {
218 return getAttributeNameForIndex((*this)->getName(), index);
219 }
220
221 static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) {
222 assert(index < 1 && "invalid attribute index");
223 assert(name.getStringRef() == getOperationName() && "invalid operation name");
224 assert(name.isRegistered() && "Operation isn't registered, missing a "
225 "dependent dialect loading?");
226 return name.getAttributeNames()[index];
227 }
228
229public:
230};
231
232} // namespace llzk::string
233MLIR_DECLARE_EXPLICIT_TYPE_ID(::llzk::string::LitStringOp)
235
236
237#endif // GET_OP_CLASSES
238
LitStringOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
Definition Ops.h.inc:88
LitStringOpAdaptor(LitStringOp op)
Definition Ops.cpp.inc:66
::llvm::LogicalResult verify(::mlir::Location loc)
Definition Ops.cpp.inc:68
LitStringOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
Definition Ops.h.inc:88
RangeT getODSOperands(unsigned index)
Definition Ops.h.inc:103
LitStringOpGenericAdaptor(RangeT values, const LitStringOpGenericAdaptorBase &base)
Definition Ops.h.inc:94
LitStringOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs=nullptr)
Definition Ops.h.inc:92
LitStringOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions={})
Definition Ops.h.inc:90
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index)
Definition Ops.h.inc:99
LitStringOpGenericAdaptor(RangeT values, LateInst op)
Definition Ops.h.inc:97
LitStringOpGenericAdaptor< RangeT > GenericAdaptor
Definition Ops.h.inc:129
static llvm::hash_code computePropertiesHash(const Properties &prop)
Definition Ops.cpp.inc:116
void setValueAttr(::mlir::StringAttr attr)
Definition Ops.h.inc:187
static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::StringAttr value)
Definition Ops.cpp.inc:169
void print(::mlir::OpAsmPrinter &_odsPrinter)
Definition Ops.cpp.inc:333
GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute > > FoldAdaptor
Definition Ops.h.inc:130
void writeProperties(::mlir::DialectBytecodeWriter &writer)
Definition Ops.cpp.inc:155
::llvm::LogicalResult verifyInvariantsImpl()
Definition Ops.cpp.inc:290
static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs)
Definition Ops.cpp.inc:135
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index)
Definition Ops.h.inc:149
::mlir::OpFoldResult fold(FoldAdaptor adaptor)
Definition Ops.cpp:26
::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result)
Definition Ops.cpp.inc:312
static std::optional< mlir::Attribute > getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name)
Definition Ops.cpp.inc:122
static ::llvm::ArrayRef<::llvm::StringRef > getAttributeNames()
Definition Ops.h.inc:132
void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect > > &effects)
Definition Ops.cpp.inc:341
std::pair< unsigned, unsigned > getODSResultIndexAndLength(unsigned index)
Definition Ops.h.inc:159
::mlir::Operation::result_range getODSResults(unsigned index)
Definition Ops.h.inc:163
LitStringOpAdaptor Adaptor
Definition Ops.h.inc:127
static LitStringOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::StringAttr value)
Definition Ops.cpp.inc:174
::mlir::StringAttr getValueAttr()
Definition Ops.h.inc:182
static constexpr ::llvm::StringLiteral getOperationName()
Definition Ops.h.inc:145
void setValue(::llvm::StringRef attrValue)
Definition Ops.cpp.inc:165
::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state)
Definition Ops.cpp.inc:148
::llvm::LogicalResult verifyInvariants()
Definition Ops.cpp.inc:308
::mlir::TypedValue<::llzk::string::StringType > getResult()
Definition Ops.h.inc:169
::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:139
::mlir::Operation::operand_range getODSOperands(unsigned index)
Definition Ops.h.inc:153
::mlir::StringAttr getValueAttrName(::mlir::OperationName name)
Definition Ops.h.inc:141
::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop)
Definition Ops.cpp.inc:100
::mlir::StringAttr getValueAttrName()
Definition Ops.h.inc:137
static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value)
Definition Ops.cpp.inc:128
FoldAdaptor::Properties Properties
Definition Ops.h.inc:131
::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError)
Definition Ops.cpp.inc:77
::llvm::StringRef getValue()
Definition Ops.cpp.inc:160
std::pair< unsigned, unsigned > getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize)
Definition Ops.h.inc:62
::std::optional<::mlir::OperationName > odsOpName
Definition Ops.h.inc:52
LitStringOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions={})
Definition Ops.h.inc:56
void setValue(const ::mlir::StringAttr &propValue)
Definition Ops.h.inc:38