| 1 | /*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ |
| 2 | |* *| |
| 3 | |* Enum Utility Declarations *| |
| 4 | |* *| |
| 5 | |* Automatically generated file, do not edit! *| |
| 6 | |* From: SMT.td *| |
| 7 | |* *| |
| 8 | \*===----------------------------------------------------------------------===*/ |
| 9 | |
| 10 | #include "llvm/ADT/DenseMapInfo.h" |
| 11 | #include "llvm/ADT/StringRef.h" |
| 12 | #include "llvm/Support/raw_ostream.h" |
| 13 | #include "mlir/IR/BuiltinAttributes.h" |
| 14 | #include "mlir/Support/LLVM.h" |
| 15 | |
| 16 | |
| 17 | namespace mlir { |
| 18 | class AsmParser; |
| 19 | |
| 20 | template <typename T, typename> |
| 21 | struct FieldParser; |
| 22 | } // namespace mlir |
| 23 | namespace mlir::smt { |
| 24 | |
| 25 | // smt bit-vector comparison predicate |
| 26 | enum class BVCmpPredicate : uint64_t { |
| 27 | slt = 0, |
| 28 | sle = 1, |
| 29 | sgt = 2, |
| 30 | sge = 3, |
| 31 | ult = 4, |
| 32 | ule = 5, |
| 33 | ugt = 6, |
| 34 | uge = 7, |
| 35 | }; |
| 36 | |
| 37 | ::std::optional<BVCmpPredicate> symbolizeBVCmpPredicate(uint64_t); |
| 38 | ::llvm::StringRef stringifyBVCmpPredicate(BVCmpPredicate); |
| 39 | ::std::optional<BVCmpPredicate> symbolizeBVCmpPredicate(::llvm::StringRef); |
| 40 | inline constexpr unsigned getMaxEnumValForBVCmpPredicate() { |
| 41 | return 7; |
| 42 | } |
| 43 | |
| 44 | |
| 45 | inline ::llvm::StringRef stringifyEnum(BVCmpPredicate enumValue) { |
| 46 | return stringifyBVCmpPredicate(enumValue); |
| 47 | } |
| 48 | |
| 49 | template <typename EnumType> |
| 50 | ::std::optional<EnumType> symbolizeEnum(::llvm::StringRef); |
| 51 | |
| 52 | template <> |
| 53 | inline ::std::optional<BVCmpPredicate> symbolizeEnum<BVCmpPredicate>(::llvm::StringRef str) { |
| 54 | return symbolizeBVCmpPredicate(str); |
| 55 | } |
| 56 | |
| 57 | class BVCmpPredicateAttr : public ::mlir::IntegerAttr { |
| 58 | public: |
| 59 | using ValueType = BVCmpPredicate; |
| 60 | using ::mlir::IntegerAttr::IntegerAttr; |
| 61 | static bool classof(::mlir::Attribute attr); |
| 62 | static BVCmpPredicateAttr get(::mlir::MLIRContext *context, BVCmpPredicate val); |
| 63 | BVCmpPredicate getValue() const; |
| 64 | }; |
| 65 | |
| 66 | } // namespace mlir::smt |
| 67 | |
| 68 | namespace mlir { |
| 69 | template<> |
| 70 | struct FieldParser<mlir::smt::BVCmpPredicate, mlir::smt::BVCmpPredicate> { |
| 71 | static FailureOr<mlir::smt::BVCmpPredicate> parse(AsmParser &parser); |
| 72 | }; |
| 73 | |
| 74 | /// Support for std::optional, useful in attribute/type definition where the enum is |
| 75 | /// used as: |
| 76 | /// |
| 77 | /// let parameters = (ins OptionalParameter<"std::optional<TheEnumName>">:$value); |
| 78 | template<> |
| 79 | struct FieldParser<std::optional<mlir::smt::BVCmpPredicate>, std::optional<mlir::smt::BVCmpPredicate>> { |
| 80 | static constexpr bool isKeyValueCompositional = false; |
| 81 | |
| 82 | static FailureOr<std::optional<mlir::smt::BVCmpPredicate>> parse(AsmParser &parser); |
| 83 | }; |
| 84 | } // namespace mlir |
| 85 | |
| 86 | namespace llvm { |
| 87 | inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, mlir::smt::BVCmpPredicate value) { |
| 88 | auto valueStr = stringifyEnum(enumValue: value); |
| 89 | return p << valueStr; |
| 90 | } |
| 91 | } // namespace llvm |
| 92 | |
| 93 | namespace llvm { |
| 94 | template<> struct DenseMapInfo<mlir::smt::BVCmpPredicate> { |
| 95 | using StorageInfo = ::llvm::DenseMapInfo<uint64_t>; |
| 96 | |
| 97 | static unsigned getHashValue(const mlir::smt::BVCmpPredicate &val) { |
| 98 | return StorageInfo::getHashValue(Val: static_cast<uint64_t>(val)); |
| 99 | } |
| 100 | |
| 101 | static bool isEqual(const mlir::smt::BVCmpPredicate &lhs, const mlir::smt::BVCmpPredicate &rhs) { |
| 102 | return lhs == rhs; |
| 103 | } |
| 104 | }; |
| 105 | } |
| 106 | |
| 107 | namespace mlir::smt { |
| 108 | |
| 109 | // smt comparison predicate for integers |
| 110 | enum class IntPredicate : uint64_t { |
| 111 | lt = 0, |
| 112 | le = 1, |
| 113 | gt = 2, |
| 114 | ge = 3, |
| 115 | }; |
| 116 | |
| 117 | ::std::optional<IntPredicate> symbolizeIntPredicate(uint64_t); |
| 118 | ::llvm::StringRef stringifyIntPredicate(IntPredicate); |
| 119 | ::std::optional<IntPredicate> symbolizeIntPredicate(::llvm::StringRef); |
| 120 | inline constexpr unsigned getMaxEnumValForIntPredicate() { |
| 121 | return 3; |
| 122 | } |
| 123 | |
| 124 | |
| 125 | inline ::llvm::StringRef stringifyEnum(IntPredicate enumValue) { |
| 126 | return stringifyIntPredicate(enumValue); |
| 127 | } |
| 128 | |
| 129 | template <typename EnumType> |
| 130 | ::std::optional<EnumType> symbolizeEnum(::llvm::StringRef); |
| 131 | |
| 132 | template <> |
| 133 | inline ::std::optional<IntPredicate> symbolizeEnum<IntPredicate>(::llvm::StringRef str) { |
| 134 | return symbolizeIntPredicate(str); |
| 135 | } |
| 136 | |
| 137 | class IntPredicateAttr : public ::mlir::IntegerAttr { |
| 138 | public: |
| 139 | using ValueType = IntPredicate; |
| 140 | using ::mlir::IntegerAttr::IntegerAttr; |
| 141 | static bool classof(::mlir::Attribute attr); |
| 142 | static IntPredicateAttr get(::mlir::MLIRContext *context, IntPredicate val); |
| 143 | IntPredicate getValue() const; |
| 144 | }; |
| 145 | |
| 146 | } // namespace mlir::smt |
| 147 | |
| 148 | namespace mlir { |
| 149 | template<> |
| 150 | struct FieldParser<mlir::smt::IntPredicate, mlir::smt::IntPredicate> { |
| 151 | static FailureOr<mlir::smt::IntPredicate> parse(AsmParser &parser); |
| 152 | }; |
| 153 | |
| 154 | /// Support for std::optional, useful in attribute/type definition where the enum is |
| 155 | /// used as: |
| 156 | /// |
| 157 | /// let parameters = (ins OptionalParameter<"std::optional<TheEnumName>">:$value); |
| 158 | template<> |
| 159 | struct FieldParser<std::optional<mlir::smt::IntPredicate>, std::optional<mlir::smt::IntPredicate>> { |
| 160 | static constexpr bool isKeyValueCompositional = false; |
| 161 | |
| 162 | static FailureOr<std::optional<mlir::smt::IntPredicate>> parse(AsmParser &parser); |
| 163 | }; |
| 164 | } // namespace mlir |
| 165 | |
| 166 | namespace llvm { |
| 167 | inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, mlir::smt::IntPredicate value) { |
| 168 | auto valueStr = stringifyEnum(enumValue: value); |
| 169 | return p << valueStr; |
| 170 | } |
| 171 | } // namespace llvm |
| 172 | |
| 173 | namespace llvm { |
| 174 | template<> struct DenseMapInfo<mlir::smt::IntPredicate> { |
| 175 | using StorageInfo = ::llvm::DenseMapInfo<uint64_t>; |
| 176 | |
| 177 | static unsigned getHashValue(const mlir::smt::IntPredicate &val) { |
| 178 | return StorageInfo::getHashValue(Val: static_cast<uint64_t>(val)); |
| 179 | } |
| 180 | |
| 181 | static bool isEqual(const mlir::smt::IntPredicate &lhs, const mlir::smt::IntPredicate &rhs) { |
| 182 | return lhs == rhs; |
| 183 | } |
| 184 | }; |
| 185 | } |
| 186 | |
| 187 | |