14#ifndef LLVM_ADT_DENSEMAPINFO_H
15#define LLVM_ADT_DENSEMAPINFO_H
32 x *= 0xbf58476d1ce4e5b9u;
53template<
typename T,
typename Enable =
void>
74 uintptr_t Val =
static_cast<uintptr_t
>(-1);
76 return reinterpret_cast<T*
>(Val);
89 static unsigned getHashValue(
const char& Val) {
return Val * 37U; }
104 T,
std::enable_if_t<std::is_integral_v<T> && !std::is_same_v<T, char>>> {
105 static constexpr T getEmptyKey() {
return std::numeric_limits<T>::max(); }
108 if constexpr (std::is_unsigned_v<T> &&
sizeof(
T) >
sizeof(
unsigned))
111 return static_cast<unsigned>(Val *
112 static_cast<std::make_unsigned_t<T>
>(37U));
119template<
typename T,
typename U>
126 return {FirstInfo::getEmptyKey(), SecondInfo::getEmptyKey()};
131 SecondInfo::getHashValue(PairVal.second));
139 SecondInfo::getHashValue(Second));
143 return FirstInfo::isEqual(
LHS.first,
RHS.first) &&
144 SecondInfo::isEqual(
LHS.second,
RHS.second);
157 if constexpr (
I ==
sizeof...(Ts)) {
160 using EltType = std::tuple_element_t<I, Tuple>;
171 template <std::size_t... Is>
173 std::index_sequence<Is...>) {
175 std::get<Is>(lhs), std::get<Is>(rhs)) &&
180 return isEqualImpl(lhs, rhs, std::index_sequence_for<Ts...>{});
185template <
typename Enum>
199 constexpr Enum V =
static_cast<Enum
>(Info::getEmptyKey());
218 OptionalVal.has_value(),
219 Info::getHashValue(OptionalVal.value_or(Info::getEmptyKey())));
224 return Info::isEqual(
LHS.value(),
RHS.value());
static unsigned getHashValueImpl(SimpleValue Val)
static bool isEqualImpl(SimpleValue LHS, SimpleValue RHS)
unsigned combineHashValue(unsigned a, unsigned b)
Simplistic combination of 32-bit hash values into 32-bit hash values.
This is an optimization pass for GlobalISel generic memory operations.
@ First
Helpers to iterate all locations in the MemoryEffectsBase class.
Implement std::hash so that hash_code can be used in STL containers.
std::underlying_type_t< Enum > UnderlyingType
static bool isEqual(const Enum &LHS, const Enum &RHS)
DenseMapInfo< UnderlyingType > Info
static unsigned getHashValue(const Enum &Val)
static constexpr Enum getEmptyKey()
static unsigned getHashValue(const T &Val)
static bool isEqual(const T &LHS, const T &RHS)
static constexpr T getEmptyKey()
static constexpr uintptr_t Log2MaxAlign
static constexpr T * getEmptyKey()
static unsigned getHashValue(const T *PtrVal)
static bool isEqual(const T *LHS, const T *RHS)
static bool isEqual(const char &LHS, const char &RHS)
static constexpr char getEmptyKey()
static unsigned getHashValue(const char &Val)
static constexpr Optional getEmptyKey()
std::optional< T > Optional
static unsigned getHashValue(const Optional &OptionalVal)
static bool isEqual(const Optional &LHS, const Optional &RHS)
static unsigned getHashValuePiecewise(const T &First, const U &Second)
static constexpr Pair getEmptyKey()
static unsigned getHashValue(const Pair &PairVal)
DenseMapInfo< T > FirstInfo
DenseMapInfo< U > SecondInfo
static bool isEqual(const Pair &LHS, const Pair &RHS)
std::tuple< Ts... > Tuple
static bool isEqualImpl(const Tuple &lhs, const Tuple &rhs, std::index_sequence< Is... >)
static unsigned getHashValue(const std::tuple< Ts... > &values)
static bool isEqual(const Tuple &lhs, const Tuple &rhs)
static constexpr Tuple getEmptyKey()
static unsigned getHashValueImpl(const Tuple &values)
An information struct used to provide DenseMap with the various necessary components for a given valu...