LLZK 3.0.0
An open-source IR for Zero Knowledge (ZK) circuits
Loading...
Searching...
No Matches
SMTAttributes.cpp.inc
Go to the documentation of this file.
1/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
2|* *|
3|* AttrDef Definitions *|
4|* *|
5|* Automatically generated file, do not edit! *|
6|* *|
7\*===----------------------------------------------------------------------===*/
8
9#ifdef GET_ATTRDEF_LIST
10#undef GET_ATTRDEF_LIST
11
12::llzk::smt::BitVectorAttr,
13::llzk::smt::KeywordAttr,
14::llzk::smt::SymbolAttr
15
16#endif // GET_ATTRDEF_LIST
17
18#ifdef GET_ATTRDEF_CLASSES
19#undef GET_ATTRDEF_CLASSES
20
21static ::mlir::OptionalParseResult generatedAttributeParser(::mlir::AsmParser &parser, ::llvm::StringRef *mnemonic, ::mlir::Type type, ::mlir::Attribute &value) {
22 return ::mlir::AsmParser::KeywordSwitch<::mlir::OptionalParseResult>(parser)
23 .Case(::llzk::smt::BitVectorAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
24 value = ::llzk::smt::BitVectorAttr::parse(parser, type);
25 return ::mlir::success(!!value);
26 })
27 .Case(::llzk::smt::KeywordAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
28 value = ::llzk::smt::KeywordAttr::parse(parser, type);
29 return ::mlir::success(!!value);
30 })
31 .Case(::llzk::smt::SymbolAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
32 value = ::llzk::smt::SymbolAttr::parse(parser, type);
33 return ::mlir::success(!!value);
34 })
35 .Default([&](llvm::StringRef keyword, llvm::SMLoc) {
36 *mnemonic = keyword;
37 return std::nullopt;
38 });
39}
40
41static ::llvm::LogicalResult generatedAttributePrinter(::mlir::Attribute def, ::mlir::AsmPrinter &printer) {
42 return ::llvm::TypeSwitch<::mlir::Attribute, ::llvm::LogicalResult>(def) .Case<::llzk::smt::BitVectorAttr>([&](auto t) {
43 printer << ::llzk::smt::BitVectorAttr::getMnemonic();
44t.print(printer);
45 return ::mlir::success();
46 })
47 .Case<::llzk::smt::KeywordAttr>([&](auto t) {
48 printer << ::llzk::smt::KeywordAttr::getMnemonic();
49t.print(printer);
50 return ::mlir::success();
51 })
52 .Case<::llzk::smt::SymbolAttr>([&](auto t) {
53 printer << ::llzk::smt::SymbolAttr::getMnemonic();
54t.print(printer);
55 return ::mlir::success();
56 })
57 .Default([](auto) { return ::mlir::failure(); });
58}
59
60namespace llzk {
61namespace smt {
62namespace detail {
63struct BitVectorAttrStorage : public ::mlir::AttributeStorage {
64 using KeyTy = std::tuple<::llvm::APInt>;
65 BitVectorAttrStorage(::llvm::APInt value) : value(std::move(value)) {}
66
67 KeyTy getAsKey() const {
68 return KeyTy(value);
69 }
70
71 bool operator==(const KeyTy &tblgenKey) const {
72 return (value.getBitWidth() == std::get<0>(tblgenKey).getBitWidth() && value == std::get<0>(tblgenKey));
73 }
74
75 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
76 return ::llvm::hash_combine(std::get<0>(tblgenKey));
77 }
78
79 static BitVectorAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) {
80 auto value = std::move(std::get<0>(tblgenKey));
81 return new (allocator.allocate<BitVectorAttrStorage>()) BitVectorAttrStorage(std::move(value));
82 }
83
84 ::llvm::APInt value;
85};
86} // namespace detail
87BitVectorAttr BitVectorAttr::get(::mlir::MLIRContext *context, ::llvm::APInt value) {
88 return Base::get(context, std::move(value));
89}
90
91BitVectorAttr BitVectorAttr::getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, ::llvm::APInt value) {
92 return Base::getChecked(emitError, context, value);
93}
94
95::llvm::LogicalResult BitVectorAttr::verifyInvariants(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::llvm::APInt value) {
96 if (::mlir::failed(verify(emitError, value)))
97 return ::mlir::failure();
98 return ::mlir::success();
99}
100
101::llvm::APInt BitVectorAttr::getValue() const {
102 return getImpl()->value;
103}
104
105} // namespace smt
106} // namespace llzk
107MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::smt::BitVectorAttr)
108namespace llzk {
109namespace smt {
110namespace detail {
111struct KeywordAttrStorage : public ::mlir::AttributeStorage {
112 using KeyTy = std::tuple<::llvm::StringRef>;
113 KeywordAttrStorage(::llvm::StringRef value) : value(std::move(value)) {}
114
115 KeyTy getAsKey() const {
116 return KeyTy(value);
117 }
118
119 bool operator==(const KeyTy &tblgenKey) const {
120 return (value == std::get<0>(tblgenKey));
121 }
122
123 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
124 return ::llvm::hash_combine(std::get<0>(tblgenKey));
125 }
126
127 static KeywordAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) {
128 auto value = std::move(std::get<0>(tblgenKey));
129 value = allocator.copyInto(value);
130 return new (allocator.allocate<KeywordAttrStorage>()) KeywordAttrStorage(std::move(value));
131 }
132
133 ::llvm::StringRef value;
134};
135} // namespace detail
136KeywordAttr KeywordAttr::get(::mlir::MLIRContext *context, ::llvm::StringRef value) {
137 return Base::get(context, std::move(value));
138}
139
140KeywordAttr KeywordAttr::getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, ::llvm::StringRef value) {
141 return Base::getChecked(emitError, context, value);
142}
143
144::llvm::LogicalResult KeywordAttr::verifyInvariants(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::llvm::StringRef value) {
145 if (::mlir::failed(verify(emitError, value)))
146 return ::mlir::failure();
147 return ::mlir::success();
148}
149
150::llvm::StringRef KeywordAttr::getValue() const {
151 return getImpl()->value;
152}
153
154} // namespace smt
155} // namespace llzk
156MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::smt::KeywordAttr)
157namespace llzk {
158namespace smt {
159namespace detail {
160struct SymbolAttrStorage : public ::mlir::AttributeStorage {
161 using KeyTy = std::tuple<::llvm::StringRef>;
162 SymbolAttrStorage(::llvm::StringRef value) : value(std::move(value)) {}
163
164 KeyTy getAsKey() const {
165 return KeyTy(value);
166 }
167
168 bool operator==(const KeyTy &tblgenKey) const {
169 return (value == std::get<0>(tblgenKey));
170 }
171
172 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
173 return ::llvm::hash_combine(std::get<0>(tblgenKey));
174 }
175
176 static SymbolAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) {
177 auto value = std::move(std::get<0>(tblgenKey));
178 value = allocator.copyInto(value);
179 return new (allocator.allocate<SymbolAttrStorage>()) SymbolAttrStorage(std::move(value));
180 }
181
182 ::llvm::StringRef value;
183};
184} // namespace detail
185SymbolAttr SymbolAttr::get(::mlir::MLIRContext *context, ::llvm::StringRef value) {
186 return Base::get(context, std::move(value));
187}
188
189SymbolAttr SymbolAttr::getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, ::llvm::StringRef value) {
190 return Base::getChecked(emitError, context, value);
191}
192
193::llvm::LogicalResult SymbolAttr::verifyInvariants(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::llvm::StringRef value) {
194 if (::mlir::failed(verify(emitError, value)))
195 return ::mlir::failure();
196 return ::mlir::success();
197}
198
199::llvm::StringRef SymbolAttr::getValue() const {
200 return getImpl()->value;
201}
202
203} // namespace smt
204} // namespace llzk
205MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::smt::SymbolAttr)
206namespace llzk {
207namespace smt {
208
210::mlir::Attribute SMTDialect::parseAttribute(::mlir::DialectAsmParser &parser,
211 ::mlir::Type type) const {
212 ::llvm::SMLoc typeLoc = parser.getCurrentLocation();
213 ::llvm::StringRef attrTag;
214 {
215 ::mlir::Attribute attr;
216 auto parseResult = generatedAttributeParser(parser, &attrTag, type, attr);
217 if (parseResult.has_value())
218 return attr;
219 }
220
221 parser.emitError(typeLoc) << "unknown attribute `"
222 << attrTag << "` in dialect `" << getNamespace() << "`";
223 return {};
224}
226void SMTDialect::printAttribute(::mlir::Attribute attr,
227 ::mlir::DialectAsmPrinter &printer) const {
228 if (::mlir::succeeded(generatedAttributePrinter(attr, printer)))
229 return;
230
231}
232} // namespace smt
233} // namespace llzk
234
235#endif // GET_ATTRDEF_CLASSES
236
::mlir::Attribute parseAttribute(::mlir::DialectAsmParser &parser, ::mlir::Type type) const override
Parse an attribute registered to this dialect.
void printAttribute(::mlir::Attribute attr, ::mlir::DialectAsmPrinter &os) const override
Print an attribute registered to this dialect.