LLVM 23.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 linear-probed hash table with deletion implemented using
51/// Knuth TAOCP 6.4 Algorithm R: `erase` opens a hole, walks forward sliding
52/// each following entry whose probe path crosses the hole back into it (the
53/// hole moves with each slide), and stops at the next empty slot. Empty
54/// buckets are represented with an illegal pointer value (-1) to allow null
55/// pointers to be inserted; no tombstone state is needed. The hash table is
56/// resized when the table is 2/3 or more. When this happens, the table is
57/// doubled in size.
60
61protected:
62 /// The current set of buckets, in either small or big representation.
63 const void **CurArray;
64 /// CurArraySize - The allocated size of CurArray, always a power of two.
65 unsigned CurArraySize;
66
67 /// Number of elements in CurArray that contain a value.
68 /// If small, all these elements are at the beginning of CurArray and the rest
69 /// is uninitialized.
70 unsigned NumEntries;
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),
83 IsSmall(true) {
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 [[nodiscard]] size_type size() const { return NumEntries; }
100 [[nodiscard]] 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 }
115
116 void reserve(size_type NewNumEntries) {
118 // Do nothing if we're given zero as a reservation size.
119 if (NewNumEntries == 0)
120 return;
121 // No need to expand if we're small and NewNumEntries will fit in the space.
122 if (isSmall() && NewNumEntries <= CurArraySize)
123 return;
124 // insert_imp_big will reallocate if stores is more than 2/3 full, on the
125 // /final/ insertion.
126 if (!isSmall() && ((NewNumEntries - 1) * 3) < (CurArraySize * 2))
127 return;
128 // We must Grow -- find the size where we'd be 2/3 full, then round up to
129 // the next power of two.
130 size_type NewSize = NewNumEntries + (NewNumEntries / 2);
131 NewSize = llvm::bit_ceil(NewSize);
132 // Like insert_imp_big, always allocate at least 128 elements.
133 NewSize = std::max(128u, NewSize);
134 Grow(NewSize);
135 }
136
137protected:
138 static void *getEmptyMarker() {
139 // Note that -1 is chosen to make clear() efficiently implementable with
140 // memset and because it's not a valid pointer value.
141 return reinterpret_cast<void *>(-1);
142 }
143
144 const void **EndPointer() const {
146 }
147
151
155
159
163
164 /// insert_imp - This returns true if the pointer was new to the set, false if
165 /// it was already in the set. This is hidden from the client so that the
166 /// derived class can check that the right type of pointer is passed in.
167 std::pair<const void *const *, bool> insert_imp(const void *Ptr) {
168 if (isSmall()) {
169 // Check to see if it is already in the set.
170 for (const void *&Bucket : small_buckets()) {
171 if (Bucket == Ptr)
172 return {&Bucket, false};
173 }
174
175 // Nope, there isn't. If we stay small, just 'pushback' now.
176 if (NumEntries < CurArraySize) {
177 CurArray[NumEntries++] = Ptr;
179 return {CurArray + (NumEntries - 1), true};
180 }
181 // Otherwise, hit the big set case, which will call grow.
182 }
183 return insert_imp_big(Ptr);
184 }
185
186 /// erase_imp - If the set contains the specified pointer, remove it and
187 /// return true, otherwise return false. This is hidden from the client so
188 /// that the derived class can check that the right type of pointer is passed
189 /// in.
190 bool erase_imp(const void *Ptr) {
191 if (isSmall()) {
192 for (const void *&Bucket : small_buckets()) {
193 if (Bucket == Ptr) {
194 Bucket = CurArray[--NumEntries];
196 return true;
197 }
198 }
199 return false;
200 }
201
202 auto *Bucket = doFind(Ptr);
203 if (!Bucket)
204 return false;
205
206 eraseFromBucket(const_cast<const void **>(Bucket));
207 --NumEntries;
209 return true;
210 }
211
212 /// Returns the raw pointer needed to construct an iterator. If element not
213 /// found, this will be EndPointer. Otherwise, it will be a pointer to the
214 /// slot which stores Ptr;
215 const void *const *find_imp(const void *Ptr) const {
216 if (isSmall()) {
217 // Linear search for the item.
218 for (const void *const &Bucket : small_buckets())
219 if (Bucket == Ptr)
220 return &Bucket;
221 return EndPointer();
222 }
223
224 // Big set case.
225 if (auto *Bucket = doFind(Ptr))
226 return Bucket;
227 return EndPointer();
228 }
229
230 bool contains_imp(const void *Ptr) const {
231 if (isSmall()) {
232 // Linear search for the item.
233 for (const void *const &Bucket : small_buckets())
234 if (Bucket == Ptr)
235 return true;
236 return false;
237 }
238
239 return doFind(Ptr) != nullptr;
240 }
241
242 bool isSmall() const { return IsSmall; }
243
244private:
245 LLVM_ABI std::pair<const void *const *, bool> insert_imp_big(const void *Ptr);
246
247 LLVM_ABI const void *const *doFind(const void *Ptr) const;
248 const void *const *FindBucketFor(const void *Ptr) const;
249 LLVM_ABI void shrink_and_clear();
250
251protected:
252 /// Erase the entry at \p Bucket and close the resulting hole via Knuth
253 /// TAOCP 6.4 Algorithm R. Caller must update \c NumEntries and the epoch.
254 LLVM_ABI void eraseFromBucket(const void **Bucket);
255
256 /// Allocate a larger backing store for the buckets and move it over.
257 /// Passing the current size triggers a same-size rehash, used by batch
258 /// erase to compact away empty slots left by mark-then-rebuild.
259 LLVM_ABI void Grow(unsigned NewSize);
260
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.
284public:
285 explicit SmallPtrSetIteratorImpl(const void *const *BP, const void *const *E,
286 const DebugEpochBase &Epoch)
287 : DebugEpochBase::HandleBase(&Epoch), Bucket(BP), End(E) {
288 AdvanceIfNotValid();
289 }
290
292 return Bucket == RHS.Bucket;
293 }
295 return Bucket != RHS.Bucket;
296 }
297
298protected:
299 void *dereference() const {
300 assert(isHandleInSync() && "invalid iterator access!");
301 assert(Bucket < End);
302 return const_cast<void *>(*Bucket);
303 }
304 void increment() {
305 assert(isHandleInSync() && "invalid iterator access!");
306 ++Bucket;
307 AdvanceIfNotValid();
308 }
309
310private:
311 /// AdvanceIfNotValid - If the current bucket isn't valid, advance to a bucket
312 /// that is. This is guaranteed to stop because the end() bucket is marked
313 /// valid.
314 void AdvanceIfNotValid() {
315 assert(Bucket <= End);
316 while (Bucket != End && *Bucket == SmallPtrSetImplBase::getEmptyMarker())
317 ++Bucket;
318 }
319
320 using BucketItTy =
321 std::conditional_t<shouldReverseIterate(),
322 std::reverse_iterator<const void *const *>,
323 const void *const *>;
324
325 BucketItTy Bucket;
326 BucketItTy End;
327};
328
329/// SmallPtrSetIterator - This implements a const_iterator for SmallPtrSet.
330template <typename PtrTy>
332 using PtrTraits = PointerLikeTypeTraits<PtrTy>;
333
334public:
335 using value_type = PtrTy;
336 using reference = PtrTy;
337 using pointer = PtrTy;
338 using difference_type = std::ptrdiff_t;
339 using iterator_category = std::forward_iterator_tag;
340
342
343 // Most methods are provided by the base class.
344
345 [[nodiscard]] const PtrTy operator*() const {
346 return PtrTraits::getFromVoidPointer(dereference());
347 }
348
349 inline SmallPtrSetIterator &operator++() { // Preincrement
350 increment();
351 return *this;
352 }
353
354 SmallPtrSetIterator operator++(int) { // Postincrement
355 SmallPtrSetIterator tmp = *this;
356 increment();
357 return tmp;
358 }
359};
360
361/// A templated base class for \c SmallPtrSet which provides the
362/// typesafe interface that is common across all small sizes.
363///
364/// This is particularly useful for passing around between interface boundaries
365/// to avoid encoding a particular small size in the interface boundary.
366template <typename PtrType> class SmallPtrSetImpl : public SmallPtrSetImplBase {
367 using ConstPtrType = typename add_const_past_pointer<PtrType>::type;
368 using PtrTraits = PointerLikeTypeTraits<PtrType>;
369 using ConstPtrTraits = PointerLikeTypeTraits<ConstPtrType>;
370
371protected:
372 // Forward constructors to the base.
374
375public:
378 using key_type = ConstPtrType;
379 using value_type = PtrType;
380
382
383 /// Inserts Ptr if and only if there is no element in the container equal to
384 /// Ptr. The bool component of the returned pair is true if and only if the
385 /// insertion takes place, and the iterator component of the pair points to
386 /// the element equal to Ptr.
387 std::pair<iterator, bool> insert(PtrType Ptr) {
388 auto p = insert_imp(PtrTraits::getAsVoidPointer(Ptr));
389 return {makeIterator(p.first), p.second};
390 }
391
392 /// Insert the given pointer with an iterator hint that is ignored. This is
393 /// identical to calling insert(Ptr), but allows SmallPtrSet to be used by
394 /// std::insert_iterator and std::inserter().
395 iterator insert(iterator, PtrType Ptr) { return insert(Ptr).first; }
396
397 /// Remove pointer from the set.
398 ///
399 /// Returns whether the pointer was in the set. Invalidates iterators if
400 /// true is returned. To remove elements while iterating over the set, use
401 /// remove_if() instead.
402 bool erase(PtrType Ptr) {
403 return erase_imp(PtrTraits::getAsVoidPointer(Ptr));
404 }
405
406 /// Remove elements that match the given predicate.
407 ///
408 /// This method is a safe replacement for the following pattern, which is not
409 /// valid, because the erase() calls would invalidate the iterator:
410 ///
411 /// for (PtrType *Ptr : Set)
412 /// if (Pred(P))
413 /// Set.erase(P);
414 ///
415 /// Returns whether anything was removed. The predicate must not access the
416 /// set being modified: it may inspect the element passed to it and return
417 /// true to request removal, but must not read (e.g. count()/find()) or
418 /// otherwise mutate the set. If anything is removed, all iterators and
419 /// references into the set are invalidated.
420 template <typename UnaryPredicate> bool remove_if(UnaryPredicate P) {
421 bool Removed = false;
422 if (isSmall()) {
423 auto Buckets = small_buckets();
424 const void **APtr = Buckets.begin(), **E = Buckets.end();
425 while (APtr != E) {
426 PtrType Ptr = PtrTraits::getFromVoidPointer(const_cast<void *>(*APtr));
427 if (P(Ptr)) {
428 *APtr = *--E;
429 --NumEntries;
431 Removed = true;
432 } else {
433 ++APtr;
434 }
435 }
436 return Removed;
437 }
438
439 // Mark-then-rebuild: one pass to clear matches without sliding (which
440 // would re-walk the cluster on every erase), then a single rehash to
441 // restore the linear-probe invariant. O(N) total, vs O(N * cluster)
442 // for repeated per-match Algorithm R erases.
443 for (const void *&Bucket : buckets()) {
444 if (Bucket == getEmptyMarker())
445 continue;
446 PtrType Ptr = PtrTraits::getFromVoidPointer(const_cast<void *>(Bucket));
447 if (P(Ptr)) {
448 Bucket = getEmptyMarker();
449 --NumEntries;
450 Removed = true;
451 }
452 }
453 if (Removed) {
456 }
457 return Removed;
458 }
459
460 /// count - Return 1 if the specified pointer is in the set, 0 otherwise.
461 [[nodiscard]] size_type count(ConstPtrType Ptr) const {
462 return contains_imp(ConstPtrTraits::getAsVoidPointer(Ptr));
463 }
464 [[nodiscard]] iterator find(ConstPtrType Ptr) const {
465 return makeIterator(find_imp(ConstPtrTraits::getAsVoidPointer(Ptr)));
466 }
467 [[nodiscard]] bool contains(ConstPtrType Ptr) const {
468 return contains_imp(ConstPtrTraits::getAsVoidPointer(Ptr));
469 }
470
471 template <typename IterT> void insert(IterT I, IterT E) {
472 for (; I != E; ++I)
473 insert(*I);
474 }
475
476 void insert(std::initializer_list<PtrType> IL) {
477 insert(IL.begin(), IL.end());
478 }
479
480 template <typename Range> void insert_range(Range &&R) {
481 insert(adl_begin(R), adl_end(R));
482 }
483
484 [[nodiscard]] iterator begin() const {
485 if constexpr (shouldReverseIterate())
486 return makeIterator(EndPointer() - 1);
487 else
488 return makeIterator(CurArray);
489 }
490 [[nodiscard]] iterator end() const { return makeIterator(EndPointer()); }
491
492private:
493 /// Create an iterator that dereferences to same place as the given pointer.
494 iterator makeIterator(const void *const *P) const {
495 if constexpr (shouldReverseIterate())
496 return iterator(P == EndPointer() ? CurArray : P + 1, CurArray, *this);
497 else
498 return iterator(P, EndPointer(), *this);
499 }
500};
501
502/// Equality comparison for SmallPtrSet.
503///
504/// Iterates over elements of LHS confirming that each value from LHS is also in
505/// RHS, and that no additional values are in RHS.
506template <typename PtrType>
507[[nodiscard]] bool operator==(const SmallPtrSetImpl<PtrType> &LHS,
509 if (LHS.size() != RHS.size())
510 return false;
511
512 for (const auto *KV : LHS)
513 if (!RHS.count(KV))
514 return false;
515
516 return true;
517}
518
519/// Inequality comparison for SmallPtrSet.
520///
521/// Equivalent to !(LHS == RHS).
522template <typename PtrType>
523[[nodiscard]] bool operator!=(const SmallPtrSetImpl<PtrType> &LHS,
525 return !(LHS == RHS);
526}
527
528/// SmallPtrSet - This class implements a set which is optimized for holding
529/// SmallSize or less elements. This internally rounds up SmallSize to the next
530/// power of two if it is not already a power of two. See the comments above
531/// SmallPtrSetImplBase for details of the algorithm.
532template <class PtrType, unsigned SmallSize>
533class SmallPtrSet : public SmallPtrSetImpl<PtrType> {
534 // In small mode SmallPtrSet uses linear search for the elements, so it is
535 // not a good idea to choose this value too high. You may consider using a
536 // DenseSet<> instead if you expect many elements in the set.
537 static_assert(SmallSize <= 32, "SmallSize should be small");
538
539 using BaseT = SmallPtrSetImpl<PtrType>;
540
541 // Make sure that SmallSize is a power of two, round up if not.
542 static constexpr size_t SmallSizePowTwo = llvm::bit_ceil_constexpr(SmallSize);
543 /// SmallStorage - Fixed size storage used in 'small mode'.
544 const void *SmallStorage[SmallSizePowTwo];
545
546public:
547 SmallPtrSet() : BaseT(SmallStorage, SmallSizePowTwo) {}
548 SmallPtrSet(const SmallPtrSet &that) : BaseT(SmallStorage, that) {}
550 : BaseT(SmallStorage, SmallSizePowTwo, that.SmallStorage,
551 std::move(that)) {}
552
553 template <typename It>
554 SmallPtrSet(It I, It E) : BaseT(SmallStorage, SmallSizePowTwo) {
555 this->insert(I, E);
556 }
557
558 template <typename Range>
561
562 SmallPtrSet(std::initializer_list<PtrType> IL)
563 : BaseT(SmallStorage, SmallSizePowTwo) {
564 this->insert(IL.begin(), IL.end());
565 }
566
569 if (&RHS != this)
570 this->copyFrom(SmallStorage, RHS);
571 return *this;
572 }
573
576 if (&RHS != this)
577 this->moveFrom(SmallStorage, SmallSizePowTwo, RHS.SmallStorage,
578 std::move(RHS));
579 return *this;
580 }
581
583 operator=(std::initializer_list<PtrType> IL) {
584 this->clear();
585 this->insert(IL.begin(), IL.end());
586 return *this;
587 }
588
589 /// swap - Swaps the elements of two sets.
591 SmallPtrSetImplBase::swap(SmallStorage, RHS.SmallStorage, RHS);
592 }
593};
594
595} // namespace llvm
596
597namespace std {
598
599/// Implement std::swap in terms of SmallPtrSet swap.
600template <class T, unsigned N>
604
605} // namespace std
606
607#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
This file defines the DebugEpochBase and DebugEpochBase::HandleBase classes.
#define LLVM_DEBUGEPOCHBASE_HANDLEBASE_EMPTYBASE
#define I(x, y, z)
Definition MD5.cpp:57
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:58
size_type size() const
Definition SmallPtrSet.h:99
iterator_range< const void ** > buckets()
const void *const * find_imp(const void *Ptr) const
Returns the raw pointer needed to construct an iterator.
iterator_range< const void *const * > small_buckets() const
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:70
const void ** CurArray
The current set of buckets, in either small or big representation.
Definition SmallPtrSet.h:63
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)
bool contains_imp(const void *Ptr) const
friend class SmallPtrSetIteratorImpl
Definition SmallPtrSet.h:59
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.
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()
unsigned CurArraySize
CurArraySize - The allocated size of CurArray, always a power of two.
Definition SmallPtrSet.h:65
iterator_range< const void *const * > buckets() const
LLVM_ABI void eraseFromBucket(const void **Bucket)
Erase the entry at Bucket and close the resulting hole via Knuth TAOCP 6.4 Algorithm R.
const void ** EndPointer() const
bool erase_imp(const void *Ptr)
erase_imp - If the set contains the specified pointer, remove it and return true, otherwise return fa...
static void * getEmptyMarker()
LLVM_ABI void Grow(unsigned NewSize)
Allocate a larger backing store for the buckets and move it over.
LLVM_ABI void swap(const void **SmallStorage, const void **RHSSmallStorage, SmallPtrSetImplBase &RHS)
swap - Swaps the elements of two sets.
size_type capacity() const
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
SmallPtrSetIterator< PtrType > const_iterator
iterator insert(iterator, PtrType Ptr)
Insert the given pointer with an iterator hint that is ignored.
bool erase(PtrType Ptr)
Remove pointer from the set.
iterator find(ConstPtrType Ptr) const
size_type count(ConstPtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
SmallPtrSetImpl(const SmallPtrSetImpl &)=delete
LLVM_ABI SmallPtrSetImplBase(const void **SmallStorage, const SmallPtrSetImplBase &that)
void insert(IterT I, IterT E)
bool remove_if(UnaryPredicate P)
Remove elements that match the given predicate.
iterator end() const
ConstPtrType key_type
void insert_range(Range &&R)
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
SmallPtrSetIterator< PtrType > iterator
iterator begin() const
void insert(std::initializer_list< PtrType > IL)
bool contains(ConstPtrType Ptr) const
bool operator!=(const SmallPtrSetIteratorImpl &RHS) const
SmallPtrSetIteratorImpl(const void *const *BP, const void *const *E, const DebugEpochBase &Epoch)
bool operator==(const SmallPtrSetIteratorImpl &RHS) const
SmallPtrSetIterator - This implements a const_iterator for SmallPtrSet.
const PtrTy operator*() const
SmallPtrSetIteratorImpl(const void *const *BP, const void *const *E, const DebugEpochBase &Epoch)
std::ptrdiff_t difference_type
SmallPtrSetIterator operator++(int)
SmallPtrSetIterator & operator++()
std::forward_iterator_tag iterator_category
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
SmallPtrSet(SmallPtrSet &&that)
SmallPtrSet(It I, It E)
SmallPtrSet(llvm::from_range_t, Range &&R)
SmallPtrSet< PtrType, SmallSize > & operator=(SmallPtrSet< PtrType, SmallSize > &&RHS)
void swap(SmallPtrSet< PtrType, SmallSize > &RHS)
swap - Swaps the elements of two sets.
SmallPtrSet(std::initializer_list< PtrType > IL)
SmallPtrSet< PtrType, SmallSize > & operator=(const SmallPtrSet< PtrType, SmallSize > &RHS)
SmallPtrSet(const SmallPtrSet &that)
SmallPtrSet< PtrType, SmallSize > & operator=(std::initializer_list< PtrType > IL)
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.
This is an optimization pass for GlobalISel generic memory operations.
constexpr T bit_ceil_constexpr(T Value)
Returns the smallest integral power of two no smaller than Value if Value is nonzero.
Definition bit.h:377
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:2142
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:362
bool operator==(const AddressRangeValuePair &LHS, const AddressRangeValuePair &RHS)
constexpr bool has_single_bit(T Value) noexcept
Definition bit.h:149
constexpr 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:1916
Implement std::hash so that hash_code can be used in STL containers.
Definition BitVector.h:874
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
Definition BitVector.h:876
A traits type that is used to handle pointer types and things that are just wrappers for pointers as ...
std::conditional_t< std::is_pointer_v< T >, const std::remove_pointer_t< T > *, const T > type
Definition type_traits.h:48