LLZK 0.1.0
Veridise's ZK Language IR
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 boolean {
12// Field element comparison predicate
13enum class FeltCmpPredicate : uint32_t {
14 EQ = 0,
15 NE = 1,
16 LT = 2,
17 LE = 3,
18 GT = 4,
19 GE = 5,
20};
21
22::std::optional<FeltCmpPredicate> symbolizeFeltCmpPredicate(uint32_t);
24::std::optional<FeltCmpPredicate> symbolizeFeltCmpPredicate(::llvm::StringRef);
25inline constexpr unsigned getMaxEnumValForFeltCmpPredicate() {
26 return 5;
27}
28
29
30inline ::llvm::StringRef stringifyEnum(FeltCmpPredicate enumValue) {
31 return stringifyFeltCmpPredicate(enumValue);
32}
33
34template <typename EnumType>
35::std::optional<EnumType> symbolizeEnum(::llvm::StringRef);
36
37template <>
38inline ::std::optional<FeltCmpPredicate> symbolizeEnum<FeltCmpPredicate>(::llvm::StringRef str) {
39 return symbolizeFeltCmpPredicate(str);
40}
41} // namespace boolean
42} // namespace llzk
43
44namespace mlir {
45template <typename T, typename>
46struct FieldParser;
47
48template<>
50 template <typename ParserT>
51 static FailureOr<::llzk::boolean::FeltCmpPredicate> parse(ParserT &parser) {
52 // Parse the keyword/string containing the enum.
53 std::string enumKeyword;
54 auto loc = parser.getCurrentLocation();
55 if (failed(parser.parseOptionalKeywordOrString(&enumKeyword)))
56 return parser.emitError(loc, "expected keyword for Field element comparison predicate");
57
58 // Symbolize the keyword.
59 if (::std::optional<::llzk::boolean::FeltCmpPredicate> attr = ::llzk::boolean::symbolizeEnum<::llzk::boolean::FeltCmpPredicate>(enumKeyword))
60 return *attr;
61 return parser.emitError(loc, "invalid Field element comparison predicate specification: ") << enumKeyword;
62 }
63};
64
69template<>
70struct FieldParser<std::optional<::llzk::boolean::FeltCmpPredicate>, std::optional<::llzk::boolean::FeltCmpPredicate>> {
71 template <typename ParserT>
72 static FailureOr<std::optional<::llzk::boolean::FeltCmpPredicate>> parse(ParserT &parser) {
73 // Parse the keyword/string containing the enum.
74 std::string enumKeyword;
75 auto loc = parser.getCurrentLocation();
76 if (failed(parser.parseOptionalKeywordOrString(&enumKeyword)))
77 return std::optional<::llzk::boolean::FeltCmpPredicate>{};
78
79 // Symbolize the keyword.
80 if (::std::optional<::llzk::boolean::FeltCmpPredicate> attr = ::llzk::boolean::symbolizeEnum<::llzk::boolean::FeltCmpPredicate>(enumKeyword))
81 return attr;
82 return parser.emitError(loc, "invalid Field element comparison predicate specification: ") << enumKeyword;
83 }
84};
85} // namespace mlir
86
87namespace llvm {
88inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::llzk::boolean::FeltCmpPredicate value) {
89 auto valueStr = stringifyEnum(value);
90 return p << valueStr;
91}
92} // namespace llvm
93
94namespace llvm {
95template<> struct DenseMapInfo<::llzk::boolean::FeltCmpPredicate> {
96 using StorageInfo = ::llvm::DenseMapInfo<uint32_t>;
97
98 static inline ::llzk::boolean::FeltCmpPredicate getEmptyKey() {
99 return static_cast<::llzk::boolean::FeltCmpPredicate>(StorageInfo::getEmptyKey());
100 }
101
102 static inline ::llzk::boolean::FeltCmpPredicate getTombstoneKey() {
103 return static_cast<::llzk::boolean::FeltCmpPredicate>(StorageInfo::getTombstoneKey());
104 }
105
106 static unsigned getHashValue(const ::llzk::boolean::FeltCmpPredicate &val) {
107 return StorageInfo::getHashValue(static_cast<uint32_t>(val));
108 }
109
110 static bool isEqual(const ::llzk::boolean::FeltCmpPredicate &lhs, const ::llzk::boolean::FeltCmpPredicate &rhs) {
111 return lhs == rhs;
112 }
113};
114}
115
raw_ostream & operator<<(raw_ostream &os, llvm::PointerUnion< mlir::Value, mlir::Operation * > ptr)
::std::optional< EnumType > symbolizeEnum(::llvm::StringRef)
inline ::llvm::StringRef stringifyEnum(FeltCmpPredicate enumValue)
Definition Enums.h.inc:30
::llvm::StringRef stringifyFeltCmpPredicate(FeltCmpPredicate val)
Definition Enums.cpp.inc:12
::std::optional< FeltCmpPredicate > symbolizeFeltCmpPredicate(::llvm::StringRef str)
Definition Enums.cpp.inc:24
inline ::std::optional< FeltCmpPredicate > symbolizeEnum< FeltCmpPredicate >(::llvm::StringRef str)
Definition Enums.h.inc:38
constexpr unsigned getMaxEnumValForFeltCmpPredicate()
Definition Enums.h.inc:25
static unsigned getHashValue(const ::llzk::boolean::FeltCmpPredicate &val)
Definition Enums.h.inc:106
static inline ::llzk::boolean::FeltCmpPredicate getEmptyKey()
Definition Enums.h.inc:98
::llvm::DenseMapInfo< uint32_t > StorageInfo
Definition Enums.h.inc:96
static inline ::llzk::boolean::FeltCmpPredicate getTombstoneKey()
Definition Enums.h.inc:102
static bool isEqual(const ::llzk::boolean::FeltCmpPredicate &lhs, const ::llzk::boolean::FeltCmpPredicate &rhs)
Definition Enums.h.inc:110
static FailureOr< std::optional<::llzk::boolean::FeltCmpPredicate > > parse(ParserT &parser)
Definition Enums.h.inc:72
static FailureOr<::llzk::boolean::FeltCmpPredicate > parse(ParserT &parser)
Definition Enums.h.inc:51