LLZK 2.1.1
An open-source IR for Zero Knowledge (ZK) circuits
Loading...
Searching...
No Matches
Enums.h.inc
Go to the documentation of this file.
1/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
2|* *|
3|* Enum Utility Declarations *|
4|* *|
5|* Automatically generated file, do not edit! *|
6|* From: Enums.td *|
7|* *|
8\*===----------------------------------------------------------------------===*/
9
10namespace llzk {
11namespace cast {
12// Cast overflow semantics
13enum class OverflowSemantics : uint32_t {
14 ASSERT = 0,
16 WRAP = 2,
18};
19
20::std::optional<OverflowSemantics> symbolizeOverflowSemantics(uint32_t);
22::std::optional<OverflowSemantics> symbolizeOverflowSemantics(::llvm::StringRef);
23inline constexpr unsigned getMaxEnumValForOverflowSemantics() {
24 return 3;
25}
26
27
28inline ::llvm::StringRef stringifyEnum(OverflowSemantics enumValue) {
29 return stringifyOverflowSemantics(enumValue);
30}
31
32template <typename EnumType>
33::std::optional<EnumType> symbolizeEnum(::llvm::StringRef);
34
35template <>
36inline ::std::optional<OverflowSemantics> symbolizeEnum<OverflowSemantics>(::llvm::StringRef str) {
38}
39} // namespace cast
40} // namespace llzk
41
42namespace mlir {
43template <typename T, typename>
44struct FieldParser;
45
46template<>
48 template <typename ParserT>
49 static FailureOr<::llzk::cast::OverflowSemantics> parse(ParserT &parser) {
50 // Parse the keyword/string containing the enum.
51 std::string enumKeyword;
52 auto loc = parser.getCurrentLocation();
53 if (failed(parser.parseOptionalKeywordOrString(&enumKeyword)))
54 return parser.emitError(loc, "expected keyword for Cast overflow semantics");
55
56 // Symbolize the keyword.
57 if (::std::optional<::llzk::cast::OverflowSemantics> attr = ::llzk::cast::symbolizeEnum<::llzk::cast::OverflowSemantics>(enumKeyword))
58 return *attr;
59 return parser.emitError(loc, "invalid Cast overflow semantics specification: ") << enumKeyword;
60 }
61};
62
67template<>
68struct FieldParser<std::optional<::llzk::cast::OverflowSemantics>, std::optional<::llzk::cast::OverflowSemantics>> {
69 template <typename ParserT>
70 static FailureOr<std::optional<::llzk::cast::OverflowSemantics>> parse(ParserT &parser) {
71 // Parse the keyword/string containing the enum.
72 std::string enumKeyword;
73 auto loc = parser.getCurrentLocation();
74 if (failed(parser.parseOptionalKeywordOrString(&enumKeyword)))
75 return std::optional<::llzk::cast::OverflowSemantics>{};
76
77 // Symbolize the keyword.
78 if (::std::optional<::llzk::cast::OverflowSemantics> attr = ::llzk::cast::symbolizeEnum<::llzk::cast::OverflowSemantics>(enumKeyword))
79 return attr;
80 return parser.emitError(loc, "invalid Cast overflow semantics specification: ") << enumKeyword;
81 }
82};
83} // namespace mlir
84
85namespace llvm {
86inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::llzk::cast::OverflowSemantics value) {
87 auto valueStr = stringifyEnum(value);
88 return p << valueStr;
89}
90} // namespace llvm
91
92namespace llvm {
93template<> struct DenseMapInfo<::llzk::cast::OverflowSemantics> {
94 using StorageInfo = ::llvm::DenseMapInfo<uint32_t>;
95
96 static inline ::llzk::cast::OverflowSemantics getEmptyKey() {
97 return static_cast<::llzk::cast::OverflowSemantics>(StorageInfo::getEmptyKey());
98 }
99
100 static inline ::llzk::cast::OverflowSemantics getTombstoneKey() {
101 return static_cast<::llzk::cast::OverflowSemantics>(StorageInfo::getTombstoneKey());
102 }
103
104 static unsigned getHashValue(const ::llzk::cast::OverflowSemantics &val) {
105 return StorageInfo::getHashValue(static_cast<uint32_t>(val));
106 }
107
108 static bool isEqual(const ::llzk::cast::OverflowSemantics &lhs, const ::llzk::cast::OverflowSemantics &rhs) {
109 return lhs == rhs;
110 }
111};
112}
113
raw_ostream & operator<<(raw_ostream &os, llvm::PointerUnion< mlir::Value, mlir::Operation * > ptr)
inline ::std::optional< OverflowSemantics > symbolizeEnum< OverflowSemantics >(::llvm::StringRef str)
Definition Enums.h.inc:36
::std::optional< EnumType > symbolizeEnum(::llvm::StringRef)
::llvm::StringRef stringifyOverflowSemantics(OverflowSemantics val)
Definition Enums.cpp.inc:12
constexpr unsigned getMaxEnumValForOverflowSemantics()
Definition Enums.h.inc:23
inline ::llvm::StringRef stringifyEnum(OverflowSemantics enumValue)
Definition Enums.h.inc:28
::std::optional< OverflowSemantics > symbolizeOverflowSemantics(::llvm::StringRef str)
Definition Enums.cpp.inc:22
static inline ::llzk::cast::OverflowSemantics getTombstoneKey()
Definition Enums.h.inc:100
static bool isEqual(const ::llzk::cast::OverflowSemantics &lhs, const ::llzk::cast::OverflowSemantics &rhs)
Definition Enums.h.inc:108
static unsigned getHashValue(const ::llzk::cast::OverflowSemantics &val)
Definition Enums.h.inc:104
::llvm::DenseMapInfo< uint32_t > StorageInfo
Definition Enums.h.inc:94
static inline ::llzk::cast::OverflowSemantics getEmptyKey()
Definition Enums.h.inc:96
static FailureOr< std::optional<::llzk::cast::OverflowSemantics > > parse(ParserT &parser)
Definition Enums.h.inc:70
static FailureOr<::llzk::cast::OverflowSemantics > parse(ParserT &parser)
Definition Enums.h.inc:49