Movatterモバイル変換


[0]ホーム

URL:


LLVM 20.0.0git
SmallPtrSet.h
Go to the documentation of this file.
1//===- llvm/ADT/SmallPtrSet.h - 'Normally small' pointer set ----*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8///
9/// \file
10/// This file defines the SmallPtrSet class. See the doxygen comment for
11/// SmallPtrSetImplBase for more details on the algorithm used.
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_ADT_SMALLPTRSET_H
16#define LLVM_ADT_SMALLPTRSET_H
17
18#include "llvm/ADT/EpochTracker.h"
19#include "llvm/Support/MathExtras.h"
20#include "llvm/Support/ReverseIteration.h"
21#include "llvm/Support/type_traits.h"
22#include <algorithm>
23#include <cassert>
24#include <cstddef>
25#include <cstdlib>
26#include <cstring>
27#include <initializer_list>
28#include <iterator>
29#include <limits>
30#include <utility>
31
32namespacellvm {
33
34/// SmallPtrSetImplBase - This is the common code shared among all the
35/// SmallPtrSet<>'s, which is almost everything. SmallPtrSet has two modes, one
36/// for small and one for large sets.
37///
38/// Small sets use an array of pointers allocated in the SmallPtrSet object,
39/// which is treated as a simple array of pointers. When a pointer is added to
40/// the set, the array is scanned to see if the element already exists, if not
41/// the element is 'pushed back' onto the array. If we run out of space in the
42/// array, we grow into the 'large set' case. SmallSet should be used when the
43/// sets are often small. In this case, no memory allocation is used, and only
44/// light-weight and cache-efficient scanning is used.
45///
46/// Large sets use a classic exponentially-probed hash table. Empty buckets are
47/// represented with an illegal pointer value (-1) to allow null pointers to be
48/// inserted. Tombstones are represented with another illegal pointer value
49/// (-2), to allow deletion. The hash table is resized when the table is 3/4 or
50/// more. When this happens, the table is doubled in size.
51///
52classSmallPtrSetImplBase :publicDebugEpochBase {
53friendclassSmallPtrSetIteratorImpl;
54
55protected:
56 /// The current set of buckets, in either small or big representation.
57constvoid **CurArray;
58 /// CurArraySize - The allocated size of CurArray, always a power of two.
59unsignedCurArraySize;
60
61 /// Number of elements in CurArray that contain a value or are a tombstone.
62 /// If small, all these elements are at the beginning of CurArray and the rest
63 /// is uninitialized.
64unsignedNumNonEmpty;
65 /// Number of tombstones in CurArray.
66unsignedNumTombstones;
67 /// Whether the set is in small representation.
68boolIsSmall;
69
70// Helpers to copy and move construct a SmallPtrSet.
71SmallPtrSetImplBase(constvoid **SmallStorage,
72constSmallPtrSetImplBase &that);
73SmallPtrSetImplBase(constvoid **SmallStorage,unsigned SmallSize,
74constvoid **RHSSmallStorage,SmallPtrSetImplBase &&that);
75
76explicitSmallPtrSetImplBase(constvoid **SmallStorage,unsigned SmallSize)
77 :CurArray(SmallStorage),CurArraySize(SmallSize),NumNonEmpty(0),
78NumTombstones(0),IsSmall(true) {
79assert(SmallSize && (SmallSize & (SmallSize-1)) == 0 &&
80"Initial size must be a power of two!");
81 }
82
83~SmallPtrSetImplBase() {
84if (!isSmall())
85 free(CurArray);
86 }
87
88public:
89usingsize_type =unsigned;
90
91SmallPtrSetImplBase &operator=(constSmallPtrSetImplBase &) =delete;
92
93 [[nodiscard]]boolempty() const{returnsize() == 0; }
94size_typesize() const{returnNumNonEmpty -NumTombstones; }
95size_typecapacity() const{returnCurArraySize; }
96
97voidclear() {
98incrementEpoch();
99// If the capacity of the array is huge, and the # elements used is small,
100// shrink the array.
101if (!isSmall()) {
102if (size() * 4 <CurArraySize &&CurArraySize > 32)
103return shrink_and_clear();
104// Fill the array with empty markers.
105 memset(CurArray, -1,CurArraySize *sizeof(void *));
106 }
107
108NumNonEmpty = 0;
109NumTombstones = 0;
110 }
111
112voidreserve(size_type NumEntries) {
113incrementEpoch();
114// Do nothing if we're given zero as a reservation size.
115if (NumEntries == 0)
116return;
117// No need to expand if we're small and NumEntries will fit in the space.
118if (isSmall() && NumEntries <=CurArraySize)
119return;
120// insert_imp_big will reallocate if stores is more than 75% full, on the
121// /final/ insertion.
122if (!isSmall() && ((NumEntries - 1) * 4) < (CurArraySize * 3))
123return;
124// We must Grow -- find the size where we'd be 75% full, then round up to
125// the next power of two.
126size_type NewSize = NumEntries + (NumEntries / 3);
127 NewSize = 1 << (Log2_32_Ceil(NewSize) + 1);
128// Like insert_imp_big, always allocate at least 128 elements.
129 NewSize = std::max(128u, NewSize);
130 Grow(NewSize);
131 }
132
133protected:
134staticvoid *getTombstoneMarker() {returnreinterpret_cast<void*>(-2); }
135
136staticvoid *getEmptyMarker() {
137// Note that -1 is chosen to make clear() efficiently implementable with
138// memset and because it's not a valid pointer value.
139returnreinterpret_cast<void*>(-1);
140 }
141
142constvoid **EndPointer() const{
143returnisSmall() ?CurArray +NumNonEmpty :CurArray +CurArraySize;
144 }
145
146 /// insert_imp - This returns true if the pointer was new to the set, false if
147 /// it was already in the set. This is hidden from the client so that the
148 /// derived class can check that the right type of pointer is passed in.
149 std::pair<const void *const *, bool>insert_imp(constvoid *Ptr) {
150if (isSmall()) {
151// Check to see if it is already in the set.
152for (constvoid **APtr =CurArray, **E =CurArray +NumNonEmpty;
153 APtr !=E; ++APtr) {
154constvoid *Value = *APtr;
155if (Value ==Ptr)
156return std::make_pair(APtr,false);
157 }
158
159// Nope, there isn't. If we stay small, just 'pushback' now.
160if (NumNonEmpty <CurArraySize) {
161CurArray[NumNonEmpty++] =Ptr;
162incrementEpoch();
163return std::make_pair(CurArray + (NumNonEmpty - 1),true);
164 }
165// Otherwise, hit the big set case, which will call grow.
166 }
167return insert_imp_big(Ptr);
168 }
169
170 /// erase_imp - If the set contains the specified pointer, remove it and
171 /// return true, otherwise return false. This is hidden from the client so
172 /// that the derived class can check that the right type of pointer is passed
173 /// in.
174boolerase_imp(constvoid *Ptr) {
175if (isSmall()) {
176for (constvoid **APtr =CurArray, **E =CurArray +NumNonEmpty;
177 APtr !=E; ++APtr) {
178if (*APtr ==Ptr) {
179 *APtr =CurArray[--NumNonEmpty];
180incrementEpoch();
181returntrue;
182 }
183 }
184returnfalse;
185 }
186
187auto *Bucket = doFind(Ptr);
188if (!Bucket)
189returnfalse;
190
191 *const_cast<constvoid **>(Bucket) =getTombstoneMarker();
192NumTombstones++;
193// Treat this consistently from an API perspective, even if we don't
194// actually invalidate iterators here.
195incrementEpoch();
196returntrue;
197 }
198
199 /// Returns the raw pointer needed to construct an iterator. If element not
200 /// found, this will be EndPointer. Otherwise, it will be a pointer to the
201 /// slot which stores Ptr;
202constvoid *const *find_imp(constvoid *Ptr) const{
203if (isSmall()) {
204// Linear search for the item.
205for (constvoid *const *APtr =CurArray, *const *E =
206CurArray +NumNonEmpty;
207 APtr !=E; ++APtr)
208if (*APtr ==Ptr)
209return APtr;
210returnEndPointer();
211 }
212
213// Big set case.
214if (auto *Bucket = doFind(Ptr))
215return Bucket;
216returnEndPointer();
217 }
218
219boolcontains_imp(constvoid *Ptr) const{
220if (isSmall()) {
221// Linear search for the item.
222constvoid *const *APtr =CurArray;
223constvoid *const *E =CurArray +NumNonEmpty;
224for (; APtr !=E; ++APtr)
225if (*APtr ==Ptr)
226returntrue;
227returnfalse;
228 }
229
230return doFind(Ptr) !=nullptr;
231 }
232
233boolisSmall() const{returnIsSmall; }
234
235private:
236 std::pair<const void *const *, bool> insert_imp_big(constvoid *Ptr);
237
238constvoid *const *doFind(constvoid *Ptr)const;
239constvoid *const *FindBucketFor(constvoid *Ptr)const;
240void shrink_and_clear();
241
242 /// Grow - Allocate a larger backing store for the buckets and move it over.
243void Grow(unsigned NewSize);
244
245protected:
246 /// swap - Swaps the elements of two sets.
247 /// Note: This method assumes that both sets have the same small size.
248void swap(constvoid **SmallStorage,constvoid **RHSSmallStorage,
249SmallPtrSetImplBase &RHS);
250
251voidcopyFrom(constvoid **SmallStorage,constSmallPtrSetImplBase &RHS);
252voidmoveFrom(constvoid **SmallStorage,unsigned SmallSize,
253constvoid **RHSSmallStorage,SmallPtrSetImplBase &&RHS);
254
255private:
256 /// Code shared by moveFrom() and move constructor.
257void moveHelper(constvoid **SmallStorage,unsigned SmallSize,
258constvoid **RHSSmallStorage,SmallPtrSetImplBase &&RHS);
259 /// Code shared by copyFrom() and copy constructor.
260void copyHelper(constSmallPtrSetImplBase &RHS);
261};
262
263/// SmallPtrSetIteratorImpl - This is the common base class shared between all
264/// instances of SmallPtrSetIterator.
265classSmallPtrSetIteratorImpl {
266protected:
267constvoid *const *Bucket;
268constvoid *const *End;
269
270public:
271explicitSmallPtrSetIteratorImpl(constvoid *const *BP,constvoid*const *E)
272 :Bucket(BP),End(E) {
273if (shouldReverseIterate()) {
274RetreatIfNotValid();
275return;
276 }
277AdvanceIfNotValid();
278 }
279
280booloperator==(constSmallPtrSetIteratorImpl &RHS) const{
281returnBucket ==RHS.Bucket;
282 }
283booloperator!=(constSmallPtrSetIteratorImpl &RHS) const{
284returnBucket !=RHS.Bucket;
285 }
286
287protected:
288 /// AdvanceIfNotValid - If the current bucket isn't valid, advance to a bucket
289 /// that is. This is guaranteed to stop because the end() bucket is marked
290 /// valid.
291voidAdvanceIfNotValid() {
292assert(Bucket <=End);
293while (Bucket !=End &&
294 (*Bucket ==SmallPtrSetImplBase::getEmptyMarker() ||
295 *Bucket ==SmallPtrSetImplBase::getTombstoneMarker()))
296 ++Bucket;
297 }
298voidRetreatIfNotValid() {
299assert(Bucket >=End);
300while (Bucket !=End &&
301 (Bucket[-1] ==SmallPtrSetImplBase::getEmptyMarker() ||
302Bucket[-1] ==SmallPtrSetImplBase::getTombstoneMarker())) {
303 --Bucket;
304 }
305 }
306};
307
308/// SmallPtrSetIterator - This implements a const_iterator for SmallPtrSet.
309template <typename PtrTy>
310classLLVM_DEBUGEPOCHBASE_HANDLEBASE_EMPTYBASESmallPtrSetIterator
311 :publicSmallPtrSetIteratorImpl,
312DebugEpochBase::HandleBase {
313usingPtrTraits =PointerLikeTypeTraits<PtrTy>;
314
315public:
316usingvalue_type = PtrTy;
317usingreference = PtrTy;
318usingpointer = PtrTy;
319usingdifference_type = std::ptrdiff_t;
320usingiterator_category = std::forward_iterator_tag;
321
322explicitSmallPtrSetIterator(constvoid *const *BP,constvoid *const *E,
323constDebugEpochBase &Epoch)
324 :SmallPtrSetIteratorImpl(BP,E),DebugEpochBase::HandleBase(&Epoch) {}
325
326// Most methods are provided by the base class.
327
328const PtrTyoperator*() const{
329assert(isHandleInSync() &&"invalid iterator access!");
330if (shouldReverseIterate()) {
331assert(Bucket >End);
332return PtrTraits::getFromVoidPointer(const_cast<void *>(Bucket[-1]));
333 }
334assert(Bucket <End);
335return PtrTraits::getFromVoidPointer(const_cast<void*>(*Bucket));
336 }
337
338inlineSmallPtrSetIterator&operator++() {// Preincrement
339assert(isHandleInSync() &&"invalid iterator access!");
340if (shouldReverseIterate()) {
341 --Bucket;
342 RetreatIfNotValid();
343return *this;
344 }
345 ++Bucket;
346 AdvanceIfNotValid();
347return *this;
348 }
349
350SmallPtrSetIteratoroperator++(int) {// Postincrement
351SmallPtrSetIterator tmp = *this;
352 ++*this;
353return tmp;
354 }
355};
356
357/// A templated base class for \c SmallPtrSet which provides the
358/// typesafe interface that is common across all small sizes.
359///
360/// This is particularly useful for passing around between interface boundaries
361/// to avoid encoding a particular small size in the interface boundary.
362template <typename PtrType>
363classSmallPtrSetImpl :publicSmallPtrSetImplBase {
364usingConstPtrType =typenameadd_const_past_pointer<PtrType>::type;
365usingPtrTraits =PointerLikeTypeTraits<PtrType>;
366usingConstPtrTraits =PointerLikeTypeTraits<ConstPtrType>;
367
368protected:
369// Forward constructors to the base.
370usingSmallPtrSetImplBase::SmallPtrSetImplBase;
371
372public:
373usingiterator =SmallPtrSetIterator<PtrType>;
374usingconst_iterator =SmallPtrSetIterator<PtrType>;
375usingkey_type = ConstPtrType;
376usingvalue_type = PtrType;
377
378SmallPtrSetImpl(constSmallPtrSetImpl &) =delete;
379
380 /// Inserts Ptr if and only if there is no element in the container equal to
381 /// Ptr. The bool component of the returned pair is true if and only if the
382 /// insertion takes place, and the iterator component of the pair points to
383 /// the element equal to Ptr.
384 std::pair<iterator, bool>insert(PtrTypePtr) {
385auto p =insert_imp(PtrTraits::getAsVoidPointer(Ptr));
386return std::make_pair(makeIterator(p.first), p.second);
387 }
388
389 /// Insert the given pointer with an iterator hint that is ignored. This is
390 /// identical to calling insert(Ptr), but allows SmallPtrSet to be used by
391 /// std::insert_iterator and std::inserter().
392iteratorinsert(iterator, PtrTypePtr) {
393returninsert(Ptr).first;
394 }
395
396 /// Remove pointer from the set.
397 ///
398 /// Returns whether the pointer was in the set. Invalidates iterators if
399 /// true is returned. To remove elements while iterating over the set, use
400 /// remove_if() instead.
401boolerase(PtrTypePtr) {
402returnerase_imp(PtrTraits::getAsVoidPointer(Ptr));
403 }
404
405 /// Remove elements that match the given predicate.
406 ///
407 /// This method is a safe replacement for the following pattern, which is not
408 /// valid, because the erase() calls would invalidate the iterator:
409 ///
410 /// for (PtrType *Ptr : Set)
411 /// if (Pred(P))
412 /// Set.erase(P);
413 ///
414 /// Returns whether anything was removed. It is safe to read the set inside
415 /// the predicate function. However, the predicate must not modify the set
416 /// itself, only indicate a removal by returning true.
417template <typename UnaryPredicate>
418boolremove_if(UnaryPredicateP) {
419bool Removed =false;
420if (isSmall()) {
421constvoid **APtr =CurArray, **E =CurArray +NumNonEmpty;
422while (APtr !=E) {
423 PtrTypePtr = PtrTraits::getFromVoidPointer(const_cast<void *>(*APtr));
424if (P(Ptr)) {
425 *APtr = *--E;
426 --NumNonEmpty;
427incrementEpoch();
428 Removed =true;
429 }else {
430 ++APtr;
431 }
432 }
433return Removed;
434 }
435
436for (constvoid **APtr =CurArray, **E =EndPointer(); APtr !=E; ++APtr) {
437constvoid *Value = *APtr;
438if (Value ==getTombstoneMarker() ||Value ==getEmptyMarker())
439continue;
440 PtrTypePtr = PtrTraits::getFromVoidPointer(const_cast<void *>(Value));
441if (P(Ptr)) {
442 *APtr =getTombstoneMarker();
443 ++NumTombstones;
444incrementEpoch();
445 Removed =true;
446 }
447 }
448return Removed;
449 }
450
451 /// count - Return 1 if the specified pointer is in the set, 0 otherwise.
452size_typecount(ConstPtrTypePtr) const{
453returncontains_imp(ConstPtrTraits::getAsVoidPointer(Ptr));
454 }
455iteratorfind(ConstPtrTypePtr) const{
456return makeIterator(find_imp(ConstPtrTraits::getAsVoidPointer(Ptr)));
457 }
458boolcontains(ConstPtrTypePtr) const{
459returncontains_imp(ConstPtrTraits::getAsVoidPointer(Ptr));
460 }
461
462template <typename IterT>
463voidinsert(IterTI, IterTE) {
464for (;I !=E; ++I)
465insert(*I);
466 }
467
468voidinsert(std::initializer_list<PtrType> IL) {
469insert(IL.begin(), IL.end());
470 }
471
472iteratorbegin() const{
473if (shouldReverseIterate())
474return makeIterator(EndPointer() - 1);
475return makeIterator(CurArray);
476 }
477iteratorend() const{return makeIterator(EndPointer()); }
478
479private:
480 /// Create an iterator that dereferences to same place as the given pointer.
481iterator makeIterator(constvoid *const *P) const{
482if (shouldReverseIterate())
483returniterator(P ==EndPointer() ?CurArray :P + 1,CurArray, *this);
484returniterator(P,EndPointer(), *this);
485 }
486};
487
488/// Equality comparison for SmallPtrSet.
489///
490/// Iterates over elements of LHS confirming that each value from LHS is also in
491/// RHS, and that no additional values are in RHS.
492template <typename PtrType>
493booloperator==(constSmallPtrSetImpl<PtrType> &LHS,
494constSmallPtrSetImpl<PtrType> &RHS) {
495if (LHS.size() !=RHS.size())
496returnfalse;
497
498for (constauto *KV :LHS)
499if (!RHS.count(KV))
500returnfalse;
501
502returntrue;
503}
504
505/// Inequality comparison for SmallPtrSet.
506///
507/// Equivalent to !(LHS == RHS).
508template <typename PtrType>
509booloperator!=(constSmallPtrSetImpl<PtrType> &LHS,
510constSmallPtrSetImpl<PtrType> &RHS) {
511return !(LHS ==RHS);
512}
513
514/// SmallPtrSet - This class implements a set which is optimized for holding
515/// SmallSize or less elements. This internally rounds up SmallSize to the next
516/// power of two if it is not already a power of two. See the comments above
517/// SmallPtrSetImplBase for details of the algorithm.
518template<class PtrType,unsigned SmallSize>
519classSmallPtrSet :publicSmallPtrSetImpl<PtrType> {
520// In small mode SmallPtrSet uses linear search for the elements, so it is
521// not a good idea to choose this value too high. You may consider using a
522// DenseSet<> instead if you expect many elements in the set.
523static_assert(SmallSize <= 32,"SmallSize should be small");
524
525usingBaseT =SmallPtrSetImpl<PtrType>;
526
527// A constexpr version of llvm::bit_ceil.
528// TODO: Replace this with std::bit_ceil once C++20 is available.
529staticconstexprsize_t RoundUpToPowerOfTwo(size_tX) {
530size_tC = 1;
531size_t CMax =C << (std::numeric_limits<size_t>::digits - 1);
532while (C <X &&C < CMax)
533C <<= 1;
534returnC;
535 }
536
537// Make sure that SmallSize is a power of two, round up if not.
538staticconstexprsize_t SmallSizePowTwo = RoundUpToPowerOfTwo(SmallSize);
539 /// SmallStorage - Fixed size storage used in 'small mode'.
540constvoid *SmallStorage[SmallSizePowTwo];
541
542public:
543SmallPtrSet() :BaseT(SmallStorage, SmallSizePowTwo) {}
544SmallPtrSet(constSmallPtrSet &that) :BaseT(SmallStorage, that) {}
545SmallPtrSet(SmallPtrSet &&that)
546 :BaseT(SmallStorage, SmallSizePowTwo, that.SmallStorage,
547std::move(that)) {}
548
549template<typename It>
550SmallPtrSet(ItI, ItE) :BaseT(SmallStorage, SmallSizePowTwo) {
551 this->insert(I,E);
552 }
553
554SmallPtrSet(std::initializer_list<PtrType> IL)
555 :BaseT(SmallStorage, SmallSizePowTwo) {
556 this->insert(IL.begin(), IL.end());
557 }
558
559SmallPtrSet<PtrType, SmallSize> &
560operator=(constSmallPtrSet<PtrType, SmallSize> &RHS) {
561if (&RHS !=this)
562 this->copyFrom(SmallStorage,RHS);
563return *this;
564 }
565
566SmallPtrSet<PtrType, SmallSize> &
567operator=(SmallPtrSet<PtrType, SmallSize> &&RHS) {
568if (&RHS !=this)
569 this->moveFrom(SmallStorage, SmallSizePowTwo,RHS.SmallStorage,
570 std::move(RHS));
571return *this;
572 }
573
574SmallPtrSet<PtrType, SmallSize> &
575operator=(std::initializer_list<PtrType> IL) {
576 this->clear();
577 this->insert(IL.begin(), IL.end());
578return *this;
579 }
580
581 /// swap - Swaps the elements of two sets.
582voidswap(SmallPtrSet<PtrType, SmallSize> &RHS) {
583SmallPtrSetImplBase::swap(SmallStorage,RHS.SmallStorage,RHS);
584 }
585};
586
587}// end namespace llvm
588
589namespacestd {
590
591 /// Implement std::swap in terms of SmallPtrSet swap.
592template<class T,unsigned N>
593inlinevoidswap(llvm::SmallPtrSet<T, N> &LHS,llvm::SmallPtrSet<T, N> &RHS) {
594LHS.swap(RHS);
595 }
596
597}// end namespace std
598
599#endif// LLVM_ADT_SMALLPTRSET_H
true
basic Basic Alias true
Definition:BasicAliasAnalysis.cpp:1981
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
End
bool End
Definition:ELF_riscv.cpp:480
EpochTracker.h
This file defines the DebugEpochBase and DebugEpochBase::HandleBase classes.
LLVM_DEBUGEPOCHBASE_HANDLEBASE_EMPTYBASE
#define LLVM_DEBUGEPOCHBASE_HANDLEBASE_EMPTYBASE
Definition:EpochTracker.h:85
X
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
I
#define I(x, y, z)
Definition:MD5.cpp:58
MathExtras.h
P
#define P(N)
ReverseIteration.h
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Ptr
@ Ptr
Definition:TargetLibraryInfo.cpp:77
RHS
Value * RHS
Definition:X86PartialReduction.cpp:74
LHS
Value * LHS
Definition:X86PartialReduction.cpp:73
llvm::DebugEpochBase::HandleBase
Definition:EpochTracker.h:92
llvm::DebugEpochBase
Definition:EpochTracker.h:88
llvm::DebugEpochBase::incrementEpoch
void incrementEpoch()
Definition:EpochTracker.h:90
llvm::SmallPtrSetImplBase
SmallPtrSetImplBase - This is the common code shared among all the SmallPtrSet<>'s,...
Definition:SmallPtrSet.h:52
llvm::SmallPtrSetImplBase::size
size_type size() const
Definition:SmallPtrSet.h:94
llvm::SmallPtrSetImplBase::clear
void clear()
Definition:SmallPtrSet.h:97
llvm::SmallPtrSetImplBase::find_imp
const void *const * find_imp(const void *Ptr) const
Returns the raw pointer needed to construct an iterator.
Definition:SmallPtrSet.h:202
llvm::SmallPtrSetImplBase::NumTombstones
unsigned NumTombstones
Number of tombstones in CurArray.
Definition:SmallPtrSet.h:66
llvm::SmallPtrSetImplBase::SmallPtrSetImplBase
SmallPtrSetImplBase(const void **SmallStorage, const SmallPtrSetImplBase &that)
Definition:SmallPtrSet.cpp:140
llvm::SmallPtrSetImplBase::isSmall
bool isSmall() const
Definition:SmallPtrSet.h:233
llvm::SmallPtrSetImplBase::SmallPtrSetImplBase
SmallPtrSetImplBase(const void **SmallStorage, unsigned SmallSize)
Definition:SmallPtrSet.h:76
llvm::SmallPtrSetImplBase::CurArray
const void ** CurArray
The current set of buckets, in either small or big representation.
Definition:SmallPtrSet.h:57
llvm::SmallPtrSetImplBase::IsSmall
bool IsSmall
Whether the set is in small representation.
Definition:SmallPtrSet.h:68
llvm::SmallPtrSetImplBase::copyFrom
void copyFrom(const void **SmallStorage, const SmallPtrSetImplBase &RHS)
Definition:SmallPtrSet.cpp:162
llvm::SmallPtrSetImplBase::contains_imp
bool contains_imp(const void *Ptr) const
Definition:SmallPtrSet.h:219
llvm::SmallPtrSetImplBase::NumNonEmpty
unsigned NumNonEmpty
Number of elements in CurArray that contain a value or are a tombstone.
Definition:SmallPtrSet.h:64
llvm::SmallPtrSetImplBase::insert_imp
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.
Definition:SmallPtrSet.h:149
llvm::SmallPtrSetImplBase::operator=
SmallPtrSetImplBase & operator=(const SmallPtrSetImplBase &)=delete
llvm::SmallPtrSetImplBase::moveFrom
void moveFrom(const void **SmallStorage, unsigned SmallSize, const void **RHSSmallStorage, SmallPtrSetImplBase &&RHS)
Definition:SmallPtrSet.cpp:202
llvm::SmallPtrSetImplBase::CurArraySize
unsigned CurArraySize
CurArraySize - The allocated size of CurArray, always a power of two.
Definition:SmallPtrSet.h:59
llvm::SmallPtrSetImplBase::EndPointer
const void ** EndPointer() const
Definition:SmallPtrSet.h:142
llvm::SmallPtrSetImplBase::erase_imp
bool erase_imp(const void *Ptr)
erase_imp - If the set contains the specified pointer, remove it and return true, otherwise return fa...
Definition:SmallPtrSet.h:174
llvm::SmallPtrSetImplBase::~SmallPtrSetImplBase
~SmallPtrSetImplBase()
Definition:SmallPtrSet.h:83
llvm::SmallPtrSetImplBase::getEmptyMarker
static void * getEmptyMarker()
Definition:SmallPtrSet.h:136
llvm::SmallPtrSetImplBase::reserve
void reserve(size_type NumEntries)
Definition:SmallPtrSet.h:112
llvm::SmallPtrSetImplBase::getTombstoneMarker
static void * getTombstoneMarker()
Definition:SmallPtrSet.h:134
llvm::SmallPtrSetImplBase::swap
void swap(const void **SmallStorage, const void **RHSSmallStorage, SmallPtrSetImplBase &RHS)
swap - Swaps the elements of two sets.
Definition:SmallPtrSet.cpp:239
llvm::SmallPtrSetImplBase::capacity
size_type capacity() const
Definition:SmallPtrSet.h:95
llvm::SmallPtrSetImplBase::empty
bool empty() const
Definition:SmallPtrSet.h:93
llvm::SmallPtrSetImpl
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
Definition:SmallPtrSet.h:363
llvm::SmallPtrSetImpl::insert
iterator insert(iterator, PtrType Ptr)
Insert the given pointer with an iterator hint that is ignored.
Definition:SmallPtrSet.h:392
llvm::SmallPtrSetImpl::erase
bool erase(PtrType Ptr)
Remove pointer from the set.
Definition:SmallPtrSet.h:401
llvm::SmallPtrSetImpl::find
iterator find(ConstPtrType Ptr) const
Definition:SmallPtrSet.h:455
llvm::SmallPtrSetImpl::count
size_type count(ConstPtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
Definition:SmallPtrSet.h:452
llvm::SmallPtrSetImpl::SmallPtrSetImpl
SmallPtrSetImpl(const SmallPtrSetImpl &)=delete
llvm::SmallPtrSetImpl::insert
void insert(IterT I, IterT E)
Definition:SmallPtrSet.h:463
llvm::SmallPtrSetImpl::remove_if
bool remove_if(UnaryPredicate P)
Remove elements that match the given predicate.
Definition:SmallPtrSet.h:418
llvm::SmallPtrSetImpl::end
iterator end() const
Definition:SmallPtrSet.h:477
llvm::SmallPtrSetImpl::key_type
ConstPtrType key_type
Definition:SmallPtrSet.h:375
llvm::SmallPtrSetImpl::insert
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
Definition:SmallPtrSet.h:384
llvm::SmallPtrSetImpl::iterator
SmallPtrSetIterator< PtrType > iterator
Definition:SmallPtrSet.h:373
llvm::SmallPtrSetImpl::begin
iterator begin() const
Definition:SmallPtrSet.h:472
llvm::SmallPtrSetImpl::insert
void insert(std::initializer_list< PtrType > IL)
Definition:SmallPtrSet.h:468
llvm::SmallPtrSetImpl::value_type
PtrType value_type
Definition:SmallPtrSet.h:376
llvm::SmallPtrSetImpl::contains
bool contains(ConstPtrType Ptr) const
Definition:SmallPtrSet.h:458
llvm::SmallPtrSetIteratorImpl
SmallPtrSetIteratorImpl - This is the common base class shared between all instances of SmallPtrSetIt...
Definition:SmallPtrSet.h:265
llvm::SmallPtrSetIteratorImpl::operator!=
bool operator!=(const SmallPtrSetIteratorImpl &RHS) const
Definition:SmallPtrSet.h:283
llvm::SmallPtrSetIteratorImpl::RetreatIfNotValid
void RetreatIfNotValid()
Definition:SmallPtrSet.h:298
llvm::SmallPtrSetIteratorImpl::SmallPtrSetIteratorImpl
SmallPtrSetIteratorImpl(const void *const *BP, const void *const *E)
Definition:SmallPtrSet.h:271
llvm::SmallPtrSetIteratorImpl::End
const void *const * End
Definition:SmallPtrSet.h:268
llvm::SmallPtrSetIteratorImpl::Bucket
const void *const * Bucket
Definition:SmallPtrSet.h:267
llvm::SmallPtrSetIteratorImpl::operator==
bool operator==(const SmallPtrSetIteratorImpl &RHS) const
Definition:SmallPtrSet.h:280
llvm::SmallPtrSetIteratorImpl::AdvanceIfNotValid
void AdvanceIfNotValid()
AdvanceIfNotValid - If the current bucket isn't valid, advance to a bucket that is.
Definition:SmallPtrSet.h:291
llvm::SmallPtrSetIterator
SmallPtrSetIterator - This implements a const_iterator for SmallPtrSet.
Definition:SmallPtrSet.h:312
llvm::SmallPtrSetIterator::operator*
const PtrTy operator*() const
Definition:SmallPtrSet.h:328
llvm::SmallPtrSetIterator::difference_type
std::ptrdiff_t difference_type
Definition:SmallPtrSet.h:319
llvm::SmallPtrSetIterator::value_type
PtrTy value_type
Definition:SmallPtrSet.h:316
llvm::SmallPtrSetIterator::SmallPtrSetIterator
SmallPtrSetIterator(const void *const *BP, const void *const *E, const DebugEpochBase &Epoch)
Definition:SmallPtrSet.h:322
llvm::SmallPtrSetIterator::pointer
PtrTy pointer
Definition:SmallPtrSet.h:318
llvm::SmallPtrSetIterator::operator++
SmallPtrSetIterator operator++(int)
Definition:SmallPtrSet.h:350
llvm::SmallPtrSetIterator::operator++
SmallPtrSetIterator & operator++()
Definition:SmallPtrSet.h:338
llvm::SmallPtrSetIterator::iterator_category
std::forward_iterator_tag iterator_category
Definition:SmallPtrSet.h:320
llvm::SmallPtrSetIterator::reference
PtrTy reference
Definition:SmallPtrSet.h:317
llvm::SmallPtrSet
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
Definition:SmallPtrSet.h:519
llvm::SmallPtrSet::SmallPtrSet
SmallPtrSet(SmallPtrSet &&that)
Definition:SmallPtrSet.h:545
llvm::SmallPtrSet::SmallPtrSet
SmallPtrSet(It I, It E)
Definition:SmallPtrSet.h:550
llvm::SmallPtrSet::operator=
SmallPtrSet< PtrType, SmallSize > & operator=(SmallPtrSet< PtrType, SmallSize > &&RHS)
Definition:SmallPtrSet.h:567
llvm::SmallPtrSet::swap
void swap(SmallPtrSet< PtrType, SmallSize > &RHS)
swap - Swaps the elements of two sets.
Definition:SmallPtrSet.h:582
llvm::SmallPtrSet::SmallPtrSet
SmallPtrSet(std::initializer_list< PtrType > IL)
Definition:SmallPtrSet.h:554
llvm::SmallPtrSet::operator=
SmallPtrSet< PtrType, SmallSize > & operator=(const SmallPtrSet< PtrType, SmallSize > &RHS)
Definition:SmallPtrSet.h:560
llvm::SmallPtrSet::SmallPtrSet
SmallPtrSet(const SmallPtrSet &that)
Definition:SmallPtrSet.h:544
llvm::SmallPtrSet::operator=
SmallPtrSet< PtrType, SmallSize > & operator=(std::initializer_list< PtrType > IL)
Definition:SmallPtrSet.h:575
llvm::SmallPtrSet::SmallPtrSet
SmallPtrSet()
Definition:SmallPtrSet.h:543
llvm::Value
LLVM Value Representation.
Definition:Value.h:74
unsigned
llvm::CallingConv::C
@ C
The default llvm calling convention, compatible with C.
Definition:CallingConv.h:34
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition:AddressRanges.h:18
llvm::Log2_32_Ceil
unsigned Log2_32_Ceil(uint32_t Value)
Return the ceil log base 2 of the specified value, 32 if the value is zero.
Definition:MathExtras.h:354
llvm::operator!=
bool operator!=(uint64_t V1, const APInt &V2)
Definition:APInt.h:2082
llvm::operator==
bool operator==(const AddressRangeValuePair &LHS, const AddressRangeValuePair &RHS)
Definition:AddressRanges.h:153
llvm::shouldReverseIterate
bool shouldReverseIterate()
Definition:ReverseIteration.h:10
llvm::move
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition:STLExtras.h:1873
std
Implement std::hash so that hash_code can be used in STL containers.
Definition:BitVector.h:858
std::swap
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
Definition:BitVector.h:860
llvm::PointerLikeTypeTraits
A traits type that is used to handle pointer types and things that are just wrappers for pointers as ...
Definition:PointerLikeTypeTraits.h:25
llvm::add_const_past_pointer::type
const T type
Definition:type_traits.h:55
type_traits.h

Generated on Thu Jul 17 2025 04:49:24 for LLVM by doxygen 1.9.6
[8]ページ先頭

©2009-2025 Movatter.jp