Go to the documentation of this file.
24 void SmallPtrSetImplBase::shrink_and_clear() {
25 assert(!isSmall() &&
"Can't shrink a small set!");
39 std::pair<const void *const *, bool>
40 SmallPtrSetImplBase::insert_imp_big(
const void *Ptr) {
51 const void **Bucket =
const_cast<const void**
>(FindBucketFor(Ptr));
53 return std::make_pair(Bucket,
false);
62 return std::make_pair(Bucket,
true);
65 const void *
const *SmallPtrSetImplBase::FindBucketFor(
const void *Ptr)
const {
68 unsigned ProbeAmt = 1;
70 const void *
const *Tombstone =
nullptr;
76 return Tombstone ? Tombstone : Array+Bucket;
85 Tombstone = Array+Bucket;
88 Bucket = (Bucket + ProbeAmt++) & (ArraySize-1);
94 void SmallPtrSetImplBase::Grow(
unsigned NewSize) {
97 bool WasSmall = isSmall();
100 const void **NewBuckets = (
const void**)
safe_malloc(
sizeof(
void*) * NewSize);
105 memset(
CurArray, -1, NewSize*
sizeof(
void*));
108 for (
const void **BucketPtr = OldBuckets; BucketPtr != OldEnd; ++BucketPtr) {
110 const void *Elt = *BucketPtr;
112 *
const_cast<void**
>(FindBucketFor(Elt)) =
const_cast<void*
>(Elt);
126 if (
that.isSmall()) {
145 assert(&
RHS !=
this &&
"Self-copy should be handled by the caller.");
147 if (isSmall() &&
RHS.isSmall())
149 "Cannot assign sets with different small sizes");
162 sizeof(
void*) *
RHS.CurArraySize);
188 void SmallPtrSetImplBase::MoveHelper(
unsigned SmallSize,
190 assert(&
RHS !=
this &&
"Self-move should be handled by the caller.");
198 RHS.CurArray =
RHS.SmallArray;
207 RHS.CurArraySize = SmallSize;
210 RHS.NumTombstones = 0;
214 if (
this == &
RHS)
return;
217 if (!this->isSmall() && !
RHS.isSmall()) {
229 if (!this->isSmall() &&
RHS.isSmall()) {
242 if (this->isSmall() && !
RHS.isSmall()) {
250 RHS.CurArray =
RHS.SmallArray;
255 assert(this->isSmall() &&
RHS.isSmall());
256 unsigned MinNonEmpty =
std::min(this->NumNonEmpty,
RHS.NumNonEmpty);
259 if (this->NumNonEmpty > MinNonEmpty) {
262 RHS.SmallArray + MinNonEmpty);
265 this->SmallArray + MinNonEmpty);
void swap(SmallPtrSetImplBase &RHS)
swap - Swaps the elements of two sets.
This is an optimization pass for GlobalISel generic memory operations.
unsigned NumNonEmpty
Number of elements in CurArray that contain a value or are a tombstone.
SmallPtrSetImplBase - This is the common code shared among all the SmallPtrSet<>'s,...
we should consider alternate ways to model stack dependencies Lots of things could be done in WebAssemblyTargetTransformInfo cpp there are numerous optimization related hooks that can be overridden in WebAssemblyTargetLowering Instead of the OptimizeReturned which should consider preserving the returned attribute through to MachineInstrs and extending the MemIntrinsicResults pass to do this optimization on calls too That would also let the WebAssemblyPeephole pass clean up dead defs for such as it does for stores Consider implementing and or getMachineCombinerPatterns Find a clean way to fix the problem which leads to the Shrink Wrapping pass being run after the WebAssembly PEI pass When setting multiple variables to the same we currently get code like const It could be done with a smaller encoding like local tee $pop5 local $pop6 WebAssembly registers are implicitly initialized to zero Explicit zeroing is therefore often redundant and could be optimized away Small indices may use smaller encodings than large indices WebAssemblyRegColoring and or WebAssemblyRegRenumbering should sort registers according to their usage frequency to maximize the usage of smaller encodings Many cases of irreducible control flow could be transformed more optimally than via the transform in WebAssemblyFixIrreducibleControlFlow cpp It may also be worthwhile to do transforms before register particularly when duplicating to allow register coloring to be aware of the duplication WebAssemblyRegStackify could use AliasAnalysis to reorder loads and stores more aggressively WebAssemblyRegStackify is currently a greedy algorithm This means that
unsigned CurArraySize
CurArraySize - The allocated size of CurArray, always a power of two.
An information struct used to provide DenseMap with the various necessary components for a given valu...
unsigned Log2_32_Ceil(uint32_t Value)
Return the ceil log base 2 of the specified value, 32 if the value is zero.
unsigned NumTombstones
Number of tombstones in CurArray.
const void ** EndPointer() const
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
const void ** CurArray
CurArray - This is the current set of buckets.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static void * getTombstoneMarker()
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
static void * getEmptyMarker()
Expected< ExpressionValue > min(const ExpressionValue &Lhs, const ExpressionValue &Rhs)
Analysis the ScalarEvolution expression for r is this
const void ** SmallArray
SmallArray - Points to a fixed size set of buckets, used in 'small mode'.
LLVM_ATTRIBUTE_RETURNS_NONNULL void * safe_realloc(void *Ptr, size_t Sz)
void MoveFrom(unsigned SmallSize, SmallPtrSetImplBase &&RHS)
#define LLVM_LIKELY(EXPR)
SmallPtrSetImplBase(const void **SmallStorage, const SmallPtrSetImplBase &that)
#define LLVM_UNLIKELY(EXPR)
we should consider alternate ways to model stack dependencies Lots of things could be done in WebAssemblyTargetTransformInfo cpp there are numerous optimization related hooks that can be overridden in WebAssemblyTargetLowering Instead of the OptimizeReturned which should consider preserving the returned attribute through to MachineInstrs and extending the MemIntrinsicResults pass to do this optimization on calls too That would also let the WebAssemblyPeephole pass clean up dead defs for such as it does for stores Consider implementing and or getMachineCombinerPatterns Find a clean way to fix the problem which leads to the Shrink Wrapping pass being run after the WebAssembly PEI pass When setting multiple variables to the same we currently get code like const It could be done with a smaller encoding like local tee $pop5 local copy
LLVM_ATTRIBUTE_RETURNS_NONNULL void * safe_malloc(size_t Sz)
void CopyFrom(const SmallPtrSetImplBase &RHS)