20#ifndef LLVM_ADT_CACHEDHASHSTRING_H
21#define LLVM_ADT_CACHEDHASHSTRING_H
40 :
P(S.
data()), Size(S.
size()), Hash(Hash) {
41 assert(S.
size() <= std::numeric_limits<uint32_t>::max());
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!");
64 return LHS.hash() ==
RHS.hash() &&
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());
113 if (
Other.isEmptyOrTombstone()) {
128 Other.P = getEmptyKeyPtr();
132 if (!isEmptyOrTombstone())
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!");
169 if (
LHS.hash() !=
RHS.hash())
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();
This file defines DenseMapInfo traits for DenseMap.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
A container which contains a StringRef plus a precomputed hash.
const char * data() const
CachedHashStringRef(StringRef S, uint32_t Hash)
CachedHashStringRef(StringRef S)
A container which contains a string, which it owns, plus a precomputed hash.
CachedHashString & operator=(CachedHashString Other)
CachedHashString(const char *S)
CachedHashString(StringRef S, uint32_t Hash)
friend void swap(CachedHashString &LHS, CachedHashString &RHS)
CachedHashString(StringRef S)
CachedHashString(const CachedHashString &Other)
CachedHashString(CachedHashString &&Other) noexcept
StringRef - Represent a constant reference to a string, i.e.
constexpr size_t size() const
size - Get the string size.
constexpr const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
This is an optimization pass for GlobalISel generic memory operations.
bool isEqual(const GCNRPTracker::LiveRegSet &S1, const GCNRPTracker::LiveRegSet &S2)
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
static unsigned getHashValue(const CachedHashStringRef &S)
static CachedHashStringRef getEmptyKey()
static CachedHashStringRef getTombstoneKey()
static unsigned getHashValue(const CachedHashString &S)
static CachedHashString getEmptyKey()
static CachedHashString getTombstoneKey()
static bool isEqual(const CachedHashString &LHS, const CachedHashString &RHS)
An information struct used to provide DenseMap with the various necessary components for a given valu...