Files
gps/tools/local/circt/include/mlir/Dialect/EmitC/IR/EmitCEnums.h.inc
T
2026-07-12 11:01:51 +03:00

222 lines
7.8 KiB
C++

/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
|* *|
|* Enum Utility Declarations *|
|* *|
|* Automatically generated file, do not edit! *|
|* From: EmitCAttributes.td *|
|* *|
\*===----------------------------------------------------------------------===*/
namespace mlir::emitc {
// C++ aggregate type keyword
enum class ClassType : uint32_t {
class_ = 0,
struct_ = 1,
union_ = 2,
};
::std::optional<ClassType> symbolizeClassType(uint32_t);
::llvm::StringRef stringifyClassType(ClassType);
::std::optional<ClassType> symbolizeClassType(::llvm::StringRef);
inline constexpr unsigned getMaxEnumValForClassType() {
return 2;
}
inline ::llvm::StringRef stringifyEnum(ClassType enumValue) {
return stringifyClassType(enumValue);
}
template <typename EnumType>
::std::optional<EnumType> symbolizeEnum(::llvm::StringRef);
template <>
inline ::std::optional<ClassType> symbolizeEnum<ClassType>(::llvm::StringRef str) {
return symbolizeClassType(str);
}
class ClassTypeAttr : public ::mlir::IntegerAttr {
public:
using ValueType = ClassType;
using ::mlir::IntegerAttr::IntegerAttr;
static bool classof(::mlir::Attribute attr);
static ClassTypeAttr get(::mlir::MLIRContext *context, ClassType val);
ClassType getValue() const;
};
} // namespace mlir::emitc
namespace mlir {
template <typename T, typename>
struct FieldParser;
template<>
struct FieldParser<::mlir::emitc::ClassType, ::mlir::emitc::ClassType> {
template <typename ParserT>
static FailureOr<::mlir::emitc::ClassType> 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 C++ aggregate type keyword");
// Symbolize the keyword.
if (::std::optional<::mlir::emitc::ClassType> attr = ::mlir::emitc::symbolizeEnum<::mlir::emitc::ClassType>(enumKeyword))
return *attr;
return parser.emitError(loc, "expected one of [class, struct, union] for C++ aggregate type keyword, got: ") << enumKeyword;
}
};
/// Support for std::optional, useful in attribute/type definition where the enum is
/// used as:
///
/// let parameters = (ins OptionalParameter<"std::optional<TheEnumName>">:$value);
template<>
struct FieldParser<std::optional<::mlir::emitc::ClassType>, std::optional<::mlir::emitc::ClassType>> {
template <typename ParserT>
static FailureOr<std::optional<::mlir::emitc::ClassType>> parse(ParserT &parser) {
// Parse the keyword/string containing the enum.
std::string enumKeyword;
auto loc = parser.getCurrentLocation();
if (failed(parser.parseOptionalKeywordOrString(&enumKeyword, {"class", "struct", "union"})))
return std::optional<::mlir::emitc::ClassType>{};
// Symbolize the keyword.
if (::std::optional<::mlir::emitc::ClassType> attr = ::mlir::emitc::symbolizeEnum<::mlir::emitc::ClassType>(enumKeyword))
return attr;
return parser.emitError(loc, "expected one of [class, struct, union] for C++ aggregate type keyword, got: ") << enumKeyword;
}
};
} // namespace mlir
namespace llvm {
inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::emitc::ClassType value) {
auto valueStr = stringifyEnum(value);
return p << valueStr;
}
} // namespace llvm
namespace llvm {
template<> struct DenseMapInfo<::mlir::emitc::ClassType> {
using StorageInfo = ::llvm::DenseMapInfo<uint32_t>;
static unsigned getHashValue(const ::mlir::emitc::ClassType &val) {
return StorageInfo::getHashValue(static_cast<uint32_t>(val));
}
static bool isEqual(const ::mlir::emitc::ClassType &lhs, const ::mlir::emitc::ClassType &rhs) {
return lhs == rhs;
}
};
}
namespace mlir::emitc {
// allowed 64-bit signless integer cases: 0, 1, 2, 3, 4, 5, 6
enum class CmpPredicate : uint64_t {
eq = 0,
ne = 1,
lt = 2,
le = 3,
gt = 4,
ge = 5,
three_way = 6,
};
::std::optional<CmpPredicate> symbolizeCmpPredicate(uint64_t);
::llvm::StringRef stringifyCmpPredicate(CmpPredicate);
::std::optional<CmpPredicate> symbolizeCmpPredicate(::llvm::StringRef);
inline constexpr unsigned getMaxEnumValForCmpPredicate() {
return 6;
}
inline ::llvm::StringRef stringifyEnum(CmpPredicate enumValue) {
return stringifyCmpPredicate(enumValue);
}
template <typename EnumType>
::std::optional<EnumType> symbolizeEnum(::llvm::StringRef);
template <>
inline ::std::optional<CmpPredicate> symbolizeEnum<CmpPredicate>(::llvm::StringRef str) {
return symbolizeCmpPredicate(str);
}
class CmpPredicateAttr : public ::mlir::IntegerAttr {
public:
using ValueType = CmpPredicate;
using ::mlir::IntegerAttr::IntegerAttr;
static bool classof(::mlir::Attribute attr);
static CmpPredicateAttr get(::mlir::MLIRContext *context, CmpPredicate val);
CmpPredicate getValue() const;
};
} // namespace mlir::emitc
namespace mlir {
template <typename T, typename>
struct FieldParser;
template<>
struct FieldParser<::mlir::emitc::CmpPredicate, ::mlir::emitc::CmpPredicate> {
template <typename ParserT>
static FailureOr<::mlir::emitc::CmpPredicate> 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 allowed 64-bit signless integer cases: 0, 1, 2, 3, 4, 5, 6");
// Symbolize the keyword.
if (::std::optional<::mlir::emitc::CmpPredicate> attr = ::mlir::emitc::symbolizeEnum<::mlir::emitc::CmpPredicate>(enumKeyword))
return *attr;
return parser.emitError(loc, "expected one of [eq, ne, lt, le, gt, ge, three_way] for allowed 64-bit signless integer cases: 0, 1, 2, 3, 4, 5, 6, got: ") << enumKeyword;
}
};
/// Support for std::optional, useful in attribute/type definition where the enum is
/// used as:
///
/// let parameters = (ins OptionalParameter<"std::optional<TheEnumName>">:$value);
template<>
struct FieldParser<std::optional<::mlir::emitc::CmpPredicate>, std::optional<::mlir::emitc::CmpPredicate>> {
template <typename ParserT>
static FailureOr<std::optional<::mlir::emitc::CmpPredicate>> parse(ParserT &parser) {
// Parse the keyword/string containing the enum.
std::string enumKeyword;
auto loc = parser.getCurrentLocation();
if (failed(parser.parseOptionalKeywordOrString(&enumKeyword, {"eq", "ne", "lt", "le", "gt", "ge", "three_way"})))
return std::optional<::mlir::emitc::CmpPredicate>{};
// Symbolize the keyword.
if (::std::optional<::mlir::emitc::CmpPredicate> attr = ::mlir::emitc::symbolizeEnum<::mlir::emitc::CmpPredicate>(enumKeyword))
return attr;
return parser.emitError(loc, "expected one of [eq, ne, lt, le, gt, ge, three_way] for allowed 64-bit signless integer cases: 0, 1, 2, 3, 4, 5, 6, got: ") << enumKeyword;
}
};
} // namespace mlir
namespace llvm {
inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::emitc::CmpPredicate value) {
auto valueStr = stringifyEnum(value);
return p << valueStr;
}
} // namespace llvm
namespace llvm {
template<> struct DenseMapInfo<::mlir::emitc::CmpPredicate> {
using StorageInfo = ::llvm::DenseMapInfo<uint64_t>;
static unsigned getHashValue(const ::mlir::emitc::CmpPredicate &val) {
return StorageInfo::getHashValue(static_cast<uint64_t>(val));
}
static bool isEqual(const ::mlir::emitc::CmpPredicate &lhs, const ::mlir::emitc::CmpPredicate &rhs) {
return lhs == rhs;
}
};
}