LLZK 2.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
14#endif // GET_ATTRDEF_LIST
15
16#ifdef GET_ATTRDEF_CLASSES
17#undef GET_ATTRDEF_CLASSES
18
19static ::mlir::OptionalParseResult generatedAttributeParser(::mlir::AsmParser &parser, ::llvm::StringRef *mnemonic, ::mlir::Type type, ::mlir::Attribute &value) {
20 return ::mlir::AsmParser::KeywordSwitch<::mlir::OptionalParseResult>(parser)
21 .Case(::llzk::smt::BitVectorAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) {
22 value = ::llzk::smt::BitVectorAttr::parse(parser, type);
23 return ::mlir::success(!!value);
24 })
25 .Default([&](llvm::StringRef keyword, llvm::SMLoc) {
26 *mnemonic = keyword;
27 return std::nullopt;
28 });
29}
30
31static ::llvm::LogicalResult generatedAttributePrinter(::mlir::Attribute def, ::mlir::AsmPrinter &printer) {
32 return ::llvm::TypeSwitch<::mlir::Attribute, ::llvm::LogicalResult>(def) .Case<::llzk::smt::BitVectorAttr>([&](auto t) {
33 printer << ::llzk::smt::BitVectorAttr::getMnemonic();
34t.print(printer);
35 return ::mlir::success();
36 })
37 .Default([](auto) { return ::mlir::failure(); });
38}
39
40namespace llzk {
41namespace smt {
42namespace detail {
43struct BitVectorAttrStorage : public ::mlir::AttributeStorage {
44 using KeyTy = std::tuple<::llvm::APInt>;
45 BitVectorAttrStorage(::llvm::APInt value) : value(std::move(value)) {}
46
47 KeyTy getAsKey() const {
48 return KeyTy(value);
49 }
50
51 bool operator==(const KeyTy &tblgenKey) const {
52 return (::llvm::APInt::isSameValue(value, std::get<0>(tblgenKey)));
53 }
54
55 static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) {
56 return ::llvm::hash_combine(std::get<0>(tblgenKey));
57 }
58
59 static BitVectorAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) {
60 auto value = std::move(std::get<0>(tblgenKey));
61 return new (allocator.allocate<BitVectorAttrStorage>()) BitVectorAttrStorage(std::move(value));
62 }
63
64 ::llvm::APInt value;
65};
66} // namespace detail
67BitVectorAttr BitVectorAttr::get(::mlir::MLIRContext *context, ::llvm::APInt value) {
68 return Base::get(context, std::move(value));
69}
70
71BitVectorAttr BitVectorAttr::getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, ::llvm::APInt value) {
72 return Base::getChecked(emitError, context, value);
73}
74
75::llvm::LogicalResult BitVectorAttr::verifyInvariants(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::llvm::APInt value) {
76 if (::mlir::failed(verify(emitError, value)))
77 return ::mlir::failure();
78 return ::mlir::success();
79}
80
81::llvm::APInt BitVectorAttr::getValue() const {
82 return getImpl()->value;
83}
84
85} // namespace smt
86} // namespace llzk
87MLIR_DEFINE_EXPLICIT_TYPE_ID(::llzk::smt::BitVectorAttr)
88namespace llzk {
89namespace smt {
90
92::mlir::Attribute SMTDialect::parseAttribute(::mlir::DialectAsmParser &parser,
93 ::mlir::Type type) const {
94 ::llvm::SMLoc typeLoc = parser.getCurrentLocation();
95 ::llvm::StringRef attrTag;
96 {
97 ::mlir::Attribute attr;
98 auto parseResult = generatedAttributeParser(parser, &attrTag, type, attr);
99 if (parseResult.has_value())
100 return attr;
101 }
102
103 parser.emitError(typeLoc) << "unknown attribute `"
104 << attrTag << "` in dialect `" << getNamespace() << "`";
105 return {};
106}
108void SMTDialect::printAttribute(::mlir::Attribute attr,
109 ::mlir::DialectAsmPrinter &printer) const {
110 if (::mlir::succeeded(generatedAttributePrinter(attr, printer)))
111 return;
112
113}
114} // namespace smt
115} // namespace llzk
116
117#endif // GET_ATTRDEF_CLASSES
118
::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.