LLZK 3.0.0
An open-source IR for Zero Knowledge (ZK) circuits
Loading...
Searching...
No Matches
SMTInfoAttributes.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_info::KeywordAttr,
13::llzk::smt_info::SymbolAttr
14
15#endif // GET_ATTRDEF_LIST
16
17#ifdef GET_ATTRDEF_CLASSES
18#undef GET_ATTRDEF_CLASSES
19
20static ::mlir::OptionalParseResult generatedAttributeParser(::mlir::AsmParser &parser, ::llvm::StringRef *mnemonic, ::mlir::Type type, ::mlir::Attribute &value) {
21 return ::mlir::AsmParser::KeywordSwitch<::mlir::OptionalParseResult>(parser)
22 .Case(::llzk::smt_info::KeywordAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
23 value = ::llzk::smt_info::KeywordAttr::parse(parser, type);
24 return ::mlir::success(!!value);
25 })
26 .Case(::llzk::smt_info::SymbolAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
27 value = ::llzk::smt_info::SymbolAttr::parse(parser, type);
28 return ::mlir::success(!!value);
29 })
30 .Default([&](llvm::StringRef keyword, llvm::SMLoc) {
31 *mnemonic = keyword;
32 return std::nullopt;
33 });
34}
35
36static ::llvm::LogicalResult generatedAttributePrinter(::mlir::Attribute def, ::mlir::AsmPrinter &printer) {
37 return ::llvm::TypeSwitch<::mlir::Attribute, ::llvm::LogicalResult>(def) .Case<::llzk::smt_info::KeywordAttr>([&](auto t) {
38 printer << ::llzk::smt_info::KeywordAttr::getMnemonic();
39t.print(printer);
40 return ::mlir::success();
41 })
42 .Case<::llzk::smt_info::SymbolAttr>([&](auto t) {
43 printer << ::llzk::smt_info::SymbolAttr::getMnemonic();
44t.print(printer);
45 return ::mlir::success();
46 })
47 .Default([](auto) { return ::mlir::failure(); });
48}
49
50namespace llzk::smt_info {
51
52namespace detail {
53
54struct KeywordAttrStorage : public ::mlir::AttributeStorage {
55 using KeyTy = std::tuple<::llvm::StringRef>;
56 KeywordAttrStorage(::llvm::StringRef value) : value(std::move(value)) {}
57
58 KeyTy getAsKey() const {
59 return KeyTy(value);
60 }
61
62 bool operator==(const KeyTy &tblgenKey) const {
63 return (value == std::get<0>(tblgenKey));
64 }
65
66 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
67 return ::llvm::hash_combine(std::get<0>(tblgenKey));
68 }
69
70 static KeywordAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) {
71 auto value = std::move(std::get<0>(tblgenKey));
72 value = allocator.copyInto(value);
73 return new (allocator.allocate<KeywordAttrStorage>()) KeywordAttrStorage(std::move(value));
74 }
75
76 ::llvm::StringRef value;
77};
78
79} // namespace detail
80KeywordAttr KeywordAttr::get(::mlir::MLIRContext *context, ::llvm::StringRef value) {
81 return Base::get(context, std::move(value));
82}
83
84KeywordAttr KeywordAttr::getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, ::llvm::StringRef value) {
85 return Base::getChecked(emitError, context, std::move(value));
86}
87
88::llvm::LogicalResult KeywordAttr::verifyInvariants(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::llvm::StringRef value) {
89 if (::mlir::failed(verify(emitError, value)))
90 return ::mlir::failure();
91 return ::mlir::success();
92}
93
94::llvm::StringRef KeywordAttr::getValue() const {
95 return getImpl()->value;
96}
97
98
99} // namespace llzk::smt_info
100MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::smt_info::KeywordAttr)
101namespace llzk::smt_info {
102
103namespace detail {
104
105struct SymbolAttrStorage : public ::mlir::AttributeStorage {
106 using KeyTy = std::tuple<::llvm::StringRef>;
107 SymbolAttrStorage(::llvm::StringRef value) : value(std::move(value)) {}
108
109 KeyTy getAsKey() const {
110 return KeyTy(value);
111 }
112
113 bool operator==(const KeyTy &tblgenKey) const {
114 return (value == std::get<0>(tblgenKey));
115 }
116
117 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
118 return ::llvm::hash_combine(std::get<0>(tblgenKey));
119 }
120
121 static SymbolAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) {
122 auto value = std::move(std::get<0>(tblgenKey));
123 value = allocator.copyInto(value);
124 return new (allocator.allocate<SymbolAttrStorage>()) SymbolAttrStorage(std::move(value));
125 }
126
127 ::llvm::StringRef value;
128};
129
130} // namespace detail
131SymbolAttr SymbolAttr::get(::mlir::MLIRContext *context, ::llvm::StringRef value) {
132 return Base::get(context, std::move(value));
133}
134
135SymbolAttr SymbolAttr::getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, ::llvm::StringRef value) {
136 return Base::getChecked(emitError, context, std::move(value));
137}
138
139::llvm::LogicalResult SymbolAttr::verifyInvariants(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::llvm::StringRef value) {
140 if (::mlir::failed(verify(emitError, value)))
141 return ::mlir::failure();
142 return ::mlir::success();
143}
144
145::llvm::StringRef SymbolAttr::getValue() const {
146 return getImpl()->value;
147}
148
149
150} // namespace llzk::smt_info
151MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::smt_info::SymbolAttr)
152namespace llzk::smt_info {
153
154
156::mlir::Attribute SMTInfoDialect::parseAttribute(::mlir::DialectAsmParser &parser,
157 ::mlir::Type type) const {
158 ::llvm::SMLoc typeLoc = parser.getCurrentLocation();
159 ::llvm::StringRef attrTag;
160 {
161 ::mlir::Attribute attr;
162 auto parseResult = generatedAttributeParser(parser, &attrTag, type, attr);
163 if (parseResult.has_value())
164 return attr;
165 }
166
167 parser.emitError(typeLoc) << "unknown attribute `"
168 << attrTag << "` in dialect `" << getNamespace() << "`";
169 return {};
170}
172void SMTInfoDialect::printAttribute(::mlir::Attribute attr,
173 ::mlir::DialectAsmPrinter &printer) const {
174 if (::mlir::succeeded(generatedAttributePrinter(attr, printer)))
175 return;
176
177}
178
179} // namespace llzk::smt_info
180
181#endif // GET_ATTRDEF_CLASSES
182
::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.