10#undef GET_ATTRDEF_LIST
12::llzk::smt::BitVectorAttr,
13::llzk::smt::KeywordAttr,
14::llzk::smt::SymbolAttr
18#ifdef GET_ATTRDEF_CLASSES
19#undef GET_ATTRDEF_CLASSES
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);
27 .Case(::llzk::smt::KeywordAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
28 value = ::llzk::smt::KeywordAttr::parse(parser, type);
29 return ::mlir::success(!!value);
31 .Case(::llzk::smt::SymbolAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
32 value = ::llzk::smt::SymbolAttr::parse(parser, type);
33 return ::mlir::success(!!value);
35 .Default([&](llvm::StringRef keyword, llvm::SMLoc) {
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();
45 return ::mlir::success();
47 .Case<::llzk::smt::KeywordAttr>([&](
auto t) {
48 printer << ::llzk::smt::KeywordAttr::getMnemonic();
50 return ::mlir::success();
52 .Case<::llzk::smt::SymbolAttr>([&](
auto t) {
53 printer << ::llzk::smt::SymbolAttr::getMnemonic();
55 return ::mlir::success();
57 .Default([](
auto) { return ::mlir::failure(); });
63struct BitVectorAttrStorage :
public ::mlir::AttributeStorage {
64 using KeyTy = std::tuple<::llvm::APInt>;
65 BitVectorAttrStorage(::llvm::APInt value) : value(std::move(value)) {}
67 KeyTy getAsKey()
const {
71 bool operator==(
const KeyTy &tblgenKey)
const {
72 return (value.getBitWidth() == std::get<0>(tblgenKey).getBitWidth() && value == std::get<0>(tblgenKey));
75 static ::llvm::hash_code hashKey(
const KeyTy &tblgenKey) {
76 return ::llvm::hash_combine(std::get<0>(tblgenKey));
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));
87BitVectorAttr BitVectorAttr::get(::mlir::MLIRContext *context, ::llvm::APInt value) {
88 return Base::get(context, std::move(value));
91BitVectorAttr BitVectorAttr::getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, ::llvm::APInt value) {
92 return Base::getChecked(emitError, context, value);
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();
101::llvm::APInt BitVectorAttr::getValue()
const {
102 return getImpl()->value;
107MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::smt::BitVectorAttr)
111struct KeywordAttrStorage :
public ::mlir::AttributeStorage {
112 using KeyTy = std::tuple<::llvm::StringRef>;
113 KeywordAttrStorage(::llvm::StringRef value) : value(std::move(value)) {}
115 KeyTy getAsKey()
const {
119 bool operator==(
const KeyTy &tblgenKey)
const {
120 return (value == std::get<0>(tblgenKey));
123 static ::llvm::hash_code hashKey(
const KeyTy &tblgenKey) {
124 return ::llvm::hash_combine(std::get<0>(tblgenKey));
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));
133 ::llvm::StringRef value;
136KeywordAttr KeywordAttr::get(::mlir::MLIRContext *context, ::llvm::StringRef value) {
137 return Base::get(context, std::move(value));
140KeywordAttr KeywordAttr::getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, ::llvm::StringRef value) {
141 return Base::getChecked(emitError, context, value);
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();
150::llvm::StringRef KeywordAttr::getValue()
const {
151 return getImpl()->value;
156MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::smt::KeywordAttr)
160struct SymbolAttrStorage :
public ::mlir::AttributeStorage {
161 using KeyTy = std::tuple<::llvm::StringRef>;
162 SymbolAttrStorage(::llvm::StringRef value) : value(std::move(value)) {}
164 KeyTy getAsKey()
const {
168 bool operator==(
const KeyTy &tblgenKey)
const {
169 return (value == std::get<0>(tblgenKey));
172 static ::llvm::hash_code hashKey(
const KeyTy &tblgenKey) {
173 return ::llvm::hash_combine(std::get<0>(tblgenKey));
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));
182 ::llvm::StringRef value;
185SymbolAttr SymbolAttr::get(::mlir::MLIRContext *context, ::llvm::StringRef value) {
186 return Base::get(context, std::move(value));
189SymbolAttr SymbolAttr::getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, ::llvm::StringRef value) {
190 return Base::getChecked(emitError, context, value);
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();
199::llvm::StringRef SymbolAttr::getValue()
const {
200 return getImpl()->value;
205MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::smt::SymbolAttr)
211 ::mlir::Type type)
const {
212 ::llvm::SMLoc typeLoc = parser.getCurrentLocation();
213 ::llvm::StringRef attrTag;
215 ::mlir::Attribute attr;
216 auto parseResult = generatedAttributeParser(parser, &attrTag, type, attr);
217 if (parseResult.has_value())
221 parser.emitError(typeLoc) <<
"unknown attribute `"
222 << attrTag <<
"` in dialect `" << getNamespace() <<
"`";
227 ::mlir::DialectAsmPrinter &printer)
const {
228 if (::mlir::succeeded(generatedAttributePrinter(attr, printer)))
::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.