9#ifndef LLVM_ADT_BITMASKENUM_H
10#define LLVM_ADT_BITMASKENUM_H
42#define LLVM_MARK_AS_BITMASK_ENUM(LargestValue) \
43 LLVM_BITMASK_LARGEST_ENUMERATOR = LargestValue
66#define LLVM_DECLARE_ENUM_AS_BITMASK(Enum, LargestValue) \
67 template <> struct is_bitmask_enum<Enum> : std::true_type {}; \
68 template <> struct largest_bitmask_enum_bit<Enum> { \
69 static constexpr std::underlying_type_t<Enum> value = LargestValue; \
83#define LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE() \
84 using ::llvm::BitmaskEnumDetail::operator~; \
85 using ::llvm::BitmaskEnumDetail::operator|; \
86 using ::llvm::BitmaskEnumDetail::operator&; \
87 using ::llvm::BitmaskEnumDetail::operator^; \
88 using ::llvm::BitmaskEnumDetail::operator<<; \
89 using ::llvm::BitmaskEnumDetail::operator>>; \
90 using ::llvm::BitmaskEnumDetail::operator|=; \
91 using ::llvm::BitmaskEnumDetail::operator&=; \
92 using ::llvm::BitmaskEnumDetail::operator^=; \
93 using ::llvm::BitmaskEnumDetail::operator<<=; \
94 using ::llvm::BitmaskEnumDetail::operator>>=; \
96 using ::llvm::BitmaskEnumDetail::any
102template <
typename E,
typename Enable =
void>
107 E,
std::enable_if_t<sizeof(E::LLVM_BITMASK_LARGEST_ENUMERATOR) >= 0>>
115 E,
std::enable_if_t<sizeof(E::LLVM_BITMASK_LARGEST_ENUMERATOR) >= 0>> {
118 static_cast<UnderlyingTy>(E::LLVM_BITMASK_LARGEST_ENUMERATOR);
121namespace BitmaskEnumDetail {
125template <
typename E>
constexpr std::underlying_type_t<E>
Mask() {
133template <
typename E>
constexpr std::underlying_type_t<E>
Underlying(
E Val) {
135 assert(U >= 0 &&
"Negative enum values are not allowed.");
136 assert(U <= Mask<E>() &&
"Enum value too large (or largest val too small?)");
144template <typename E, typename = std::enable_if_t<is_bitmask_enum<E>::value>>
146 return Val !=
static_cast<E>(0);
149template <typename E, typename = std::enable_if_t<is_bitmask_enum<E>::value>>
151 return static_cast<E>(~Underlying(Val) & Mask<E>());
154template <typename E, typename = std::enable_if_t<is_bitmask_enum<E>::value>>
159template <typename E, typename = std::enable_if_t<is_bitmask_enum<E>::value>>
164template <typename E, typename = std::enable_if_t<is_bitmask_enum<E>::value>>
169template <typename E, typename = std::enable_if_t<is_bitmask_enum<E>::value>>
174template <typename E, typename = std::enable_if_t<is_bitmask_enum<E>::value>>
182template <typename E, typename = std::enable_if_t<is_bitmask_enum<E>::value>>
188template <typename E, typename = std::enable_if_t<is_bitmask_enum<E>::value>>
194template <typename E, typename = std::enable_if_t<is_bitmask_enum<E>::value>>
200template <typename e, typename = std::enable_if_t<is_bitmask_enum<e>::value>>
206template <typename e, typename = std::enable_if_t<is_bitmask_enum<e>::value>>
216template <typename E, typename = std::enable_if_t<is_bitmask_enum<E>::value>>
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
Given that RA is a live value
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file contains library features backported from future STL versions.
LLVM Value Representation.
e & operator>>=(e &lhs, e rhs)
constexpr E operator>>(E LHS, E RHS)
constexpr E operator^(E LHS, E RHS)
constexpr bool any(E Val)
constexpr E operator~(E Val)
constexpr unsigned bitWidth(uint64_t Value)
constexpr std::underlying_type_t< E > Underlying(E Val)
Check that Val is in range for E, and return Val cast to E's underlying type.
constexpr std::underlying_type_t< E > Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
E & operator^=(E &LHS, E RHS)
E & operator&=(E &LHS, E RHS)
constexpr E operator&(E LHS, E RHS)
e & operator<<=(e &lhs, e rhs)
constexpr E operator<<(E LHS, E RHS)
E & operator|=(E &LHS, E RHS)
constexpr E operator|(E LHS, E RHS)
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE()
constexpr std::underlying_type_t< Enum > to_underlying(Enum E)
Returns underlying integer value of an enum.
constexpr unsigned BitWidth
constexpr uint64_t NextPowerOf2(uint64_t A)
Returns the next power of two (in 64-bits) that is strictly greater than A.
Implement std::hash so that hash_code can be used in STL containers.
Traits class to determine whether an enum has a LLVM_BITMASK_LARGEST_ENUMERATOR enumerator.
std::underlying_type_t< E > UnderlyingTy
Trait class to determine bitmask enumeration largest bit.