14 #ifndef LLVM_ADT_DENSEMAPINFO_H
15 #define LLVM_ADT_DENSEMAPINFO_H
37 uintptr_t Val =
static_cast<uintptr_t
>(-1);
38 Val <<= PointerLikeTypeTraits<T*>::NumLowBitsAvailable;
39 return reinterpret_cast<T*
>(Val);
42 uintptr_t Val =
static_cast<uintptr_t
>(-2);
43 Val <<= PointerLikeTypeTraits<T*>::NumLowBitsAvailable;
44 return reinterpret_cast<T*
>(Val);
47 return (
unsigned((uintptr_t)PtrVal) >> 4) ^
50 static bool isEqual(
const T *LHS,
const T *RHS) {
return LHS == RHS; }
57 static unsigned getHashValue(
const char& Val) {
return Val * 37U; }
58 static bool isEqual(
const char &LHS,
const char &RHS) {
67 static unsigned getHashValue(
const unsigned& Val) {
return Val * 37U; }
68 static bool isEqual(
const unsigned& LHS,
const unsigned& RHS) {
78 return (
unsigned)(Val * 37UL);
80 static bool isEqual(
const unsigned long& LHS,
const unsigned long& RHS) {
87 static inline unsigned long long getEmptyKey() {
return ~0ULL; }
90 return (
unsigned)(Val * 37ULL);
92 static bool isEqual(
const unsigned long long& LHS,
93 const unsigned long long& RHS) {
102 static unsigned getHashValue(
const int& Val) {
return (
unsigned)(Val * 37U); }
103 static bool isEqual(
const int& LHS,
const int& RHS) {
111 return (1UL << (
sizeof(
long) * 8 - 1)) - 1UL;
115 return (
unsigned)(Val * 37UL);
117 static bool isEqual(
const long& LHS,
const long& RHS) {
124 static inline long long getEmptyKey() {
return 0x7fffffffffffffffLL; }
127 return (
unsigned)(Val * 37ULL);
130 const long long& RHS) {
136 template<
typename T,
typename U>
143 return std::make_pair(FirstInfo::getEmptyKey(),
144 SecondInfo::getEmptyKey());
147 return std::make_pair(FirstInfo::getTombstoneKey(),
148 SecondInfo::getTombstoneKey());
151 uint64_t key = (uint64_t)FirstInfo::getHashValue(PairVal.first) << 32
152 | (uint64_t)SecondInfo::getHashValue(PairVal.second);
161 return (
unsigned)key;
172 return StringRef(reinterpret_cast<const char *>(~static_cast<uintptr_t>(0)),
176 return StringRef(reinterpret_cast<const char *>(~static_cast<uintptr_t>(1)),
180 assert(Val.
data() != getEmptyKey().data() &&
"Cannot hash the empty key!");
181 assert(Val.
data() != getTombstoneKey().data() &&
182 "Cannot hash the tombstone key!");
186 if (RHS.
data() == getEmptyKey().data())
187 return LHS.
data() == getEmptyKey().data();
188 if (RHS.
data() == getTombstoneKey().data())
189 return LHS.
data() == getTombstoneKey().data();
197 return ArrayRef<T>(
reinterpret_cast<const T *
>(~static_cast<uintptr_t>(0)),
201 return ArrayRef<T>(
reinterpret_cast<const T *
>(~static_cast<uintptr_t>(1)),
205 assert(Val.
data() != getEmptyKey().data() &&
"Cannot hash the empty key!");
206 assert(Val.
data() != getTombstoneKey().data() &&
207 "Cannot hash the tombstone key!");
211 if (RHS.
data() == getEmptyKey().data())
212 return LHS.
data() == getEmptyKey().data();
213 if (RHS.
data() == getTombstoneKey().data())
214 return LHS.
data() == getTombstoneKey().data();
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)
static bool isEqual(StringRef LHS, StringRef RHS)
static ArrayRef< T > getEmptyKey()
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 getHashValue(StringRef Val)
static unsigned long long getEmptyKey()
static bool isEqual(const Function &Caller, const Function &Callee)
static long long getEmptyKey()
static bool isEqual(const unsigned &LHS, const unsigned &RHS)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
hash_code hash_value(const APFloat &Arg)
See friend declarations above.
static unsigned long getTombstoneKey()
static unsigned getHashValue(ArrayRef< T > Val)
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 StringRef getEmptyKey()
static unsigned getHashValue(const unsigned &Val)
static unsigned getTombstoneKey()
static ArrayRef< T > getTombstoneKey()
static int getTombstoneKey()
static StringRef getTombstoneKey()
static long long getTombstoneKey()
static bool isEqual(ArrayRef< T > LHS, ArrayRef< T > RHS)
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
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static Pair getTombstoneKey()
static unsigned long long getTombstoneKey()
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
StringRef - Represent a constant reference to a string, i.e.
static long getEmptyKey()
static Pair getEmptyKey()
static T * getTombstoneKey()