42 unsigned NumBuckets) {
43 return reinterpret_cast<unsigned *
>(TheTable + NumBuckets + 1);
60 assert((InitSize & (InitSize - 1)) == 0 &&
61 "Init Size must be a power of 2 or zero!");
63 unsigned NewNumBuckets = InitSize ? InitSize : 16;
79#ifdef EXPENSIVE_CHECKS
86 FullHashValue = ~FullHashValue;
87 unsigned BucketNo = FullHashValue & (
NumBuckets - 1);
94 HashTable[BucketNo] = FullHashValue;
98 if (
LLVM_LIKELY(HashTable[BucketNo] == FullHashValue)) {
106 char *ItemStr = (
char *)BucketItem +
ItemSize;
124#ifdef EXPENSIVE_CHECKS
128 FullHashValue = ~FullHashValue;
129 unsigned BucketNo = FullHashValue & (
NumBuckets - 1);
138 if (
LLVM_LIKELY(HashTable[BucketNo] == FullHashValue)) {
146 char *ItemStr = (
char *)BucketItem +
ItemSize;
161 const char *VStr = (
char *)V +
ItemSize;
164 assert(V == V2 &&
"Didn't find key?");
173 unsigned I = Bucket, J =
I;
174 while ((J = (J + 1) & Mask),
TheTable[J]) {
175 unsigned Ideal = HashTable[J];
176 if (((
I - Ideal) & Mask) < ((J - Ideal) & Mask)) {
178 HashTable[
I] = HashTable[J];
207 unsigned NewBucketNo = BucketNo;
209 unsigned *NewHashArray =
getHashTable(NewTableArray, NewSize);
218 unsigned FullHash = HashTable[
I];
219 unsigned NewBucket = FullHash & (NewSize - 1);
220 while (NewTableArray[NewBucket])
221 NewBucket = (NewBucket + 1) & (NewSize - 1);
224 NewTableArray[NewBucket] = Bucket;
225 NewHashArray[NewBucket] = FullHash;
227 NewBucketNo = NewBucket;
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file defines the StringMap class.
#define LLVM_UNLIKELY(EXPR)
#define LLVM_LIKELY(EXPR)
static StringMapEntryBase ** createTable(unsigned NewNumBuckets)
static unsigned * getHashTable(StringMapEntryBase **TheTable, unsigned NumBuckets)
static unsigned getMinBucketToReserveForEntries(unsigned NumEntries)
Returns the number of buckets to allocate to ensure that the DenseMap can accommodate NumEntries with...
StringMapEntryBase - Shared base class of StringMapEntry instances.
size_t getKeyLength() const
unsigned LookupBucketFor(StringRef Key)
LookupBucketFor - Look up the bucket that the specified string should end up in.
LLVM_ABI unsigned RehashTable(unsigned BucketNo=0)
RehashTable - Grow the table, redistributing values into the buckets with the appropriate mod-of-hash...
LLVM_ABI void RemoveKey(StringMapEntryBase *V)
RemoveKey - Remove the specified StringMapEntry from the table, but do not delete it.
StringMapEntryBase ** TheTable
LLVM_ABI void removeBucket(unsigned Bucket)
Remove the entry at the given (live) bucket, whose value the caller has already destroyed,...
StringMapImpl(unsigned itemSize)
LLVM_ABI void init(unsigned Size)
Allocate the table with the specified number of buckets and otherwise setup the map as empty.
static LLVM_ABI uint32_t hash(StringRef Key)
Returns the hash value that will be used for the given string.
int FindKey(StringRef Key) const
FindKey - Look up the bucket that contains the specified key.
Represent a constant reference to a string, i.e.
This is an optimization pass for GlobalISel generic memory operations.
uint64_t xxh3_64bits(ArrayRef< uint8_t > data)
Inline ArrayRef overloads of the xxhash entry points declared out-of-line in llvm/Support/xxhash....
LLVM_ATTRIBUTE_RETURNS_NONNULL void * safe_calloc(size_t Count, size_t Sz)
constexpr bool shouldReverseIterate()
LLVM_ATTRIBUTE_VISIBILITY_DEFAULT AnalysisKey InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key
constexpr uint64_t NextPowerOf2(uint64_t A)
Returns the next power of two (in 64-bits) that is strictly greater than A.