20 #ifndef LLVM_ADT_CACHED_HASH_STRING_H 21 #define LLVM_ADT_CACHED_HASH_STRING_H 41 : P(S.
data()), Size(S.
size()), Hash(Hash) {
46 const char *
data()
const {
return P; }
59 assert(!
isEqual(S, getEmptyKey()) &&
"Cannot hash the empty key!");
60 assert(!
isEqual(S, getTombstoneKey()) &&
"Cannot hash the tombstone key!");
81 static char *getTombstoneKeyPtr() {
85 bool isEmptyOrTombstone()
const {
86 return P == getEmptyKeyPtr() || P == getTombstoneKeyPtr();
89 struct ConstructEmptyOrTombstoneTy {};
92 : P(EmptyOrTombstonePtr), Size(0), Hash(0) {
93 assert(isEmptyOrTombstone());
113 : Size(Other.Size), Hash(Other.Hash) {
114 if (Other.isEmptyOrTombstone()) {
129 Other.P = getEmptyKeyPtr();
133 if (!isEmptyOrTombstone())
149 swap(LHS.Size, RHS.Size);
150 swap(LHS.Hash, RHS.Hash);
157 CachedHashString::getEmptyKeyPtr());
161 CachedHashString::getTombstoneKeyPtr());
164 assert(!
isEqual(S, getEmptyKey()) &&
"Cannot hash the empty key!");
165 assert(!
isEqual(S, getTombstoneKey()) &&
"Cannot hash the tombstone key!");
172 if (LHS.P == CachedHashString::getEmptyKeyPtr())
173 return RHS.P == CachedHashString::getEmptyKeyPtr();
174 if (LHS.P == CachedHashString::getTombstoneKeyPtr())
175 return RHS.P == CachedHashString::getTombstoneKeyPtr();
179 return LHS.
val() == RHS.
val();
A container which contains a StringRef plus a precomputed hash.
CachedHashString(const CachedHashString &Other)
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
This class represents lattice values for constants.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
static bool isEqual(const CachedHashStringRef &LHS, const CachedHashStringRef &RHS)
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 bool isEqual(const CachedHashString &LHS, const CachedHashString &RHS)
CachedHashStringRef(StringRef S, uint32_t Hash)
CachedHashString(StringRef S, uint32_t Hash)
CachedHashString & operator=(CachedHashString Other)
static CachedHashString getTombstoneKey()
static bool isEqual(const Function &Caller, const Function &Callee)
static CachedHashStringRef getTombstoneKey()
const char * data() const
CachedHashString(CachedHashString &&Other) noexcept
CachedHashStringRef(StringRef S)
static CachedHashString getEmptyKey()
static unsigned getHashValue(const CachedHashStringRef &S)
static unsigned getHashValue(const CachedHashString &S)
CachedHashString(StringRef S)
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
A container which contains a string, which it owns, plus a precomputed hash.
StringRef - Represent a constant reference to a string, i.e.
static CachedHashStringRef getEmptyKey()
CachedHashString(const char *S)
friend void swap(CachedHashString &LHS, CachedHashString &RHS)