14#ifndef LLVM_ADT_DENSEMAPINFO_H
15#define LLVM_ADT_DENSEMAPINFO_H
26namespace densemap::detail {
30 x *= 0xbf58476d1ce4e5b9u;
51template<
typename T,
typename Enable =
void>
70 static constexpr uintptr_t Log2MaxAlign = 12;
73 uintptr_t Val =
static_cast<uintptr_t
>(-1);
75 return reinterpret_cast<T*
>(Val);
79 uintptr_t Val =
static_cast<uintptr_t
>(-2);
81 return reinterpret_cast<T*
>(Val);
85 return (
unsigned((uintptr_t)PtrVal) >> 4) ^
96 static unsigned getHashValue(
const char& Val) {
return Val * 37U; }
107 static unsigned getHashValue(
const unsigned char &Val) {
return Val * 37U; }
118 static unsigned getHashValue(
const unsigned short &Val) {
return Val * 37U; }
129 static unsigned getHashValue(
const unsigned& Val) {
return Val * 37U; }
142 if constexpr (
sizeof(Val) == 4)
163 const unsigned long long&
RHS) {
180 static unsigned getHashValue(
const int& Val) {
return (
unsigned)(Val * 37U); }
190 return (1UL << (
sizeof(
long) * 8 - 1)) - 1UL;
196 return (
unsigned)(Val * 37UL);
206 static inline long long getEmptyKey() {
return 0x7fffffffffffffffLL; }
210 return (
unsigned)(Val * 37ULL);
214 const long long&
RHS) {
220template<
typename T,
typename U>
227 return std::make_pair(FirstInfo::getEmptyKey(),
228 SecondInfo::getEmptyKey());
232 return std::make_pair(FirstInfo::getTombstoneKey(),
233 SecondInfo::getTombstoneKey());
238 SecondInfo::getHashValue(PairVal.second));
246 SecondInfo::getHashValue(Second));
250 return FirstInfo::isEqual(
LHS.first,
RHS.first) &&
251 SecondInfo::isEqual(
LHS.second,
RHS.second);
267 template <
unsigned I>
269 using EltType = std::tuple_element_t<I, Tuple>;
270 std::integral_constant<
bool,
I + 1 ==
sizeof...(Ts)> atEnd;
273 getHashValueImpl<I + 1>(
values, atEnd));
276 template <
unsigned I>
282 std::integral_constant<
bool, 0 ==
sizeof...(Ts)> atEnd;
283 return getHashValueImpl<0>(
values, atEnd);
286 template <
unsigned I>
288 using EltType = std::tuple_element_t<I, Tuple>;
289 std::integral_constant<
bool,
I + 1 ==
sizeof...(Ts)> atEnd;
291 isEqualImpl<I + 1>(lhs, rhs, atEnd);
294 template <
unsigned I>
300 std::integral_constant<
bool, 0 ==
sizeof...(Ts)> atEnd;
301 return isEqualImpl<0>(lhs, rhs, atEnd);
306template <
typename Enum>
311 static Enum
getEmptyKey() {
return static_cast<Enum
>(Info::getEmptyKey()); }
314 return static_cast<Enum
>(Info::getTombstoneKey());
Mark the given Function as meaning that it cannot be changed in any way mark any values that are used as this function s parameters or by its return values(according to Uses) live as well. void DeadArgumentEliminationPass
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.
static Enum getTombstoneKey()
std::underlying_type_t< Enum > UnderlyingType
static bool isEqual(const Enum &LHS, const Enum &RHS)
static unsigned getHashValue(const Enum &Val)
static Enum getEmptyKey()
static unsigned getHashValue(const T *PtrVal)
static T * getTombstoneKey()
static bool isEqual(const T *LHS, const T *RHS)
static bool isEqual(const char &LHS, const char &RHS)
static char getEmptyKey()
static unsigned getHashValue(const char &Val)
static char getTombstoneKey()
static int getTombstoneKey()
static bool isEqual(const int &LHS, const int &RHS)
static unsigned getHashValue(const int &Val)
static bool isEqual(const long &LHS, const long &RHS)
static long getEmptyKey()
static long getTombstoneKey()
static unsigned getHashValue(const long &Val)
static unsigned getHashValue(const long long &Val)
static bool isEqual(const long long &LHS, const long long &RHS)
static long long getEmptyKey()
static long long getTombstoneKey()
static bool isEqual(const short &LHS, const short &RHS)
static unsigned getHashValue(const short &Val)
static short getTombstoneKey()
static short getEmptyKey()
static unsigned getHashValuePiecewise(const T &First, const U &Second)
static Pair getEmptyKey()
static unsigned getHashValue(const Pair &PairVal)
static Pair getTombstoneKey()
static bool isEqual(const Pair &LHS, const Pair &RHS)
std::tuple< Ts... > Tuple
static unsigned getHashValueImpl(const Tuple &values, std::false_type)
static bool isEqualImpl(const Tuple &lhs, const Tuple &rhs, std::false_type)
static unsigned getHashValue(const std::tuple< Ts... > &values)
static Tuple getTombstoneKey()
static bool isEqualImpl(const Tuple &, const Tuple &, std::true_type)
static bool isEqual(const Tuple &lhs, const Tuple &rhs)
static unsigned getHashValueImpl(const Tuple &, std::true_type)
static Tuple getEmptyKey()
static bool isEqual(const unsigned &LHS, const unsigned &RHS)
static unsigned getTombstoneKey()
static unsigned getEmptyKey()
static unsigned getHashValue(const unsigned &Val)
static bool isEqual(const unsigned char &LHS, const unsigned char &RHS)
static unsigned char getTombstoneKey()
static unsigned getHashValue(const unsigned char &Val)
static unsigned char getEmptyKey()
static bool isEqual(const unsigned long &LHS, const unsigned long &RHS)
static unsigned long getEmptyKey()
static unsigned getHashValue(const unsigned long &Val)
static unsigned long getTombstoneKey()
static unsigned long long getTombstoneKey()
static bool isEqual(const unsigned long long &LHS, const unsigned long long &RHS)
static unsigned long long getEmptyKey()
static unsigned getHashValue(const unsigned long long &Val)
static unsigned getHashValue(const unsigned short &Val)
static unsigned short getTombstoneKey()
static bool isEqual(const unsigned short &LHS, const unsigned short &RHS)
static unsigned short getEmptyKey()
An information struct used to provide DenseMap with the various necessary components for a given valu...