|
LLVM
5.0.0
|
SmallPtrSetImplBase - This is the common code shared among all the SmallPtrSet<>'s, which is almost everything. More...
#include "llvm/ADT/SmallPtrSet.h"
Public Types | |
| using | size_type = unsigned |
Public Member Functions | |
| SmallPtrSetImplBase & | operator= (const SmallPtrSetImplBase &)=delete |
| LLVM_NODISCARD bool | empty () const |
| size_type | size () const |
| void | clear () |
Protected Member Functions | |
| SmallPtrSetImplBase (const void **SmallStorage, const SmallPtrSetImplBase &that) | |
| SmallPtrSetImplBase (const void **SmallStorage, unsigned SmallSize, SmallPtrSetImplBase &&that) | |
| SmallPtrSetImplBase (const void **SmallStorage, unsigned SmallSize) | |
| ~SmallPtrSetImplBase () | |
| const void ** | EndPointer () const |
| std::pair< const void *const *, bool > | insert_imp (const void *Ptr) |
| insert_imp - This returns true if the pointer was new to the set, false if it was already in the set. More... | |
| bool | erase_imp (const void *Ptr) |
| erase_imp - If the set contains the specified pointer, remove it and return true, otherwise return false. More... | |
| const void *const * | find_imp (const void *Ptr) const |
| Returns the raw pointer needed to construct an iterator. More... | |
| void | swap (SmallPtrSetImplBase &RHS) |
| swap - Swaps the elements of two sets. More... | |
| void | CopyFrom (const SmallPtrSetImplBase &RHS) |
| void | MoveFrom (unsigned SmallSize, SmallPtrSetImplBase &&RHS) |
Static Protected Member Functions | |
| static void * | getTombstoneMarker () |
| static void * | getEmptyMarker () |
Protected Attributes | |
| const void ** | SmallArray |
| SmallArray - Points to a fixed size set of buckets, used in 'small mode'. More... | |
| const void ** | CurArray |
| CurArray - This is the current set of buckets. More... | |
| unsigned | CurArraySize |
| CurArraySize - The allocated size of CurArray, always a power of two. More... | |
| unsigned | NumNonEmpty |
| Number of elements in CurArray that contain a value or are a tombstone. More... | |
| unsigned | NumTombstones |
| Number of tombstones in CurArray. More... | |
Friends | |
| class | SmallPtrSetIteratorImpl |
SmallPtrSetImplBase - This is the common code shared among all the SmallPtrSet<>'s, which is almost everything.
SmallPtrSet has two modes, one for small and one for large sets.
Small sets use an array of pointers allocated in the SmallPtrSet object, which is treated as a simple array of pointers. When a pointer is added to the set, the array is scanned to see if the element already exists, if not the element is 'pushed back' onto the array. If we run out of space in the array, we grow into the 'large set' case. SmallSet should be used when the sets are often small. In this case, no memory allocation is used, and only light-weight and cache-efficient scanning is used.
Large sets use a classic exponentially-probed hash table. Empty buckets are represented with an illegal pointer value (-1) to allow null pointers to be inserted. Tombstones are represented with another illegal pointer value (-2), to allow deletion. The hash table is resized when the table is 3/4 or more. When this happens, the table is doubled in size.
Definition at line 50 of file SmallPtrSet.h.
Definition at line 88 of file SmallPtrSet.h.
|
protected |
Definition at line 118 of file SmallPtrSet.cpp.
References assert(), CurArray, CurArraySize, and SmallArray.
|
protected |
Definition at line 135 of file SmallPtrSet.cpp.
References SmallArray.
|
inlineexplicitprotected |
Definition at line 75 of file SmallPtrSet.h.
References assert().
|
inlineprotected |
Definition at line 82 of file SmallPtrSet.h.
References CurArray.
|
inline |
Definition at line 95 of file SmallPtrSet.h.
References CurArray, CurArraySize, NumNonEmpty, NumTombstones, and size().
Referenced by AllGlobalLoadUsesSimpleEnoughForHeapSRA(), llvm::SCEVExpander::clearPostInc(), llvm::ObjectSizeOffsetEvaluator::compute(), ComputePostOrders(), findBBsToSinkInto(), findBestInsertionSet(), llvm::LexicalScopes::getMachineBasicBlocks(), llvm::SmallPtrSet< llvm::Constant *, 8 >::operator=(), llvm::Float2IntPass::runImpl(), SimplifyLoopInst(), updateDTAfterUnswitch(), and updatePostorderSequenceForEdgeInsertion().
|
protected |
Definition at line 142 of file SmallPtrSet.cpp.
References assert(), CurArray, CurArraySize, SmallArray, and T.
Referenced by llvm::SmallPtrSet< llvm::Constant *, 8 >::operator=().
|
inline |
Definition at line 92 of file SmallPtrSet.h.
References size().
Referenced by llvm::buildModuleSummaryIndex(), DominatesMergePoint(), llvm::findPHICopyInsertPoint(), isProfitableChain(), llvm::SelectionDAG::MorphNodeTo(), promoteArguments(), runImpl(), setUsedInitializer(), sinkInstruction(), unswitchTrivialSwitch(), updateDTAfterUnswitch(), and llvm::LLVMContextImpl::~LLVMContextImpl().
|
inlineprotected |
Definition at line 118 of file SmallPtrSet.h.
References CurArray, CurArraySize, and NumNonEmpty.
Referenced by llvm::SmallPtrSetImpl< const BlockT * >::begin(), llvm::SmallPtrSetImpl< const BlockT * >::end(), erase_imp(), and find_imp().
erase_imp - If the set contains the specified pointer, remove it and return true, otherwise return false.
This is hidden from the client so that the derived class can check that the right type of pointer is passed in.
Definition at line 159 of file SmallPtrSet.h.
References assert(), EndPointer(), find_imp(), getTombstoneMarker(), NumTombstones, and P.
Referenced by llvm::SmallPtrSetImpl< const BlockT * >::erase().
Returns the raw pointer needed to construct an iterator.
If element not found, this will be EndPointer. Otherwise, it will be a pointer to the slot which stores Ptr;
Definition at line 174 of file SmallPtrSet.h.
References E, EndPointer(), NumNonEmpty, and SmallArray.
Referenced by erase_imp(), and llvm::SmallPtrSetImpl< const BlockT * >::find().
|
inlinestaticprotected |
Definition at line 112 of file SmallPtrSet.h.
Referenced by llvm::SmallPtrSetIteratorImpl::AdvanceIfNotValid().
|
inlinestaticprotected |
Definition at line 110 of file SmallPtrSet.h.
Referenced by llvm::SmallPtrSetIteratorImpl::AdvanceIfNotValid(), erase_imp(), and insert_imp().
|
inlineprotected |
insert_imp - This returns true if the pointer was new to the set, false if it was already in the set.
This is hidden from the client so that the derived class can check that the right type of pointer is passed in.
Definition at line 125 of file SmallPtrSet.h.
References CurArraySize, E, getTombstoneMarker(), NumNonEmpty, NumTombstones, Ptr, and SmallArray.
Referenced by llvm::SmallPtrSetImpl< const BlockT * >::insert().
|
protected |
Definition at line 182 of file SmallPtrSet.cpp.
References CurArray.
Referenced by llvm::SmallPtrSet< llvm::Constant *, 8 >::operator=().
|
delete |
|
inline |
Definition at line 93 of file SmallPtrSet.h.
References NumNonEmpty, and NumTombstones.
Referenced by clear(), DeadPHICycle(), empty(), llvm::CodeExtractor::extractCodeRegion(), findBBsToSinkInto(), findBestInsertionSet(), llvm::findPHICopyInsertPoint(), FindPredecessorAutoreleaseWithSafePath(), FindPredecessorRetainWithSafePath(), llvm::BasicTTIImplBase< AMDGPUTTIImpl >::getEstimatedNumberOfCaseClusters(), llvm::MemoryDependenceResults::getNonLocalCallDependency(), llvm::slpvectorizer::BoUpSLP::getSpillCost(), llvm::SDNode::hasPredecessorHelper(), hasSameSuccessors(), PHIsEqualValue(), llvm::removeUnreachableBlocks(), llvm::JumpThreadingPass::SimplifyPartiallyRedundantLoad(), sinkInstruction(), unswitchTrivialSwitch(), and llvm::LoopBase< N, M >::verifyLoop().
|
protected |
swap - Swaps the elements of two sets.
Note: This method assumes that both sets have the same small size.
Definition at line 214 of file SmallPtrSet.cpp.
References assert(), CurArray, CurArraySize, fuzzer::min(), NumNonEmpty, NumTombstones, SmallArray, and std::swap().
Referenced by llvm::SmallPtrSet< llvm::Constant *, 8 >::swap().
|
friend |
Definition at line 51 of file SmallPtrSet.h.
|
protected |
CurArray - This is the current set of buckets.
If equal to SmallArray, then the set is in 'small mode'.
Definition at line 58 of file SmallPtrSet.h.
Referenced by llvm::SmallPtrSetImpl< const BlockT * >::begin(), clear(), CopyFrom(), EndPointer(), MoveFrom(), SmallPtrSetImplBase(), swap(), and ~SmallPtrSetImplBase().
|
protected |
CurArraySize - The allocated size of CurArray, always a power of two.
Definition at line 60 of file SmallPtrSet.h.
Referenced by clear(), CopyFrom(), EndPointer(), insert_imp(), SmallPtrSetImplBase(), and swap().
|
protected |
Number of elements in CurArray that contain a value or are a tombstone.
If small, all these elements are at the beginning of CurArray and the rest is uninitialized.
Definition at line 65 of file SmallPtrSet.h.
Referenced by clear(), EndPointer(), find_imp(), insert_imp(), size(), and swap().
|
protected |
Number of tombstones in CurArray.
Definition at line 67 of file SmallPtrSet.h.
Referenced by clear(), erase_imp(), insert_imp(), size(), and swap().
|
protected |
SmallArray - Points to a fixed size set of buckets, used in 'small mode'.
Definition at line 55 of file SmallPtrSet.h.
Referenced by CopyFrom(), find_imp(), insert_imp(), SmallPtrSetImplBase(), and swap().
1.8.6