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 LLVM_ABI void shrink_and_clear();
249
250protected:
251 /// Erase the entry at \p Bucket and close the resulting hole via Knuth
252 /// TAOCP 6.4 Algorithm R. Caller must update \c NumEntries and the epoch.
253 LLVM_ABI void eraseFromBucket(const void **Bucket);
254
255 /// Allocate a larger backing store for the buckets and move it over.
256 /// Passing the current size triggers a same-size rehash, used by batch
257 /// erase to compact away empty slots left by mark-then-rebuild.
258 LLVM_ABI void Grow(unsigned NewSize);
259
260 /// swap - Swaps the elements of two sets.
261 /// Note: This method assumes that both sets have the same small size.
262 LLVM_ABI void swap(const void **SmallStorage, const void **RHSSmallStorage,
264
265 LLVM_ABI void copyFrom(const void **SmallStorage,
266 const SmallPtrSetImplBase &RHS);
267 LLVM_ABI void moveFrom(const void **SmallStorage, unsigned SmallSize,
268 const void **RHSSmallStorage,
270
271private:
272 /// Code shared by moveFrom() and move constructor.
273 void moveHelper(const void **SmallStorage, unsigned SmallSize,
274 const void **RHSSmallStorage, SmallPtrSetImplBase &&RHS);
275 /// Code shared by copyFrom() and copy constructor.
276 void copyHelper(const SmallPtrSetImplBase &RHS);
277};
278
279/// SmallPtrSetIteratorImpl - This is the common base class shared between all
280/// instances of SmallPtrSetIterator.
283public:
284 explicit SmallPtrSetIteratorImpl(const void *const *BP, const void *const *E,
285 const DebugEpochBase &Epoch)
286 : DebugEpochBase::HandleBase(&Epoch), Bucket(BP), End(E) {
287 AdvanceIfNotValid();
288 }
289
291 return Bucket == RHS.Bucket;
292 }
294 return Bucket != RHS.Bucket;
295 }
296
297protected:
298 void *dereference() const {
299 assert(isHandleInSync() && "invalid iterator access!");
300 assert(Bucket < End);
301 return const_cast<void *>(*Bucket);
302 }
303 void increment() {
304 assert(isHandleInSync() && "invalid iterator access!");
305 ++Bucket;
306 AdvanceIfNotValid();
307 }
308
309private:
310 /// AdvanceIfNotValid - If the current bucket isn't valid, advance to a bucket
311 /// that is. This is guaranteed to stop because the end() bucket is marked
312 /// valid.
313 void AdvanceIfNotValid() {
314 assert(Bucket <= End);
315 while (Bucket != End && *Bucket == SmallPtrSetImplBase::getEmptyMarker())
316 ++Bucket;
317 }
318
319 using BucketItTy =
320 std::conditional_t<shouldReverseIterate(),
321 std::reverse_iterator<const void *const *>,
322 const void *const *>;
323
324 BucketItTy Bucket;
325 BucketItTy End;
326};
327
328/// SmallPtrSetIterator - This implements a const_iterator for SmallPtrSet.
329template <typename PtrTy>
331 using PtrTraits = PointerLikeTypeTraits<PtrTy>;
332
333public:
334 using value_type = PtrTy;
335 using reference = PtrTy;
336 using pointer = PtrTy;
337 using difference_type = std::ptrdiff_t;
338 using iterator_category = std::forward_iterator_tag;
339
341
342 // Most methods are provided by the base class.
343
344 [[nodiscard]] const PtrTy operator*() const {
345 return PtrTraits::getFromVoidPointer(dereference());
346 }
347
348 inline SmallPtrSetIterator &operator++() { // Preincrement
349 increment();
350 return *this;
351 }
352
353 SmallPtrSetIterator operator++(int) { // Postincrement
354 SmallPtrSetIterator tmp = *this;
355 increment();
356 return tmp;
357 }
358};
359
360/// A templated base class for \c SmallPtrSet which provides the
361/// typesafe interface that is common across all small sizes.
362///
363/// This is particularly useful for passing around between interface boundaries
364/// to avoid encoding a particular small size in the interface boundary.
365template <typename PtrType> class SmallPtrSetImpl : public SmallPtrSetImplBase {
366 using ConstPtrType = typename add_const_past_pointer<PtrType>::type;
367 using PtrTraits = PointerLikeTypeTraits<PtrType>;
368 using ConstPtrTraits = PointerLikeTypeTraits<ConstPtrType>;
369
370protected:
371 // Forward constructors to the base.
373
374public:
377 using key_type = ConstPtrType;
378 using value_type = PtrType;
379
381
382 /// Inserts Ptr if and only if there is no element in the container equal to
383 /// Ptr. The bool component of the returned pair is true if and only if the
384 /// insertion takes place, and the iterator component of the pair points to
385 /// the element equal to Ptr.
386 std::pair<iterator, bool> insert(PtrType Ptr) {
387 auto p = insert_imp(PtrTraits::getAsVoidPointer(Ptr));
388 return {makeIterator(p.first), p.second};
389 }
390
391 /// Insert the given pointer with an iterator hint that is ignored. This is
392 /// identical to calling insert(Ptr), but allows SmallPtrSet to be used by
393 /// std::insert_iterator and std::inserter().
394 iterator insert(iterator, PtrType Ptr) { return insert(Ptr).first; }
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.
401 bool erase(PtrType Ptr) {
402 return erase_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. The predicate must not access the
415 /// set being modified: it may inspect the element passed to it and return
416 /// true to request removal, but must not read (e.g. count()/find()) or
417 /// otherwise mutate the set. If anything is removed, all iterators and
418 /// references into the set are invalidated.
419 template <typename UnaryPredicate> bool remove_if(UnaryPredicate P) {
420 bool Removed = false;
421 if (isSmall()) {
422 auto Buckets = small_buckets();
423 const void **APtr = Buckets.begin(), **E = Buckets.end();
424 while (APtr != E) {
425 PtrType Ptr = PtrTraits::getFromVoidPointer(const_cast<void *>(*APtr));
426 if (P(Ptr)) {
427 *APtr = *--E;
428 --NumEntries;
430 Removed = true;
431 } else {
432 ++APtr;
433 }
434 }
435 return Removed;
436 }
437
438 // Mark-then-rebuild: one pass to clear matches without sliding (which
439 // would re-walk the cluster on every erase), then a single rehash to
440 // restore the linear-probe invariant. O(N) total, vs O(N * cluster)
441 // for repeated per-match Algorithm R erases.
442 for (const void *&Bucket : buckets()) {
443 if (Bucket == getEmptyMarker())
444 continue;
445 PtrType Ptr = PtrTraits::getFromVoidPointer(const_cast<void *>(Bucket));
446 if (P(Ptr)) {
447 Bucket = getEmptyMarker();
448 --NumEntries;
449 Removed = true;
450 }
451 }
452 if (Removed) {
455 }
456 return Removed;
457 }
458
459 /// count - Return 1 if the specified pointer is in the set, 0 otherwise.
460 [[nodiscard]] size_type count(ConstPtrType Ptr) const {
461 return contains_imp(ConstPtrTraits::getAsVoidPointer(Ptr));
462 }
463 [[nodiscard]] iterator find(ConstPtrType Ptr) const {
464 return makeIterator(find_imp(ConstPtrTraits::getAsVoidPointer(Ptr)));
465 }
466 [[nodiscard]] bool contains(ConstPtrType Ptr) const {
467 return contains_imp(ConstPtrTraits::getAsVoidPointer(Ptr));
468 }
469
470 template <typename IterT> void insert(IterT I, IterT E) {
471 for (; I != E; ++I)
472 insert(*I);
473 }
474
475 void insert(std::initializer_list<PtrType> IL) {
476 insert(IL.begin(), IL.end());
477 }
478
479 template <typename Range> void insert_range(Range &&R) {
480 insert(adl_begin(R), adl_end(R));
481 }
482
483 [[nodiscard]] iterator begin() const {
484 if constexpr (shouldReverseIterate())
485 return makeIterator(EndPointer() - 1);
486 else
487 return makeIterator(CurArray);
488 }
489 [[nodiscard]] iterator end() const { return makeIterator(EndPointer()); }
490
491private:
492 /// Create an iterator that dereferences to same place as the given pointer.
493 iterator makeIterator(const void *const *P) const {
494 if constexpr (shouldReverseIterate())
495 return iterator(P == EndPointer() ? CurArray : P + 1, CurArray, *this);
496 else
497 return iterator(P, EndPointer(), *this);
498 }
499};
500
501/// Equality comparison for SmallPtrSet.
502///
503/// Iterates over elements of LHS confirming that each value from LHS is also in
504/// RHS, and that no additional values are in RHS.
505template <typename PtrType>
506[[nodiscard]] bool operator==(const SmallPtrSetImpl<PtrType> &LHS,
508 if (LHS.size() != RHS.size())
509 return false;
510
511 for (const auto *KV : LHS)
512 if (!RHS.count(KV))
513 return false;
514
515 return true;
516}
517
518/// Inequality comparison for SmallPtrSet.
519///
520/// Equivalent to !(LHS == RHS).
521template <typename PtrType>
522[[nodiscard]] bool operator!=(const SmallPtrSetImpl<PtrType> &LHS,
524 return !(LHS == RHS);
525}
526
527/// SmallPtrSet - This class implements a set which is optimized for holding
528/// SmallSize or less elements. This internally rounds up SmallSize to the next
529/// power of two if it is not already a power of two. See the comments above
530/// SmallPtrSetImplBase for details of the algorithm.
531template <class PtrType, unsigned SmallSize>
532class SmallPtrSet : public SmallPtrSetImpl<PtrType> {
533 // In small mode SmallPtrSet uses linear search for the elements, so it is
534 // not a good idea to choose this value too high. You may consider using a
535 // DenseSet<> instead if you expect many elements in the set.
536 static_assert(SmallSize <= 32, "SmallSize should be small");
537
538 using BaseT = SmallPtrSetImpl<PtrType>;
539
540 // Make sure that SmallSize is a power of two, round up if not.
541 static constexpr size_t SmallSizePowTwo = llvm::bit_ceil_constexpr(SmallSize);
542 /// SmallStorage - Fixed size storage used in 'small mode'.
543 const void *SmallStorage[SmallSizePowTwo];
544
545public:
546 SmallPtrSet() : BaseT(SmallStorage, SmallSizePowTwo) {}
547 SmallPtrSet(const SmallPtrSet &that) : BaseT(SmallStorage, that) {}
549 : BaseT(SmallStorage, SmallSizePowTwo, that.SmallStorage,
550 std::move(that)) {}
551
552 template <typename It>
553 SmallPtrSet(It I, It E) : BaseT(SmallStorage, SmallSizePowTwo) {
554 this->insert(I, E);
555 }
556
557 template <typename Range>
560
561 SmallPtrSet(std::initializer_list<PtrType> IL)
562 : BaseT(SmallStorage, SmallSizePowTwo) {
563 this->insert(IL.begin(), IL.end());
564 }
565
568 if (&RHS != this)
569 this->copyFrom(SmallStorage, RHS);
570 return *this;
571 }
572
575 if (&RHS != this)
576 this->moveFrom(SmallStorage, SmallSizePowTwo, RHS.SmallStorage,
577 std::move(RHS));
578 return *this;
579 }
580
582 operator=(std::initializer_list<PtrType> IL) {
583 this->clear();
584 this->insert(IL.begin(), IL.end());
585 return *this;
586 }
587
588 /// swap - Swaps the elements of two sets.
590 SmallPtrSetImplBase::swap(SmallStorage, RHS.SmallStorage, RHS);
591 }
592};
593
594} // namespace llvm
595
596namespace std {
597
598/// Implement std::swap in terms of SmallPtrSet swap.
599template <class T, unsigned N>
603
604} // namespace std
605
606#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:215
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:1917
Implement std::hash so that hash_code can be used in STL containers.
Definition BitVector.h:860
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
Definition BitVector.h:862
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