14 #ifndef LLVM_ADT_DENSEMAPINFO_H 15 #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 short &Val) {
return Val * 37U; }
76 static bool isEqual(
const unsigned short &LHS,
const unsigned short &RHS) {
85 static unsigned getHashValue(
const unsigned& Val) {
return Val * 37U; }
87 static bool isEqual(
const unsigned& LHS,
const unsigned& RHS) {
98 return (
unsigned)(Val * 37UL);
101 static bool isEqual(
const unsigned long& LHS,
const unsigned long& RHS) {
112 return (
unsigned)(Val * 37ULL);
115 static bool isEqual(
const unsigned long long& LHS,
116 const unsigned long long& RHS) {
126 static bool isEqual(
const short &LHS,
const short &RHS) {
return LHS == RHS; }
133 static unsigned getHashValue(
const int& Val) {
return (
unsigned)(Val * 37U); }
135 static bool isEqual(
const int& LHS,
const int& RHS) {
143 return (1UL << (
sizeof(
long) * 8 - 1)) - 1UL;
149 return (
unsigned)(Val * 37UL);
152 static bool isEqual(
const long& LHS,
const long& RHS) {
159 static inline long long getEmptyKey() {
return 0x7fffffffffffffffLL; }
163 return (
unsigned)(Val * 37ULL);
167 const long long& RHS) {
173 template<
typename T,
typename U>
180 return std::make_pair(FirstInfo::getEmptyKey(),
181 SecondInfo::getEmptyKey());
185 return std::make_pair(FirstInfo::getTombstoneKey(),
186 SecondInfo::getTombstoneKey());
190 uint64_t key = (uint64_t)FirstInfo::getHashValue(PairVal.first) << 32
191 | (uint64_t)SecondInfo::getHashValue(PairVal.second);
200 return (
unsigned)key;
212 return StringRef(reinterpret_cast<const char *>(~static_cast<uintptr_t>(0)),
217 return StringRef(reinterpret_cast<const char *>(~static_cast<uintptr_t>(1)),
222 assert(Val.
data() != getEmptyKey().data() &&
"Cannot hash the empty key!");
223 assert(Val.
data() != getTombstoneKey().data() &&
224 "Cannot hash the tombstone key!");
229 if (RHS.
data() == getEmptyKey().data())
230 return LHS.
data() == getEmptyKey().data();
231 if (RHS.
data() == getTombstoneKey().data())
232 return LHS.
data() == getTombstoneKey().data();
240 return ArrayRef<T>(
reinterpret_cast<const T *
>(~static_cast<uintptr_t>(0)),
245 return ArrayRef<T>(
reinterpret_cast<const T *
>(~static_cast<uintptr_t>(1)),
250 assert(Val.
data() != getEmptyKey().data() &&
"Cannot hash the empty key!");
251 assert(Val.
data() != getTombstoneKey().data() &&
252 "Cannot hash the tombstone key!");
257 if (RHS.
data() == getEmptyKey().data())
258 return LHS.
data() == getEmptyKey().data();
259 if (RHS.
data() == getTombstoneKey().data())
260 return LHS.
data() == getTombstoneKey().data();
274 #endif // LLVM_ADT_DENSEMAPINFO_H
static bool isEqual(const char &LHS, const char &RHS)
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)
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).
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 unsigned getHashValue(const short &Val)
static bool isEqual(const Function &Caller, const Function &Callee)
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 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 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)
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 long getEmptyKey()
static hash_code getEmptyKey()
static Pair getEmptyKey()
static T * getTombstoneKey()