25void SmallPtrSetImplBase::shrink_and_clear() {
40std::pair<const void *const *, bool>
41SmallPtrSetImplBase::insert_imp_big(
const void *Ptr) {
49 unsigned I = DenseMapInfo<void *>::getHashValue(Ptr) &
Mask;
64const void *
const *SmallPtrSetImplBase::doFind(
const void *Ptr)
const {
66 unsigned BucketNo = DenseMapInfo<void *>::getHashValue(Ptr) &
Mask;
68 const void *
const *Bucket =
CurArray + BucketNo;
73 BucketNo = (BucketNo + 1) & Mask;
86 if (((
I - Ideal) & Mask) < ((J - Ideal) & Mask)) {
101 const void **NewBuckets = (
const void**)
safe_malloc(
sizeof(
void*) * NewSize);
106 memset(
CurArray, -1, NewSize*
sizeof(
void*));
110 for (
const void *Ptr : OldBuckets) {
122 free(OldBuckets.begin());
143 const void **RHSSmallStorage,
145 moveHelper(SmallStorage, SmallSize, RHSSmallStorage, std::move(that));
150 assert(&RHS !=
this &&
"Self-copy should be handled by the caller.");
152 if (
isSmall() && RHS.isSmall())
154 "Cannot assign sets with different small sizes");
168 sizeof(
void*) * RHS.CurArraySize);
189 const void **RHSSmallStorage,
193 moveHelper(SmallStorage, SmallSize, RHSSmallStorage, std::move(RHS));
196void SmallPtrSetImplBase::moveHelper(
const void **SmallStorage,
198 const void **RHSSmallStorage,
200 assert(&RHS !=
this &&
"Self-move should be handled by the caller.");
208 RHS.CurArray = RHSSmallStorage;
217 RHS.CurArraySize = SmallSize;
223 const void **RHSSmallStorage,
225 if (
this == &RHS)
return;
230 std::swap(this->CurArraySize, RHS.CurArraySize);
239 unsigned MinEntries = std::min(this->
NumEntries, RHS.NumEntries);
240 std::swap_ranges(this->
CurArray, this->
CurArray + MinEntries, RHS.CurArray);
243 RHS.CurArray + MinEntries);
245 std::copy(RHS.CurArray + MinEntries, RHS.CurArray + RHS.NumEntries,
246 this->CurArray + MinEntries);
248 assert(this->CurArraySize == RHS.CurArraySize);
257 const void **LargeSideInlineStorage =
258 this->
isSmall() ? RHSSmallStorage : SmallStorage;
264 LargeSide.
CurArray = LargeSideInlineStorage;
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
#define LLVM_UNLIKELY(EXPR)
#define LLVM_LIKELY(EXPR)
This file defines DenseMapInfo traits for DenseMap.
This file defines counterparts of C library allocation functions defined in the namespace 'std'.
This file defines the SmallPtrSet class.
LocallyHashedType DenseMapInfo< LocallyHashedType >::Empty
SmallPtrSetImplBase - This is the common code shared among all the SmallPtrSet<>'s,...
iterator_range< const void ** > buckets()
LLVM_ABI SmallPtrSetImplBase(const void **SmallStorage, const SmallPtrSetImplBase &that)
unsigned NumEntries
Number of elements in CurArray that contain a value.
const void ** CurArray
The current set of buckets, in either small or big representation.
bool IsSmall
Whether the set is in small representation.
LLVM_ABI void copyFrom(const void **SmallStorage, const SmallPtrSetImplBase &RHS)
LLVM_ABI void moveFrom(const void **SmallStorage, unsigned SmallSize, const void **RHSSmallStorage, SmallPtrSetImplBase &&RHS)
iterator_range< const void ** > small_buckets()
unsigned CurArraySize
CurArraySize - The allocated size of CurArray, always a power of two.
LLVM_ABI void eraseFromBucket(const void **Bucket)
Erase the entry at Bucket and close the resulting hole via Knuth TAOCP 6.4 Algorithm R.
static void * getEmptyMarker()
LLVM_ABI void Grow(unsigned NewSize)
Allocate a larger backing store for the buckets and move it over.
LLVM_ABI void swap(const void **SmallStorage, const void **RHSSmallStorage, SmallPtrSetImplBase &RHS)
swap - Swaps the elements of two sets.
constexpr std::underlying_type_t< E > Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
This is an optimization pass for GlobalISel generic memory operations.
unsigned Log2_32_Ceil(uint32_t Value)
Return the ceil log base 2 of the specified value, 32 if the value is zero.
LLVM_ATTRIBUTE_RETURNS_NONNULL void * safe_malloc(size_t Sz)
LLVM_ATTRIBUTE_RETURNS_NONNULL void * safe_realloc(void *Ptr, size_t Sz)
OutputIt copy(R &&Range, OutputIt Out)
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
An information struct used to provide DenseMap with the various necessary components for a given valu...