14 #ifndef LLVM_ADT_DENSEMAPINFO_H
15 #define LLVM_ADT_DENSEMAPINFO_H
34 uintptr_t Val =
static_cast<uintptr_t
>(-1);
35 Val <<= PointerLikeTypeTraits<T*>::NumLowBitsAvailable;
36 return reinterpret_cast<T*
>(Val);
39 uintptr_t Val =
static_cast<uintptr_t
>(-2);
40 Val <<= PointerLikeTypeTraits<T*>::NumLowBitsAvailable;
41 return reinterpret_cast<T*
>(Val);
44 return (
unsigned((uintptr_t)PtrVal) >> 4) ^
47 static bool isEqual(
const T *LHS,
const T *RHS) {
return LHS == RHS; }
54 static unsigned getHashValue(
const char& Val) {
return Val * 37U; }
55 static bool isEqual(
const char &LHS,
const char &RHS) {
64 static unsigned getHashValue(
const unsigned& Val) {
return Val * 37U; }
65 static bool isEqual(
const unsigned& LHS,
const unsigned& RHS) {
75 return (
unsigned)(Val * 37UL);
77 static bool isEqual(
const unsigned long& LHS,
const unsigned long& RHS) {
84 static inline unsigned long long getEmptyKey() {
return ~0ULL; }
87 return (
unsigned)(Val * 37ULL);
89 static bool isEqual(
const unsigned long long& LHS,
90 const unsigned long long& RHS) {
99 static unsigned getHashValue(
const int& Val) {
return (
unsigned)(Val * 37U); }
100 static bool isEqual(
const int& LHS,
const int& RHS) {
108 return (1UL << (
sizeof(
long) * 8 - 1)) - 1UL;
112 return (
unsigned)(Val * 37UL);
114 static bool isEqual(
const long& LHS,
const long& RHS) {
121 static inline long long getEmptyKey() {
return 0x7fffffffffffffffLL; }
124 return (
unsigned)(Val * 37ULL);
127 const long long& RHS) {
133 template<
typename T,
typename U>
140 return std::make_pair(FirstInfo::getEmptyKey(),
141 SecondInfo::getEmptyKey());
144 return std::make_pair(FirstInfo::getTombstoneKey(),
145 SecondInfo::getTombstoneKey());
148 uint64_t key = (uint64_t)FirstInfo::getHashValue(PairVal.first) << 32
149 | (uint64_t)SecondInfo::getHashValue(PairVal.second);
158 return (
unsigned)key;
161 return FirstInfo::isEqual(LHS.first, RHS.first) &&
162 SecondInfo::isEqual(LHS.second, RHS.second);
static bool isEqual(const char &LHS, const char &RHS)
static unsigned getHashValue(const unsigned long &Val)
static unsigned long getEmptyKey()
static unsigned getHashValue(const unsigned long long &Val)
static bool isEqual(const T *LHS, const T *RHS)
DenseMapInfo< T > FirstInfo
static unsigned getHashValue(const long &Val)
static unsigned getEmptyKey()
static unsigned getHashValue(const long long &Val)
static bool isEqual(const unsigned long long &LHS, const unsigned long long &RHS)
static bool isEqual(const long long &LHS, const long long &RHS)
static bool isEqual(const int &LHS, const int &RHS)
static char getEmptyKey()
static bool isEqual(const Pair &LHS, const Pair &RHS)
static unsigned long long getEmptyKey()
static long long getEmptyKey()
static bool isEqual(const unsigned &LHS, const unsigned &RHS)
static unsigned long getTombstoneKey()
static char getTombstoneKey()
static bool isEqual(const unsigned long &LHS, const unsigned long &RHS)
static long getTombstoneKey()
static bool isEqual(const long &LHS, const long &RHS)
static unsigned getHashValue(const unsigned &Val)
static unsigned getTombstoneKey()
static int getTombstoneKey()
static long long getTombstoneKey()
static unsigned getHashValue(const int &Val)
static unsigned getHashValue(const T *PtrVal)
static unsigned getHashValue(const Pair &PairVal)
static unsigned getHashValue(const char &Val)
DenseMapInfo< U > SecondInfo
static Pair getTombstoneKey()
static unsigned long long getTombstoneKey()
static long getEmptyKey()
static Pair getEmptyKey()
static T * getTombstoneKey()