13 #ifndef LLVM_ADT_DENSEMAPINFO_H 14 #define LLVM_ADT_DENSEMAPINFO_H 40 uintptr_t Val =
static_cast<uintptr_t
>(-1);
41 Val <<= PointerLikeTypeTraits<T*>::NumLowBitsAvailable;
42 return reinterpret_cast<T*
>(Val);
46 uintptr_t Val =
static_cast<uintptr_t
>(-2);
47 Val <<= PointerLikeTypeTraits<T*>::NumLowBitsAvailable;
48 return reinterpret_cast<T*
>(Val);
52 return (
unsigned((uintptr_t)PtrVal) >> 4) ^
56 static bool isEqual(
const T *LHS,
const T *RHS) {
return LHS == RHS; }
63 static unsigned getHashValue(
const char& Val) {
return Val * 37U; }
65 static bool isEqual(
const char &LHS,
const char &RHS) {
74 static unsigned getHashValue(
const unsigned char &Val) {
return Val * 37U; }
76 static bool isEqual(
const unsigned char &LHS,
const unsigned char &RHS) {
85 static unsigned getHashValue(
const unsigned short &Val) {
return Val * 37U; }
87 static bool isEqual(
const unsigned short &LHS,
const unsigned short &RHS) {
96 static unsigned getHashValue(
const unsigned& Val) {
return Val * 37U; }
98 static bool isEqual(
const unsigned& LHS,
const unsigned& RHS) {
109 return (
unsigned)(Val * 37UL);
112 static bool isEqual(
const unsigned long& LHS,
const unsigned long& RHS) {
123 return (
unsigned)(Val * 37ULL);
126 static bool isEqual(
const unsigned long long& LHS,
127 const unsigned long long& RHS) {
137 static bool isEqual(
const short &LHS,
const short &RHS) {
return LHS == RHS; }
144 static unsigned getHashValue(
const int& Val) {
return (
unsigned)(Val * 37U); }
146 static bool isEqual(
const int& LHS,
const int& RHS) {
154 return (1UL << (
sizeof(
long) * 8 - 1)) - 1UL;
160 return (
unsigned)(Val * 37UL);
163 static bool isEqual(
const long& LHS,
const long& RHS) {
170 static inline long long getEmptyKey() {
return 0x7fffffffffffffffLL; }
174 return (
unsigned)(Val * 37ULL);
178 const long long& RHS) {
184 template<
typename T,
typename U>
191 return std::make_pair(FirstInfo::getEmptyKey(),
192 SecondInfo::getEmptyKey());
196 return std::make_pair(FirstInfo::getTombstoneKey(),
197 SecondInfo::getTombstoneKey());
201 uint64_t key = (uint64_t)FirstInfo::getHashValue(PairVal.first) << 32
202 | (uint64_t)SecondInfo::getHashValue(PairVal.second);
211 return (
unsigned)key;
223 return StringRef(reinterpret_cast<const char *>(~static_cast<uintptr_t>(0)),
228 return StringRef(reinterpret_cast<const char *>(~static_cast<uintptr_t>(1)),
233 assert(Val.
data() != getEmptyKey().data() &&
"Cannot hash the empty key!");
234 assert(Val.
data() != getTombstoneKey().data() &&
235 "Cannot hash the tombstone key!");
240 if (RHS.
data() == getEmptyKey().data())
241 return LHS.
data() == getEmptyKey().data();
242 if (RHS.
data() == getTombstoneKey().data())
243 return LHS.
data() == getTombstoneKey().data();
251 return ArrayRef<T>(
reinterpret_cast<const T *
>(~static_cast<uintptr_t>(0)),
256 return ArrayRef<T>(
reinterpret_cast<const T *
>(~static_cast<uintptr_t>(1)),
261 assert(Val.
data() != getEmptyKey().data() &&
"Cannot hash the empty key!");
262 assert(Val.
data() != getTombstoneKey().data() &&
263 "Cannot hash the tombstone key!");
268 if (RHS.
data() == getEmptyKey().data())
269 return LHS.
data() == getEmptyKey().data();
270 if (RHS.
data() == getTombstoneKey().data())
271 return LHS.
data() == getTombstoneKey().data();
288 return (EltCnt.
Min * 37U) - 1U;
290 return EltCnt.
Min * 37U;
300 #endif // LLVM_ADT_DENSEMAPINFO_H
static bool isEqual(const char &LHS, const char &RHS)
static unsigned char getTombstoneKey()
This class represents lattice values for constants.
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()
static unsigned getHashValue(const long &Val)
static unsigned getEmptyKey()
static unsigned getHashValue(const unsigned short &Val)
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 ElementCount getTombstoneKey()
static unsigned getHashValue(StringRef Val)
static unsigned long long getEmptyKey()
static unsigned getHashValue(const short &Val)
static bool isEqual(const Function &Caller, const Function &Callee)
static unsigned getHashValue(const ElementCount &EltCnt)
static bool isEqual(hash_code LHS, hash_code RHS)
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 short getTombstoneKey()
static unsigned long getTombstoneKey()
static unsigned getHashValue(ArrayRef< T > Val)
static bool isEqual(const unsigned short &LHS, const unsigned short &RHS)
static char getTombstoneKey()
static ElementCount getEmptyKey()
static unsigned getHashValue(hash_code val)
static unsigned short getEmptyKey()
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 getHashValue(const unsigned char &Val)
static unsigned getTombstoneKey()
static ArrayRef< T > getTombstoneKey()
static int getTombstoneKey()
static StringRef getTombstoneKey()
An opaque object representing a hash code.
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 bool isEqual(const short &LHS, const short &RHS)
static short getEmptyKey()
static unsigned getHashValue(const Pair &PairVal)
static unsigned getHashValue(const char &Val)
LLVM_NODISCARD const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static Pair getTombstoneKey()
static hash_code getTombstoneKey()
static unsigned long long getTombstoneKey()
StringRef - Represent a constant reference to a string, i.e.
static unsigned short getTombstoneKey()
static bool isEqual(const ElementCount &LHS, const ElementCount &RHS)
static unsigned char getEmptyKey()
static bool isEqual(const unsigned char &LHS, const unsigned char &RHS)
static long getEmptyKey()
static hash_code getEmptyKey()
static Pair getEmptyKey()
static T * getTombstoneKey()