LLVM 22.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/ADL.h"
26#include <algorithm>
27#include <cassert>
28#include <cstddef>
29#include <cstdlib>
30#include <cstring>
31#include <initializer_list>
32#include <iterator>
33#include <limits>
34#include <utility>
35
36namespace llvm {
37
38/// SmallPtrSetImplBase - This is the common code shared among all the
39/// SmallPtrSet<>'s, which is almost everything. SmallPtrSet has two modes, one
40/// for small and one for large sets.
41///
42/// Small sets use an array of pointers allocated in the SmallPtrSet object,
43/// which is treated as a simple array of pointers. When a pointer is added to
44/// the set, the array is scanned to see if the element already exists, if not
45/// the element is 'pushed back' onto the array. If we run out of space in the
46/// array, we grow into the 'large set' case. SmallSet should be used when the
47/// sets are often small. In this case, no memory allocation is used, and only
48/// light-weight and cache-efficient scanning is used.
49///
50/// Large sets use a classic quadratically-probed hash table. Empty buckets are
51/// represented with an illegal pointer value (-1) to allow null pointers to be
52/// inserted. Tombstones are represented with another illegal pointer value
53/// (-2), to allow deletion. The hash table is resized when the table is 3/4 or
54/// more. When this happens, the table is doubled in size.
55///
58
59protected:
60 /// The current set of buckets, in either small or big representation.
61 const void **CurArray;
62 /// CurArraySize - The allocated size of CurArray, always a power of two.
63 unsigned CurArraySize;
64
65 /// Number of elements in CurArray that contain a value.
66 /// If small, all these elements are at the beginning of CurArray and the rest
67 /// is uninitialized.
68 unsigned NumEntries;
69 /// Number of tombstones in CurArray.
70 unsigned NumTombstones;
71 /// Whether the set is in small representation.
72 bool IsSmall;
73
74 // Helpers to copy and move construct a SmallPtrSet.
75 LLVM_ABI SmallPtrSetImplBase(const void **SmallStorage,
76 const SmallPtrSetImplBase &that);
77 LLVM_ABI SmallPtrSetImplBase(const void **SmallStorage, unsigned SmallSize,
78 const void **RHSSmallStorage,
79 SmallPtrSetImplBase &&that);
80
81 explicit SmallPtrSetImplBase(const void **SmallStorage, unsigned SmallSize)
82 : CurArray(SmallStorage), CurArraySize(SmallSize), NumEntries(0),
84 assert(llvm::has_single_bit(SmallSize) &&
85 "Initial size must be a power of two!");
86 }
87
89 if (!isSmall())
90 free(CurArray);
91 }
92
93public:
95
97
98 [[nodiscard]] bool empty() const { return size() == 0; }
99 size_type size() const { return NumEntries; }
100 size_type capacity() const { return CurArraySize; }
101
102 void clear() {
104 // If the capacity of the array is huge, and the # elements used is small,
105 // shrink the array.
106 if (!isSmall()) {
107 if (size() * 4 < CurArraySize && CurArraySize > 32)
108 return shrink_and_clear();
109 // Fill the array with empty markers.
110 memset(CurArray, -1, CurArraySize * sizeof(void *));
111 }
112
113 NumEntries = 0;
114 NumTombstones = 0;
115 }
116
117 void reserve(size_type NewNumEntries) {
119 // Do nothing if we're given zero as a reservation size.
120 if (NewNumEntries == 0)
121 return;
122 // No need to expand if we're small and NewNumEntries will fit in the space.
123 if (isSmall() && NewNumEntries <= CurArraySize)
124 return;
125 // insert_imp_big will reallocate if stores is more than 75% full, on the
126 // /final/ insertion.
127 if (!isSmall() && ((NewNumEntries - 1) * 4) < (CurArraySize * 3))
128 return;
129 // We must Grow -- find the size where we'd be 75% full, then round up to
130 // the next power of two.
131 size_type NewSize = NewNumEntries + (NewNumEntries / 3);
132 NewSize = llvm::bit_ceil(NewSize);
133 // Like insert_imp_big, always allocate at least 128 elements.
134 NewSize = std::max(128u, NewSize);
135 Grow(NewSize);
136 }
137
138protected:
139 static void *getTombstoneMarker() { return reinterpret_cast<void*>(-2); }
140
141 static void *getEmptyMarker() {
142 // Note that -1 is chosen to make clear() efficiently implementable with
143 // memset and because it's not a valid pointer value.
144 return reinterpret_cast<void*>(-1);
145 }
146
147 const void **EndPointer() const {
149 }
150
153 }
154
156 return {CurArray, CurArray + NumEntries};
157 }
158
160 return make_range(CurArray, EndPointer());
161 }
162
164 return make_range(CurArray, EndPointer());
165 }
166
167 /// insert_imp - This returns true if the pointer was new to the set, false if
168 /// it was already in the set. This is hidden from the client so that the
169 /// derived class can check that the right type of pointer is passed in.
170 std::pair<const void *const *, bool> insert_imp(const void *Ptr) {
171 if (isSmall()) {
172 // Check to see if it is already in the set.
173 for (const void *&Bucket : small_buckets()) {
174 if (Bucket == Ptr)
175 return {&Bucket, false};
176 }
177
178 // Nope, there isn't. If we stay small, just 'pushback' now.
179 if (NumEntries < CurArraySize) {
182 return {CurArray + (NumEntries - 1), true};
183 }
184 // Otherwise, hit the big set case, which will call grow.
185 }
186 return insert_imp_big(Ptr);
187 }
188
189 /// erase_imp - If the set contains the specified pointer, remove it and
190 /// return true, otherwise return false. This is hidden from the client so
191 /// that the derived class can check that the right type of pointer is passed
192 /// in.
193 bool erase_imp(const void * Ptr) {
194 if (isSmall()) {
195 for (const void *&Bucket : small_buckets()) {
196 if (Bucket == Ptr) {
197 Bucket = CurArray[--NumEntries];
199 return true;
200 }
201 }
202 return false;
203 }
204
205 auto *Bucket = doFind(Ptr);
206 if (!Bucket)
207 return false;
208
209 *const_cast<const void **>(Bucket) = getTombstoneMarker();
211 --NumEntries;
212 // Treat this consistently from an API perspective, even if we don't
213 // actually invalidate iterators here.
215 return true;
216 }
217
218 /// Returns the raw pointer needed to construct an iterator. If element not
219 /// found, this will be EndPointer. Otherwise, it will be a pointer to the
220 /// slot which stores Ptr;
221 const void *const * find_imp(const void * Ptr) const {
222 if (isSmall()) {
223 // Linear search for the item.
224 for (const void *const &Bucket : small_buckets())
225 if (Bucket == Ptr)
226 return &Bucket;
227 return EndPointer();
228 }
229
230 // Big set case.
231 if (auto *Bucket = doFind(Ptr))
232 return Bucket;
233 return EndPointer();
234 }
235
236 bool contains_imp(const void *Ptr) const {
237 if (isSmall()) {
238 // Linear search for the item.
239 for (const void *const &Bucket : small_buckets())
240 if (Bucket == Ptr)
241 return true;
242 return false;
243 }
244
245 return doFind(Ptr) != nullptr;
246 }
247
248 bool isSmall() const { return IsSmall; }
249
250private:
251 LLVM_ABI std::pair<const void *const *, bool> insert_imp_big(const void *Ptr);
252
253 LLVM_ABI const void *const *doFind(const void *Ptr) const;
254 const void * const *FindBucketFor(const void *Ptr) const;
255 LLVM_ABI void shrink_and_clear();
256
257 /// Grow - Allocate a larger backing store for the buckets and move it over.
258 LLVM_ABI void Grow(unsigned NewSize);
259
260protected:
261 /// swap - Swaps the elements of two sets.
262 /// Note: This method assumes that both sets have the same small size.
263 LLVM_ABI void swap(const void **SmallStorage, const void **RHSSmallStorage,
265
266 LLVM_ABI void copyFrom(const void **SmallStorage,
267 const SmallPtrSetImplBase &RHS);
268 LLVM_ABI void moveFrom(const void **SmallStorage, unsigned SmallSize,
269 const void **RHSSmallStorage,
271
272private:
273 /// Code shared by moveFrom() and move constructor.
274 void moveHelper(const void **SmallStorage, unsigned SmallSize,
275 const void **RHSSmallStorage, SmallPtrSetImplBase &&RHS);
276 /// Code shared by copyFrom() and copy constructor.
277 void copyHelper(const SmallPtrSetImplBase &RHS);
278};
279
280/// SmallPtrSetIteratorImpl - This is the common base class shared between all
281/// instances of SmallPtrSetIterator.
283protected:
284 const void *const *Bucket;
285 const void *const *End;
286
287public:
288 explicit SmallPtrSetIteratorImpl(const void *const *BP, const void*const *E)
289 : Bucket(BP), End(E) {
290 if (shouldReverseIterate()) {
292 return;
293 }
295 }
296
298 return Bucket == RHS.Bucket;
299 }
301 return Bucket != RHS.Bucket;
302 }
303
304protected:
305 /// AdvanceIfNotValid - If the current bucket isn't valid, advance to a bucket
306 /// that is. This is guaranteed to stop because the end() bucket is marked
307 /// valid.
309 assert(Bucket <= End);
310 while (Bucket != End &&
313 ++Bucket;
314 }
316 assert(Bucket >= End);
317 while (Bucket != End &&
320 --Bucket;
321 }
322 }
323};
324
325/// SmallPtrSetIterator - This implements a const_iterator for SmallPtrSet.
326template <typename PtrTy>
331
332public:
333 using value_type = PtrTy;
334 using reference = PtrTy;
335 using pointer = PtrTy;
336 using difference_type = std::ptrdiff_t;
337 using iterator_category = std::forward_iterator_tag;
338
339 explicit SmallPtrSetIterator(const void *const *BP, const void *const *E,
340 const DebugEpochBase &Epoch)
341 : SmallPtrSetIteratorImpl(BP, E), DebugEpochBase::HandleBase(&Epoch) {}
342
343 // Most methods are provided by the base class.
344
345 const PtrTy operator*() const {
346 assert(isHandleInSync() && "invalid iterator access!");
347 if (shouldReverseIterate()) {
348 assert(Bucket > End);
349 return PtrTraits::getFromVoidPointer(const_cast<void *>(Bucket[-1]));
350 }
351 assert(Bucket < End);
352 return PtrTraits::getFromVoidPointer(const_cast<void*>(*Bucket));
353 }
354
355 inline SmallPtrSetIterator& operator++() { // Preincrement
356 assert(isHandleInSync() && "invalid iterator access!");
357 if (shouldReverseIterate()) {
358 --Bucket;
359 RetreatIfNotValid();
360 return *this;
361 }
362 ++Bucket;
363 AdvanceIfNotValid();
364 return *this;
365 }
366
367 SmallPtrSetIterator operator++(int) { // Postincrement
368 SmallPtrSetIterator tmp = *this;
369 ++*this;
370 return tmp;
371 }
372};
373
374/// A templated base class for \c SmallPtrSet which provides the
375/// typesafe interface that is common across all small sizes.
376///
377/// This is particularly useful for passing around between interface boundaries
378/// to avoid encoding a particular small size in the interface boundary.
379template <typename PtrType>
381 using ConstPtrType = typename add_const_past_pointer<PtrType>::type;
384
385protected:
386 // Forward constructors to the base.
388
389public:
392 using key_type = ConstPtrType;
393 using value_type = PtrType;
394
396
397 /// Inserts Ptr if and only if there is no element in the container equal to
398 /// Ptr. The bool component of the returned pair is true if and only if the
399 /// insertion takes place, and the iterator component of the pair points to
400 /// the element equal to Ptr.
401 std::pair<iterator, bool> insert(PtrType Ptr) {
402 auto p = insert_imp(PtrTraits::getAsVoidPointer(Ptr));
403 return {makeIterator(p.first), p.second};
404 }
405
406 /// Insert the given pointer with an iterator hint that is ignored. This is
407 /// identical to calling insert(Ptr), but allows SmallPtrSet to be used by
408 /// std::insert_iterator and std::inserter().
410 return insert(Ptr).first;
411 }
412
413 /// Remove pointer from the set.
414 ///
415 /// Returns whether the pointer was in the set. Invalidates iterators if
416 /// true is returned. To remove elements while iterating over the set, use
417 /// remove_if() instead.
418 bool erase(PtrType Ptr) {
419 return erase_imp(PtrTraits::getAsVoidPointer(Ptr));
420 }
421
422 /// Remove elements that match the given predicate.
423 ///
424 /// This method is a safe replacement for the following pattern, which is not
425 /// valid, because the erase() calls would invalidate the iterator:
426 ///
427 /// for (PtrType *Ptr : Set)
428 /// if (Pred(P))
429 /// Set.erase(P);
430 ///
431 /// Returns whether anything was removed. It is safe to read the set inside
432 /// the predicate function. However, the predicate must not modify the set
433 /// itself, only indicate a removal by returning true.
434 template <typename UnaryPredicate>
435 bool remove_if(UnaryPredicate P) {
436 bool Removed = false;
437 if (isSmall()) {
438 auto Buckets = small_buckets();
439 const void **APtr = Buckets.begin(), **E = Buckets.end();
440 while (APtr != E) {
441 PtrType Ptr = PtrTraits::getFromVoidPointer(const_cast<void *>(*APtr));
442 if (P(Ptr)) {
443 *APtr = *--E;
444 --NumEntries;
446 Removed = true;
447 } else {
448 ++APtr;
449 }
450 }
451 return Removed;
452 }
453
454 for (const void *&Bucket : buckets()) {
455 if (Bucket == getTombstoneMarker() || Bucket == getEmptyMarker())
456 continue;
457 PtrType Ptr = PtrTraits::getFromVoidPointer(const_cast<void *>(Bucket));
458 if (P(Ptr)) {
459 Bucket = getTombstoneMarker();
461 --NumEntries;
463 Removed = true;
464 }
465 }
466 return Removed;
467 }
468
469 /// count - Return 1 if the specified pointer is in the set, 0 otherwise.
470 size_type count(ConstPtrType Ptr) const {
471 return contains_imp(ConstPtrTraits::getAsVoidPointer(Ptr));
472 }
473 iterator find(ConstPtrType Ptr) const {
474 return makeIterator(find_imp(ConstPtrTraits::getAsVoidPointer(Ptr)));
475 }
476 bool contains(ConstPtrType Ptr) const {
477 return contains_imp(ConstPtrTraits::getAsVoidPointer(Ptr));
478 }
479
480 template <typename IterT>
481 void insert(IterT I, IterT E) {
482 for (; I != E; ++I)
483 insert(*I);
484 }
485
486 void insert(std::initializer_list<PtrType> IL) {
487 insert(IL.begin(), IL.end());
488 }
489
490 template <typename Range> void insert_range(Range &&R) {
491 insert(adl_begin(R), adl_end(R));
492 }
493
494 iterator begin() const {
496 return makeIterator(EndPointer() - 1);
497 return makeIterator(CurArray);
498 }
499 iterator end() const { return makeIterator(EndPointer()); }
500
501private:
502 /// Create an iterator that dereferences to same place as the given pointer.
503 iterator makeIterator(const void *const *P) const {
505 return iterator(P == EndPointer() ? CurArray : P + 1, CurArray, *this);
506 return iterator(P, EndPointer(), *this);
507 }
508};
509
510/// Equality comparison for SmallPtrSet.
511///
512/// Iterates over elements of LHS confirming that each value from LHS is also in
513/// RHS, and that no additional values are in RHS.
514template <typename PtrType>
517 if (LHS.size() != RHS.size())
518 return false;
519
520 for (const auto *KV : LHS)
521 if (!RHS.count(KV))
522 return false;
523
524 return true;
525}
526
527/// Inequality comparison for SmallPtrSet.
528///
529/// Equivalent to !(LHS == RHS).
530template <typename PtrType>
533 return !(LHS == RHS);
534}
535
536/// SmallPtrSet - This class implements a set which is optimized for holding
537/// SmallSize or less elements. This internally rounds up SmallSize to the next
538/// power of two if it is not already a power of two. See the comments above
539/// SmallPtrSetImplBase for details of the algorithm.
540template<class PtrType, unsigned SmallSize>
541class SmallPtrSet : public SmallPtrSetImpl<PtrType> {
542 // In small mode SmallPtrSet uses linear search for the elements, so it is
543 // not a good idea to choose this value too high. You may consider using a
544 // DenseSet<> instead if you expect many elements in the set.
545 static_assert(SmallSize <= 32, "SmallSize should be small");
546
548
549 // A constexpr version of llvm::bit_ceil.
550 // TODO: Replace this with std::bit_ceil once C++20 is available.
551 static constexpr size_t RoundUpToPowerOfTwo(size_t X) {
552 size_t C = 1;
553 size_t CMax = C << (std::numeric_limits<size_t>::digits - 1);
554 while (C < X && C < CMax)
555 C <<= 1;
556 return C;
557 }
558
559 // Make sure that SmallSize is a power of two, round up if not.
560 static constexpr size_t SmallSizePowTwo = RoundUpToPowerOfTwo(SmallSize);
561 /// SmallStorage - Fixed size storage used in 'small mode'.
562 const void *SmallStorage[SmallSizePowTwo];
563
564public:
565 SmallPtrSet() : BaseT(SmallStorage, SmallSizePowTwo) {}
566 SmallPtrSet(const SmallPtrSet &that) : BaseT(SmallStorage, that) {}
568 : BaseT(SmallStorage, SmallSizePowTwo, that.SmallStorage,
569 std::move(that)) {}
570
571 template<typename It>
572 SmallPtrSet(It I, It E) : BaseT(SmallStorage, SmallSizePowTwo) {
573 this->insert(I, E);
574 }
575
576 template <typename Range>
578 : SmallPtrSet(adl_begin(R), adl_end(R)) {}
579
580 SmallPtrSet(std::initializer_list<PtrType> IL)
581 : BaseT(SmallStorage, SmallSizePowTwo) {
582 this->insert(IL.begin(), IL.end());
583 }
584
587 if (&RHS != this)
588 this->copyFrom(SmallStorage, RHS);
589 return *this;
590 }
591
594 if (&RHS != this)
595 this->moveFrom(SmallStorage, SmallSizePowTwo, RHS.SmallStorage,
596 std::move(RHS));
597 return *this;
598 }
599
601 operator=(std::initializer_list<PtrType> IL) {
602 this->clear();
603 this->insert(IL.begin(), IL.end());
604 return *this;
605 }
606
607 /// swap - Swaps the elements of two sets.
609 SmallPtrSetImplBase::swap(SmallStorage, RHS.SmallStorage, RHS);
610 }
611};
612
613} // end namespace llvm
614
615namespace std {
616
617 /// Implement std::swap in terms of SmallPtrSet swap.
618 template<class T, unsigned N>
620 LHS.swap(RHS);
621 }
622
623} // end namespace std
624
625#endif // LLVM_ADT_SMALLPTRSET_H
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
#define LLVM_ABI
Definition: Compiler.h:213
bool End
Definition: ELF_riscv.cpp:480
This file defines the DebugEpochBase and DebugEpochBase::HandleBase classes.
#define LLVM_DEBUGEPOCHBASE_HANDLEBASE_EMPTYBASE
Definition: EpochTracker.h:85
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
#define I(x, y, z)
Definition: MD5.cpp:58
ConstantRange Range(APInt(BitWidth, Low), APInt(BitWidth, High))
#define P(N)
This file contains library features backported from future STL versions.
Value * RHS
Value * LHS
SmallPtrSetImplBase - This is the common code shared among all the SmallPtrSet<>'s,...
Definition: SmallPtrSet.h:56
size_type size() const
Definition: SmallPtrSet.h:99
iterator_range< const void ** > buckets()
Definition: SmallPtrSet.h:159
const void *const * find_imp(const void *Ptr) const
Returns the raw pointer needed to construct an iterator.
Definition: SmallPtrSet.h:221
unsigned NumTombstones
Number of tombstones in CurArray.
Definition: SmallPtrSet.h:70
iterator_range< const void *const * > small_buckets() const
Definition: SmallPtrSet.h:155
LLVM_ABI SmallPtrSetImplBase(const void **SmallStorage, const SmallPtrSetImplBase &that)
SmallPtrSetImplBase(const void **SmallStorage, unsigned SmallSize)
Definition: SmallPtrSet.h:81
unsigned NumEntries
Number of elements in CurArray that contain a value.
Definition: SmallPtrSet.h:68
const void ** CurArray
The current set of buckets, in either small or big representation.
Definition: SmallPtrSet.h:61
bool IsSmall
Whether the set is in small representation.
Definition: SmallPtrSet.h:72
LLVM_ABI void copyFrom(const void **SmallStorage, const SmallPtrSetImplBase &RHS)
void reserve(size_type NewNumEntries)
Definition: SmallPtrSet.h:117
bool contains_imp(const void *Ptr) const
Definition: SmallPtrSet.h:236
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:170
SmallPtrSetImplBase & operator=(const SmallPtrSetImplBase &)=delete
LLVM_ABI void moveFrom(const void **SmallStorage, unsigned SmallSize, const void **RHSSmallStorage, SmallPtrSetImplBase &&RHS)
iterator_range< const void ** > small_buckets()
Definition: SmallPtrSet.h:151
unsigned CurArraySize
CurArraySize - The allocated size of CurArray, always a power of two.
Definition: SmallPtrSet.h:63
iterator_range< const void *const * > buckets() const
Definition: SmallPtrSet.h:163
const void ** EndPointer() const
Definition: SmallPtrSet.h:147
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:193
static void * getEmptyMarker()
Definition: SmallPtrSet.h:141
static void * getTombstoneMarker()
Definition: SmallPtrSet.h:139
LLVM_ABI void swap(const void **SmallStorage, const void **RHSSmallStorage, SmallPtrSetImplBase &RHS)
swap - Swaps the elements of two sets.
size_type capacity() const
Definition: SmallPtrSet.h:100
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
Definition: SmallPtrSet.h:380
iterator insert(iterator, PtrType Ptr)
Insert the given pointer with an iterator hint that is ignored.
Definition: SmallPtrSet.h:409
bool erase(PtrType Ptr)
Remove pointer from the set.
Definition: SmallPtrSet.h:418
iterator find(ConstPtrType Ptr) const
Definition: SmallPtrSet.h:473
size_type count(ConstPtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
Definition: SmallPtrSet.h:470
SmallPtrSetImpl(const SmallPtrSetImpl &)=delete
void insert(IterT I, IterT E)
Definition: SmallPtrSet.h:481
bool remove_if(UnaryPredicate P)
Remove elements that match the given predicate.
Definition: SmallPtrSet.h:435
iterator end() const
Definition: SmallPtrSet.h:499
ConstPtrType key_type
Definition: SmallPtrSet.h:392
void insert_range(Range &&R)
Definition: SmallPtrSet.h:490
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:401
SmallPtrSetIterator< PtrType > iterator
Definition: SmallPtrSet.h:390
iterator begin() const
Definition: SmallPtrSet.h:494
void insert(std::initializer_list< PtrType > IL)
Definition: SmallPtrSet.h:486
bool contains(ConstPtrType Ptr) const
Definition: SmallPtrSet.h:476
SmallPtrSetIteratorImpl - This is the common base class shared between all instances of SmallPtrSetIt...
Definition: SmallPtrSet.h:282
bool operator!=(const SmallPtrSetIteratorImpl &RHS) const
Definition: SmallPtrSet.h:300
SmallPtrSetIteratorImpl(const void *const *BP, const void *const *E)
Definition: SmallPtrSet.h:288
const void *const * End
Definition: SmallPtrSet.h:285
const void *const * Bucket
Definition: SmallPtrSet.h:284
bool operator==(const SmallPtrSetIteratorImpl &RHS) const
Definition: SmallPtrSet.h:297
void AdvanceIfNotValid()
AdvanceIfNotValid - If the current bucket isn't valid, advance to a bucket that is.
Definition: SmallPtrSet.h:308
SmallPtrSetIterator - This implements a const_iterator for SmallPtrSet.
Definition: SmallPtrSet.h:329
const PtrTy operator*() const
Definition: SmallPtrSet.h:345
std::ptrdiff_t difference_type
Definition: SmallPtrSet.h:336
SmallPtrSetIterator(const void *const *BP, const void *const *E, const DebugEpochBase &Epoch)
Definition: SmallPtrSet.h:339
SmallPtrSetIterator operator++(int)
Definition: SmallPtrSet.h:367
SmallPtrSetIterator & operator++()
Definition: SmallPtrSet.h:355
std::forward_iterator_tag iterator_category
Definition: SmallPtrSet.h:337
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
Definition: SmallPtrSet.h:541
SmallPtrSet(SmallPtrSet &&that)
Definition: SmallPtrSet.h:567
SmallPtrSet(It I, It E)
Definition: SmallPtrSet.h:572
SmallPtrSet(llvm::from_range_t, Range &&R)
Definition: SmallPtrSet.h:577
SmallPtrSet< PtrType, SmallSize > & operator=(SmallPtrSet< PtrType, SmallSize > &&RHS)
Definition: SmallPtrSet.h:593
void swap(SmallPtrSet< PtrType, SmallSize > &RHS)
swap - Swaps the elements of two sets.
Definition: SmallPtrSet.h:608
SmallPtrSet(std::initializer_list< PtrType > IL)
Definition: SmallPtrSet.h:580
SmallPtrSet< PtrType, SmallSize > & operator=(const SmallPtrSet< PtrType, SmallSize > &RHS)
Definition: SmallPtrSet.h:586
SmallPtrSet(const SmallPtrSet &that)
Definition: SmallPtrSet.h:566
SmallPtrSet< PtrType, SmallSize > & operator=(std::initializer_list< PtrType > IL)
Definition: SmallPtrSet.h:601
A range adaptor for a pair of iterators.
This provides a very simple, boring adaptor for a begin and end iterator into a range type.
@ C
The default llvm calling convention, compatible with C.
Definition: CallingConv.h:34
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
constexpr auto adl_begin(RangeT &&range) -> decltype(adl_detail::begin_impl(std::forward< RangeT >(range)))
Returns the begin iterator to range using std::begin and function found through Argument-Dependent Lo...
Definition: ADL.h:78
bool operator!=(uint64_t V1, const APInt &V2)
Definition: APInt.h:2113
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
constexpr auto adl_end(RangeT &&range) -> decltype(adl_detail::end_impl(std::forward< RangeT >(range)))
Returns the end iterator to range using std::end and functions found through Argument-Dependent Looku...
Definition: ADL.h:86
T bit_ceil(T Value)
Returns the smallest integral power of two no smaller than Value if Value is nonzero.
Definition: bit.h:295
bool operator==(const AddressRangeValuePair &LHS, const AddressRangeValuePair &RHS)
constexpr bool has_single_bit(T Value) noexcept
Definition: bit.h:147
bool shouldReverseIterate()
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:1886
Implement std::hash so that hash_code can be used in STL containers.
Definition: BitVector.h:856
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
Definition: BitVector.h:858
A traits type that is used to handle pointer types and things that are just wrappers for pointers as ...