LLVM API Documentation
#include <SmallPtrSet.h>


Public Member Functions | |
| bool | empty () const |
| unsigned | size () const |
| void | clear () |
Protected Member Functions | |
| SmallPtrSetImpl (const void **SmallStorage, const SmallPtrSetImpl &that) | |
| SmallPtrSetImpl (const void **SmallStorage, unsigned SmallSize) | |
| ~SmallPtrSetImpl () | |
| bool | insert_imp (const void *Ptr) |
| bool | erase_imp (const void *Ptr) |
| bool | count_imp (const void *Ptr) const |
| void | swap (SmallPtrSetImpl &RHS) |
| void | CopyFrom (const SmallPtrSetImpl &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'. | |
| const void ** | CurArray |
| unsigned | CurArraySize |
| CurArraySize - The allocated size of CurArray, always a power of two. | |
| unsigned | NumElements |
| unsigned | NumTombstones |
Friends | |
| class | SmallPtrSetIteratorImpl |
SmallPtrSetImpl - 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 48 of file SmallPtrSet.h.
| SmallPtrSetImpl::SmallPtrSetImpl | ( | const void ** | SmallStorage, |
| const SmallPtrSetImpl & | that | ||
| ) | [protected] |
Definition at line 166 of file SmallPtrSet.cpp.
References CurArray, CurArraySize, llvm::LibFunc::malloc, llvm::LibFunc::memcpy, NumElements, NumTombstones, and SmallArray.
| llvm::SmallPtrSetImpl::SmallPtrSetImpl | ( | const void ** | SmallStorage, |
| unsigned | SmallSize | ||
| ) | [inline, explicit, protected] |
Definition at line 65 of file SmallPtrSet.h.
References clear().
| SmallPtrSetImpl::~SmallPtrSetImpl | ( | ) | [protected] |
Definition at line 270 of file SmallPtrSet.cpp.
References CurArray, and llvm::LibFunc::free.
| void llvm::SmallPtrSetImpl::clear | ( | ) | [inline] |
Definition at line 77 of file SmallPtrSet.h.
References CurArray, CurArraySize, llvm::LibFunc::memset, NumElements, and NumTombstones.
Referenced by AllGlobalLoadUsesSimpleEnoughForHeapSRA(), llvm::LeakDetectorImpl< Value >::clear(), llvm::FunctionLoweringInfo::clear(), llvm::SCEVExpander::clearPostInc(), llvm::ObjectSizeOffsetEvaluator::compute(), ComputePostOrders(), llvm::LexicalScopes::getMachineBasicBlocks(), llvm::BoUpSLP::getTreeCost(), llvm::BranchFolder::OptimizeFunction(), llvm::MCAssembler::reset(), llvm::BranchProbabilityInfo::runOnFunction(), SmallPtrSetImpl(), and llvm::BoUpSLP::vectorizeTree().
| void SmallPtrSetImpl::CopyFrom | ( | const SmallPtrSetImpl & | RHS | ) | [protected] |
CopyFrom - implement operator= from a smallptrset that has the same pointer type, but may have a different small size.
Definition at line 191 of file SmallPtrSet.cpp.
References CurArray, CurArraySize, llvm::LibFunc::free, llvm::LibFunc::malloc, llvm::LibFunc::memcpy, NumElements, NumTombstones, llvm::LibFunc::realloc, and SmallArray.
Referenced by llvm::SmallPtrSet< const MDNode *, 16 >::operator=().
| bool llvm::SmallPtrSetImpl::count_imp | ( | const void * | Ptr | ) | const [inline, protected] |
Definition at line 108 of file SmallPtrSet.h.
References NumElements, and SmallArray.
Referenced by llvm::SmallPtrSet< const MDNode *, 16 >::count().
| bool llvm::SmallPtrSetImpl::empty | ( | ) | const [inline] |
Definition at line 74 of file SmallPtrSet.h.
References size().
Referenced by llvm::LiveRangeEdit::anyRematerializable(), llvm::findPHICopyInsertPoint(), llvm::FoldBranchToCommonDest(), llvm::LeakDetectorImpl< Value >::hasGarbage(), llvm::SDNode::hasPredecessorHelper(), isProfitableChain(), llvm::SelectionDAG::MorphNodeTo(), llvm::MemoryDependenceAnalysis::removeInstruction(), llvm::BranchProbabilityInfo::runOnFunction(), and llvm::LLVMContextImpl::~LLVMContextImpl().
| bool SmallPtrSetImpl::erase_imp | ( | const void * | Ptr | ) | [protected] |
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 74 of file SmallPtrSet.cpp.
References getEmptyMarker(), getTombstoneMarker(), NumElements, NumTombstones, and SmallArray.
Referenced by llvm::SmallPtrSet< const MDNode *, 16 >::erase().
| static void* llvm::SmallPtrSetImpl::getEmptyMarker | ( | ) | [inline, static, protected] |
Definition at line 91 of file SmallPtrSet.h.
Referenced by llvm::SmallPtrSetIteratorImpl::AdvanceIfNotValid(), and erase_imp().
| static void* llvm::SmallPtrSetImpl::getTombstoneMarker | ( | ) | [inline, static, protected] |
Definition at line 90 of file SmallPtrSet.h.
Referenced by llvm::SmallPtrSetIteratorImpl::AdvanceIfNotValid(), erase_imp(), and insert_imp().
| bool SmallPtrSetImpl::insert_imp | ( | const void * | Ptr | ) | [protected] |
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 37 of file SmallPtrSet.cpp.
References CurArraySize, getTombstoneMarker(), NumElements, NumTombstones, and SmallArray.
Referenced by llvm::SmallPtrSet< const MDNode *, 16 >::insert().
| unsigned llvm::SmallPtrSetImpl::size | ( | ) | const [inline] |
Definition at line 75 of file SmallPtrSet.h.
References NumElements.
Referenced by llvm::FunctionLoweringInfo::clear(), DeadPHICycle(), empty(), llvm::CodeExtractor::extractCodeRegion(), llvm::findPHICopyInsertPoint(), FindPredecessorAutoreleaseWithSafePath(), FindPredecessorRetainWithSafePath(), llvm::MemoryDependenceAnalysis::getNonLocalCallDependency(), PHIsEqualValue(), llvm::removeUnreachableBlocks(), removeUnreachableBlocksFromFn(), and llvm::LLVMContextImpl::~LLVMContextImpl().
| void SmallPtrSetImpl::swap | ( | SmallPtrSetImpl & | RHS | ) | [protected] |
swap - Swaps the elements of two sets. Note: This method assumes that both sets have the same small size.
Definition at line 220 of file SmallPtrSet.cpp.
References CurArray, CurArraySize, NumElements, NumTombstones, and SmallArray.
friend class SmallPtrSetIteratorImpl [friend] |
Definition at line 49 of file SmallPtrSet.h.
const void** llvm::SmallPtrSetImpl::CurArray [protected] |
CurArray - This is the current set of buckets. If equal to SmallArray, then the set is in 'small mode'.
Definition at line 55 of file SmallPtrSet.h.
Referenced by llvm::SmallPtrSet< const MDNode *, 16 >::begin(), clear(), CopyFrom(), llvm::SmallPtrSet< const MDNode *, 16 >::end(), SmallPtrSetImpl(), swap(), and ~SmallPtrSetImpl().
unsigned llvm::SmallPtrSetImpl::CurArraySize [protected] |
CurArraySize - The allocated size of CurArray, always a power of two.
Definition at line 57 of file SmallPtrSet.h.
Referenced by llvm::SmallPtrSet< const MDNode *, 16 >::begin(), clear(), CopyFrom(), llvm::SmallPtrSet< const MDNode *, 16 >::end(), insert_imp(), SmallPtrSetImpl(), and swap().
unsigned llvm::SmallPtrSetImpl::NumElements [protected] |
Definition at line 60 of file SmallPtrSet.h.
Referenced by clear(), CopyFrom(), count_imp(), erase_imp(), insert_imp(), size(), SmallPtrSetImpl(), and swap().
unsigned llvm::SmallPtrSetImpl::NumTombstones [protected] |
Definition at line 61 of file SmallPtrSet.h.
Referenced by clear(), CopyFrom(), erase_imp(), insert_imp(), SmallPtrSetImpl(), and swap().
const void** llvm::SmallPtrSetImpl::SmallArray [protected] |
SmallArray - Points to a fixed size set of buckets, used in 'small mode'.
Definition at line 52 of file SmallPtrSet.h.
Referenced by CopyFrom(), count_imp(), erase_imp(), insert_imp(), SmallPtrSetImpl(), and swap().