19 #ifndef LLVM_ADT_CACHED_HASH_STRING_H 20 #define LLVM_ADT_CACHED_HASH_STRING_H 40 : P(S.
data()), Size(S.
size()), Hash(Hash) {
45 const char *
data()
const {
return P; }
58 assert(!
isEqual(S, getEmptyKey()) &&
"Cannot hash the empty key!");
59 assert(!
isEqual(S, getTombstoneKey()) &&
"Cannot hash the tombstone key!");
80 static char *getTombstoneKeyPtr() {
84 bool isEmptyOrTombstone()
const {
85 return P == getEmptyKeyPtr() || P == getTombstoneKeyPtr();
88 struct ConstructEmptyOrTombstoneTy {};
91 : P(EmptyOrTombstonePtr), Size(0), Hash(0) {
92 assert(isEmptyOrTombstone());
112 : Size(Other.Size), Hash(Other.Hash) {
113 if (Other.isEmptyOrTombstone()) {
117 memcpy(P, Other.P, Size);
128 Other.P = getEmptyKeyPtr();
132 if (!isEmptyOrTombstone())
148 swap(LHS.Size, RHS.Size);
149 swap(LHS.Hash, RHS.Hash);
156 CachedHashString::getEmptyKeyPtr());
160 CachedHashString::getTombstoneKeyPtr());
163 assert(!
isEqual(S, getEmptyKey()) &&
"Cannot hash the empty key!");
164 assert(!
isEqual(S, getTombstoneKey()) &&
"Cannot hash the tombstone key!");
171 if (LHS.P == CachedHashString::getEmptyKeyPtr())
172 return RHS.P == CachedHashString::getEmptyKeyPtr();
173 if (LHS.P == CachedHashString::getTombstoneKeyPtr())
174 return RHS.P == CachedHashString::getTombstoneKeyPtr();
178 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.
static bool isEqual(const CachedHashStringRef &LHS, const CachedHashStringRef &RHS)
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)
LLVM_NODISCARD size_t size() const
size - Get the string size.
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.
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())
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)