/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ |* *| |* Enum Utility Declarations *| |* *| |* Automatically generated file, do not edit! *| |* From: IndexEnums.td *| |* *| \*===----------------------------------------------------------------------===*/ namespace mlir::index { // index comparison predicate kind enum class IndexCmpPredicate : uint32_t { EQ = 0, NE = 1, SLT = 2, SLE = 3, SGT = 4, SGE = 5, ULT = 6, ULE = 7, UGT = 8, UGE = 9, }; ::std::optional symbolizeIndexCmpPredicate(uint32_t); ::llvm::StringRef stringifyIndexCmpPredicate(IndexCmpPredicate); ::std::optional symbolizeIndexCmpPredicate(::llvm::StringRef); inline constexpr unsigned getMaxEnumValForIndexCmpPredicate() { return 9; } inline ::llvm::StringRef stringifyEnum(IndexCmpPredicate enumValue) { return stringifyIndexCmpPredicate(enumValue); } template ::std::optional symbolizeEnum(::llvm::StringRef); template <> inline ::std::optional symbolizeEnum(::llvm::StringRef str) { return symbolizeIndexCmpPredicate(str); } } // namespace mlir::index namespace mlir { template struct FieldParser; template<> struct FieldParser<::mlir::index::IndexCmpPredicate, ::mlir::index::IndexCmpPredicate> { template static FailureOr<::mlir::index::IndexCmpPredicate> parse(ParserT &parser) { // Parse the keyword/string containing the enum. std::string enumKeyword; auto loc = parser.getCurrentLocation(); if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) return parser.emitError(loc, "expected keyword for index comparison predicate kind"); // Symbolize the keyword. if (::std::optional<::mlir::index::IndexCmpPredicate> attr = ::mlir::index::symbolizeEnum<::mlir::index::IndexCmpPredicate>(enumKeyword)) return *attr; return parser.emitError(loc, "expected one of [eq, ne, slt, sle, sgt, sge, ult, ule, ugt, uge] for index comparison predicate kind, got: ") << enumKeyword; } }; /// Support for std::optional, useful in attribute/type definition where the enum is /// used as: /// /// let parameters = (ins OptionalParameter<"std::optional">:$value); template<> struct FieldParser, std::optional<::mlir::index::IndexCmpPredicate>> { template static FailureOr> parse(ParserT &parser) { // Parse the keyword/string containing the enum. std::string enumKeyword; auto loc = parser.getCurrentLocation(); if (failed(parser.parseOptionalKeywordOrString(&enumKeyword, {"eq", "ne", "slt", "sle", "sgt", "sge", "ult", "ule", "ugt", "uge"}))) return std::optional<::mlir::index::IndexCmpPredicate>{}; // Symbolize the keyword. if (::std::optional<::mlir::index::IndexCmpPredicate> attr = ::mlir::index::symbolizeEnum<::mlir::index::IndexCmpPredicate>(enumKeyword)) return attr; return parser.emitError(loc, "expected one of [eq, ne, slt, sle, sgt, sge, ult, ule, ugt, uge] for index comparison predicate kind, got: ") << enumKeyword; } }; } // namespace mlir namespace llvm { inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::index::IndexCmpPredicate value) { auto valueStr = stringifyEnum(value); return p << valueStr; } } // namespace llvm namespace llvm { template<> struct DenseMapInfo<::mlir::index::IndexCmpPredicate> { using StorageInfo = ::llvm::DenseMapInfo; static unsigned getHashValue(const ::mlir::index::IndexCmpPredicate &val) { return StorageInfo::getHashValue(static_cast(val)); } static bool isEqual(const ::mlir::index::IndexCmpPredicate &lhs, const ::mlir::index::IndexCmpPredicate &rhs) { return lhs == rhs; } }; }