| 1 | /*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ |
| 2 | |* *| |
| 3 | |* Enum Utility Declarations *| |
| 4 | |* *| |
| 5 | |* Automatically generated file, do not edit! *| |
| 6 | |* From: TransformAttrs.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::transform { |
| 24 | |
| 25 | // Silenceable error propagation policy |
| 26 | enum class FailurePropagationMode : uint32_t { |
| 27 | Propagate = 1, |
| 28 | Suppress = 2, |
| 29 | }; |
| 30 | |
| 31 | ::std::optional<FailurePropagationMode> symbolizeFailurePropagationMode(uint32_t); |
| 32 | ::llvm::StringRef stringifyFailurePropagationMode(FailurePropagationMode); |
| 33 | ::std::optional<FailurePropagationMode> symbolizeFailurePropagationMode(::llvm::StringRef); |
| 34 | inline constexpr unsigned getMaxEnumValForFailurePropagationMode() { |
| 35 | return 2; |
| 36 | } |
| 37 | |
| 38 | |
| 39 | inline ::llvm::StringRef stringifyEnum(FailurePropagationMode enumValue) { |
| 40 | return stringifyFailurePropagationMode(enumValue); |
| 41 | } |
| 42 | |
| 43 | template <typename EnumType> |
| 44 | ::std::optional<EnumType> symbolizeEnum(::llvm::StringRef); |
| 45 | |
| 46 | template <> |
| 47 | inline ::std::optional<FailurePropagationMode> symbolizeEnum<FailurePropagationMode>(::llvm::StringRef str) { |
| 48 | return symbolizeFailurePropagationMode(str); |
| 49 | } |
| 50 | |
| 51 | class FailurePropagationModeAttr : public ::mlir::IntegerAttr { |
| 52 | public: |
| 53 | using ValueType = FailurePropagationMode; |
| 54 | using ::mlir::IntegerAttr::IntegerAttr; |
| 55 | static bool classof(::mlir::Attribute attr); |
| 56 | static FailurePropagationModeAttr get(::mlir::MLIRContext *context, FailurePropagationMode val); |
| 57 | FailurePropagationMode getValue() const; |
| 58 | }; |
| 59 | |
| 60 | } // namespace mlir::transform |
| 61 | |
| 62 | namespace mlir { |
| 63 | template<> |
| 64 | struct FieldParser<::mlir::transform::FailurePropagationMode, ::mlir::transform::FailurePropagationMode> { |
| 65 | static FailureOr<::mlir::transform::FailurePropagationMode> parse(AsmParser &parser); |
| 66 | }; |
| 67 | |
| 68 | /// Support for std::optional, useful in attribute/type definition where the enum is |
| 69 | /// used as: |
| 70 | /// |
| 71 | /// let parameters = (ins OptionalParameter<"std::optional<TheEnumName>">:$value); |
| 72 | template<> |
| 73 | struct FieldParser<std::optional<::mlir::transform::FailurePropagationMode>, std::optional<::mlir::transform::FailurePropagationMode>> { |
| 74 | static constexpr bool isKeyValueCompositional = false; |
| 75 | |
| 76 | static FailureOr<std::optional<::mlir::transform::FailurePropagationMode>> parse(AsmParser &parser); |
| 77 | }; |
| 78 | } // namespace mlir |
| 79 | |
| 80 | namespace llvm { |
| 81 | inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::transform::FailurePropagationMode value) { |
| 82 | auto valueStr = stringifyEnum(enumValue: value); |
| 83 | return p << valueStr; |
| 84 | } |
| 85 | } // namespace llvm |
| 86 | |
| 87 | namespace llvm { |
| 88 | template<> struct DenseMapInfo<::mlir::transform::FailurePropagationMode> { |
| 89 | using StorageInfo = ::llvm::DenseMapInfo<uint32_t>; |
| 90 | |
| 91 | static unsigned getHashValue(const ::mlir::transform::FailurePropagationMode &val) { |
| 92 | return StorageInfo::getHashValue(Val: static_cast<uint32_t>(val)); |
| 93 | } |
| 94 | |
| 95 | static bool isEqual(const ::mlir::transform::FailurePropagationMode &lhs, const ::mlir::transform::FailurePropagationMode &rhs) { |
| 96 | return lhs == rhs; |
| 97 | } |
| 98 | }; |
| 99 | } |
| 100 | |
| 101 | namespace mlir::transform { |
| 102 | |
| 103 | // allowed 32-bit signless integer cases: 0, 1, 2, 3, 4, 5 |
| 104 | enum class MatchCmpIPredicate : uint32_t { |
| 105 | eq = 0, |
| 106 | ne = 1, |
| 107 | lt = 2, |
| 108 | le = 3, |
| 109 | gt = 4, |
| 110 | ge = 5, |
| 111 | }; |
| 112 | |
| 113 | ::std::optional<MatchCmpIPredicate> symbolizeMatchCmpIPredicate(uint32_t); |
| 114 | ::llvm::StringRef stringifyMatchCmpIPredicate(MatchCmpIPredicate); |
| 115 | ::std::optional<MatchCmpIPredicate> symbolizeMatchCmpIPredicate(::llvm::StringRef); |
| 116 | inline constexpr unsigned getMaxEnumValForMatchCmpIPredicate() { |
| 117 | return 5; |
| 118 | } |
| 119 | |
| 120 | |
| 121 | inline ::llvm::StringRef stringifyEnum(MatchCmpIPredicate enumValue) { |
| 122 | return stringifyMatchCmpIPredicate(enumValue); |
| 123 | } |
| 124 | |
| 125 | template <typename EnumType> |
| 126 | ::std::optional<EnumType> symbolizeEnum(::llvm::StringRef); |
| 127 | |
| 128 | template <> |
| 129 | inline ::std::optional<MatchCmpIPredicate> symbolizeEnum<MatchCmpIPredicate>(::llvm::StringRef str) { |
| 130 | return symbolizeMatchCmpIPredicate(str); |
| 131 | } |
| 132 | |
| 133 | class MatchCmpIPredicateAttr : public ::mlir::IntegerAttr { |
| 134 | public: |
| 135 | using ValueType = MatchCmpIPredicate; |
| 136 | using ::mlir::IntegerAttr::IntegerAttr; |
| 137 | static bool classof(::mlir::Attribute attr); |
| 138 | static MatchCmpIPredicateAttr get(::mlir::MLIRContext *context, MatchCmpIPredicate val); |
| 139 | MatchCmpIPredicate getValue() const; |
| 140 | }; |
| 141 | |
| 142 | } // namespace mlir::transform |
| 143 | |
| 144 | namespace mlir { |
| 145 | template<> |
| 146 | struct FieldParser<::mlir::transform::MatchCmpIPredicate, ::mlir::transform::MatchCmpIPredicate> { |
| 147 | static FailureOr<::mlir::transform::MatchCmpIPredicate> parse(AsmParser &parser); |
| 148 | }; |
| 149 | |
| 150 | /// Support for std::optional, useful in attribute/type definition where the enum is |
| 151 | /// used as: |
| 152 | /// |
| 153 | /// let parameters = (ins OptionalParameter<"std::optional<TheEnumName>">:$value); |
| 154 | template<> |
| 155 | struct FieldParser<std::optional<::mlir::transform::MatchCmpIPredicate>, std::optional<::mlir::transform::MatchCmpIPredicate>> { |
| 156 | static constexpr bool isKeyValueCompositional = false; |
| 157 | |
| 158 | static FailureOr<std::optional<::mlir::transform::MatchCmpIPredicate>> parse(AsmParser &parser); |
| 159 | }; |
| 160 | } // namespace mlir |
| 161 | |
| 162 | namespace llvm { |
| 163 | inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::transform::MatchCmpIPredicate value) { |
| 164 | auto valueStr = stringifyEnum(enumValue: value); |
| 165 | return p << valueStr; |
| 166 | } |
| 167 | } // namespace llvm |
| 168 | |
| 169 | namespace llvm { |
| 170 | template<> struct DenseMapInfo<::mlir::transform::MatchCmpIPredicate> { |
| 171 | using StorageInfo = ::llvm::DenseMapInfo<uint32_t>; |
| 172 | |
| 173 | static unsigned getHashValue(const ::mlir::transform::MatchCmpIPredicate &val) { |
| 174 | return StorageInfo::getHashValue(Val: static_cast<uint32_t>(val)); |
| 175 | } |
| 176 | |
| 177 | static bool isEqual(const ::mlir::transform::MatchCmpIPredicate &lhs, const ::mlir::transform::MatchCmpIPredicate &rhs) { |
| 178 | return lhs == rhs; |
| 179 | } |
| 180 | }; |
| 181 | } |
| 182 | |
| 183 | |