LLVM 24.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
38template <typename PtrTy> class SmallPtrSetIterator;
39
40/// SmallPtrSetImplBase - This is the common code shared among all the
41/// SmallPtrSet<>'s, which is almost everything. SmallPtrSet has two modes, one
42/// for small and one for large sets.
43///
44/// Small sets use an array of pointers allocated in the SmallPtrSet object,
45/// which is treated as a simple array of pointers. When a pointer is added to
46/// the set, the array is scanned to see if the element already exists, if not
47/// the element is 'pushed back' onto the array. If we run out of space in the
48/// array, we grow into the 'large set' case. SmallSet should be used when the
49/// sets are often small. In this case, no memory allocation is used, and only
50/// light-weight and cache-efficient scanning is used.
51///
52/// Large sets use a linear-probed hash table with deletion implemented using
53/// Knuth TAOCP 6.4 Algorithm R: `erase` opens a hole, walks forward sliding
54/// each following entry whose probe path crosses the hole back into it (the
55/// hole moves with each slide), and stops at the next empty slot. Empty
56/// buckets are represented with an illegal pointer value (-1) to allow null
57/// pointers to be inserted; no tombstone state is needed. The hash table is
58/// resized when the table is 2/3 or more. When this happens, the table is
59/// doubled in size.
61 template <typename PtrTy> friend class SmallPtrSetIterator;
62
63protected:
64 /// The current set of buckets, in either small or big representation.
65 const void **CurArray;
66 /// CurArraySize - The allocated size of CurArray, always a power of two.
67 unsigned CurArraySize;
68
69 /// Number of elements in CurArray that contain a value.
70 /// If small, all these elements are at the beginning of CurArray and the rest
71 /// is uninitialized.
72 unsigned NumEntries;
73 /// Whether the set is in small representation.
74 bool IsSmall;
75
76 // Helpers to copy and move construct a SmallPtrSet.
77 LLVM_ABI SmallPtrSetImplBase(const void **SmallStorage,
78 const SmallPtrSetImplBase &that);
79 LLVM_ABI SmallPtrSetImplBase(const void **SmallStorage, unsigned SmallSize,
80 const void **RHSSmallStorage,
81 SmallPtrSetImplBase &&that);
82
83 explicit SmallPtrSetImplBase(const void **SmallStorage, unsigned SmallSize)
84 : CurArray(SmallStorage), CurArraySize(SmallSize), NumEntries(0),
85 IsSmall(true) {
86 assert(llvm::has_single_bit(SmallSize) &&
87 "Initial size must be a power of two!");
88 }
89
91 if (!isSmall())
92 free(CurArray);
93 }
94
95public:
97
99
100 [[nodiscard]] bool empty() const { return size() == 0; }
101 [[nodiscard]] size_type size() const { return NumEntries; }
102 [[nodiscard]] size_type capacity() const { return CurArraySize; }
103
104 void clear() {
106 // If the capacity of the array is huge, and the # elements used is small,
107 // shrink the array.
108 if (!isSmall()) {
109 if (size() * 4 < CurArraySize && CurArraySize > 32)
110 return shrink_and_clear();
111 // Fill the array with empty markers.
112 memset(CurArray, -1, CurArraySize * sizeof(void *));
113 }
114
115 NumEntries = 0;
116 }
117
118 void reserve(size_type NewNumEntries) {
120 // Do nothing if we're given zero as a reservation size.
121 if (NewNumEntries == 0)
122 return;
123 // No need to expand if we're small and NewNumEntries will fit in the space.
124 if (isSmall() && NewNumEntries <= CurArraySize)
125 return;
126 // insert_imp_big will reallocate if stores is more than 2/3 full, on the
127 // /final/ insertion.
128 if (!isSmall() && ((NewNumEntries - 1) * 3) < (CurArraySize * 2))
129 return;
130 // We must Grow -- find the size where we'd be 2/3 full, then round up to
131 // the next power of two.
132 size_type NewSize = NewNumEntries + (NewNumEntries / 2);
133 NewSize = llvm::bit_ceil(NewSize);
134 // Like insert_imp_big, always allocate at least 128 elements.
135 NewSize = std::max(128u, NewSize);
136 Grow(NewSize);
137 }
138
139protected:
140 static void *getEmptyMarker() {
141 // Note that -1 is chosen to make clear() efficiently implementable with
142 // memset and because it's not a valid pointer value.
143 return reinterpret_cast<void *>(-1);
144 }
145
146 const void **EndPointer() const {
148 }
149
153
157
161
165
166 /// insert_imp - This returns true if the pointer was new to the set, false if
167 /// it was already in the set. This is hidden from the client so that the
168 /// derived class can check that the right type of pointer is passed in.
169 std::pair<const void *const *, bool> insert_imp(const void *Ptr) {
170 if (isSmall()) {
171 // Check to see if it is already in the set.
172 for (const void *&Bucket : small_buckets()) {
173 if (Bucket == Ptr)
174 return {&Bucket, false};
175 }
176
177 // Nope, there isn't. If we stay small, just 'pushback' now.
178 if (NumEntries < CurArraySize) {
179 CurArray[NumEntries++] = Ptr;
181 return {CurArray + (NumEntries - 1), true};
182 }
183 // Otherwise, hit the big set case, which will call grow.
184 }
185 return insert_imp_big(Ptr);
186 }
187
188 /// erase_imp - If the set contains the specified pointer, remove it and
189 /// return true, otherwise return false. This is hidden from the client so
190 /// that the derived class can check that the right type of pointer is passed
191 /// in.
192 bool erase_imp(const void *Ptr) {
193 if (isSmall()) {
194 for (const void *&Bucket : small_buckets()) {
195 if (Bucket == Ptr) {
196 Bucket = CurArray[--NumEntries];
198 return true;
199 }
200 }
201 return false;
202 }
203
204 auto *Bucket = doFind(Ptr);
205 if (!Bucket)
206 return false;
207
208 eraseFromBucket(const_cast<const void **>(Bucket));
209 --NumEntries;
211 return true;
212 }
213
214 /// Returns the raw pointer needed to construct an iterator. If element not
215 /// found, this will be EndPointer. Otherwise, it will be a pointer to the
216 /// slot which stores Ptr;
217 const void *const *find_imp(const void *Ptr) const {
218 if (isSmall()) {
219 // Linear search for the item.
220 for (const void *const &Bucket : small_buckets())
221 if (Bucket == Ptr)
222 return &Bucket;
223 return EndPointer();
224 }
225
226 // Big set case.
227 if (auto *Bucket = doFind(Ptr))
228 return Bucket;
229 return EndPointer();
230 }
231
232 bool contains_imp(const void *Ptr) const {
233 if (isSmall()) {
234 // Linear search for the item.
235 for (const void *const &Bucket : small_buckets())
236 if (Bucket == Ptr)
237 return true;
238 return false;
239 }
240
241 return doFind(Ptr) != nullptr;
242 }
243
244 bool isSmall() const { return IsSmall; }
245
246private:
247 LLVM_ABI std::pair<const void *const *, bool> insert_imp_big(const void *Ptr);
248
249 LLVM_ABI const void *const *doFind(const void *Ptr) const;
250 LLVM_ABI void shrink_and_clear();
251
252protected:
253 /// Erase the entry at \p Bucket and close the resulting hole via Knuth
254 /// TAOCP 6.4 Algorithm R. Caller must update \c NumEntries and the epoch.
255 LLVM_ABI void eraseFromBucket(const void **Bucket);
256
257 /// Allocate a larger backing store for the buckets and move it over.
258 /// Passing the current size triggers a same-size rehash, used by batch
259 /// erase to compact away empty slots left by mark-then-rebuild.
260 LLVM_ABI void Grow(unsigned NewSize);
261
262 /// swap - Swaps the elements of two sets.
263 /// Note: This method assumes that both sets have the same small size.
264 LLVM_ABI void swap(const void **SmallStorage, const void **RHSSmallStorage,
266
267 LLVM_ABI void copyFrom(const void **SmallStorage,
268 const SmallPtrSetImplBase &RHS);
269 LLVM_ABI void moveFrom(const void **SmallStorage, unsigned SmallSize,
270 const void **RHSSmallStorage,
272
273private:
274 /// Code shared by moveFrom() and move constructor.
275 void moveHelper(const void **SmallStorage, unsigned SmallSize,
276 const void **RHSSmallStorage, SmallPtrSetImplBase &&RHS);
277 /// Code shared by copyFrom() and copy constructor.
278 void copyHelper(const SmallPtrSetImplBase &RHS);
279};
280
281/// This implements a const_iterator for SmallPtrSet.
282template <typename PtrTy>
285 using PtrTraits = PointerLikeTypeTraits<PtrTy>;
286 using BucketItTy =
287 std::conditional_t<shouldReverseIterate(),
288 std::reverse_iterator<const void *const *>,
289 const void *const *>;
290
291 BucketItTy Bucket = {};
292 BucketItTy End = {};
293
294 /// AdvanceIfNotValid - If the current bucket isn't valid, advance to a bucket
295 /// that is. This is guaranteed to stop because the end() bucket is marked
296 /// valid.
297 void AdvanceIfNotValid() {
298 assert(Bucket <= End);
299 while (Bucket != End && *Bucket == SmallPtrSetImplBase::getEmptyMarker())
300 ++Bucket;
301 }
302
303public:
304 using value_type = PtrTy;
305 using reference = PtrTy;
306 using pointer = PtrTy;
307 using difference_type = std::ptrdiff_t;
308 using iterator_category = std::forward_iterator_tag;
309
311
312 SmallPtrSetIterator(const void *const *BP, const void *const *E,
313 const DebugEpochBase &Epoch)
314 : DebugEpochBase::HandleBase(&Epoch), Bucket(BucketItTy(BP)),
315 End(BucketItTy(E)) {
316 AdvanceIfNotValid();
317 }
318
319 [[nodiscard]] const PtrTy operator*() const {
320 assert(isHandleInSync() && "invalid iterator access!");
321 assert(Bucket < End);
322 return PtrTraits::getFromVoidPointer(const_cast<void *>(*Bucket));
323 }
324
325 inline SmallPtrSetIterator &operator++() { // Preincrement
326 assert(isHandleInSync() && "invalid iterator access!");
327 ++Bucket;
328 AdvanceIfNotValid();
329 return *this;
330 }
331
332 SmallPtrSetIterator operator++(int) { // Postincrement
333 SmallPtrSetIterator tmp = *this;
334 ++*this;
335 return tmp;
336 }
337
338 bool operator==(const SmallPtrSetIterator &RHS) const {
339 return Bucket == RHS.Bucket;
340 }
341 bool operator!=(const SmallPtrSetIterator &RHS) const {
342 return Bucket != RHS.Bucket;
343 }
344};
345
346/// A templated base class for \c SmallPtrSet which provides the
347/// typesafe interface that is common across all small sizes.
348///
349/// This is particularly useful for passing around between interface boundaries
350/// to avoid encoding a particular small size in the interface boundary.
351template <typename PtrType> class SmallPtrSetImpl : public SmallPtrSetImplBase {
352 using ConstPtrType = typename add_const_past_pointer<PtrType>::type;
353 using PtrTraits = PointerLikeTypeTraits<PtrType>;
354 using ConstPtrTraits = PointerLikeTypeTraits<ConstPtrType>;
355
356protected:
357 // Forward constructors to the base.
359
360public:
363 using key_type = ConstPtrType;
364 using value_type = PtrType;
365
367
368 /// Inserts Ptr if and only if there is no element in the container equal to
369 /// Ptr. The bool component of the returned pair is true if and only if the
370 /// insertion takes place, and the iterator component of the pair points to
371 /// the element equal to Ptr.
372 std::pair<iterator, bool> insert(PtrType Ptr) {
373 auto p = insert_imp(PtrTraits::getAsVoidPointer(Ptr));
374 return {makeIterator(p.first), p.second};
375 }
376
377 /// Insert the given pointer with an iterator hint that is ignored. This is
378 /// identical to calling insert(Ptr), but allows SmallPtrSet to be used by
379 /// std::insert_iterator and std::inserter().
380 iterator insert(iterator, PtrType Ptr) { return insert(Ptr).first; }
381
382 /// Remove pointer from the set.
383 ///
384 /// Returns whether the pointer was in the set. Invalidates iterators if
385 /// true is returned. To remove elements while iterating over the set, use
386 /// remove_if() instead.
387 bool erase(PtrType Ptr) {
388 return erase_imp(PtrTraits::getAsVoidPointer(Ptr));
389 }
390
391 /// Remove elements that match the given predicate.
392 ///
393 /// This method is a safe replacement for the following pattern, which is not
394 /// valid, because the erase() calls would invalidate the iterator:
395 ///
396 /// for (PtrType *Ptr : Set)
397 /// if (Pred(P))
398 /// Set.erase(P);
399 ///
400 /// Returns whether anything was removed. The predicate must not access the
401 /// set being modified: it may inspect the element passed to it and return
402 /// true to request removal, but must not read (e.g. count()/find()) or
403 /// otherwise mutate the set. If anything is removed, all iterators and
404 /// references into the set are invalidated.
405 template <typename UnaryPredicate> bool remove_if(UnaryPredicate P) {
406 bool Removed = false;
407 if (isSmall()) {
408 auto Buckets = small_buckets();
409 const void **APtr = Buckets.begin(), **E = Buckets.end();
410 while (APtr != E) {
411 PtrType Ptr = PtrTraits::getFromVoidPointer(const_cast<void *>(*APtr));
412 if (P(Ptr)) {
413 *APtr = *--E;
414 --NumEntries;
416 Removed = true;
417 } else {
418 ++APtr;
419 }
420 }
421 return Removed;
422 }
423
424 // Mark-then-rebuild: one pass to clear matches without sliding (which
425 // would re-walk the cluster on every erase), then a single rehash to
426 // restore the linear-probe invariant. O(N) total, vs O(N * cluster)
427 // for repeated per-match Algorithm R erases.
428 for (const void *&Bucket : buckets()) {
429 if (Bucket == getEmptyMarker())
430 continue;
431 PtrType Ptr = PtrTraits::getFromVoidPointer(const_cast<void *>(Bucket));
432 if (P(Ptr)) {
433 Bucket = getEmptyMarker();
434 --NumEntries;
435 Removed = true;
436 }
437 }
438 if (Removed) {
441 }
442 return Removed;
443 }
444
445 /// count - Return 1 if the specified pointer is in the set, 0 otherwise.
446 [[nodiscard]] size_type count(ConstPtrType Ptr) const {
447 return contains_imp(ConstPtrTraits::getAsVoidPointer(Ptr));
448 }
449 [[nodiscard]] iterator find(ConstPtrType Ptr) const {
450 return makeIterator(find_imp(ConstPtrTraits::getAsVoidPointer(Ptr)));
451 }
452 [[nodiscard]] bool contains(ConstPtrType Ptr) const {
453 return contains_imp(ConstPtrTraits::getAsVoidPointer(Ptr));
454 }
455
456 template <typename IterT> void insert(IterT I, IterT E) {
457 for (; I != E; ++I)
458 insert(*I);
459 }
460
461 void insert(std::initializer_list<PtrType> IL) {
462 insert(IL.begin(), IL.end());
463 }
464
465 template <typename Range> void insert_range(Range &&R) {
466 insert(adl_begin(R), adl_end(R));
467 }
468
469 [[nodiscard]] iterator begin() const {
470 if constexpr (shouldReverseIterate())
471 return makeIterator(EndPointer() - 1);
472 else
473 return makeIterator(CurArray);
474 }
475 [[nodiscard]] iterator end() const { return makeIterator(EndPointer()); }
476
477private:
478 /// Create an iterator that dereferences to same place as the given pointer.
479 iterator makeIterator(const void *const *P) const {
480 if constexpr (shouldReverseIterate())
481 return iterator(P == EndPointer() ? CurArray : P + 1, CurArray, *this);
482 else
483 return iterator(P, EndPointer(), *this);
484 }
485};
486
487/// Equality comparison for SmallPtrSet.
488///
489/// Iterates over elements of LHS confirming that each value from LHS is also in
490/// RHS, and that no additional values are in RHS.
491template <typename PtrType>
492[[nodiscard]] bool operator==(const SmallPtrSetImpl<PtrType> &LHS,
494 if (LHS.size() != RHS.size())
495 return false;
496
497 for (const auto *KV : LHS)
498 if (!RHS.count(KV))
499 return false;
500
501 return true;
502}
503
504/// Inequality comparison for SmallPtrSet.
505///
506/// Equivalent to !(LHS == RHS).
507template <typename PtrType>
508[[nodiscard]] bool operator!=(const SmallPtrSetImpl<PtrType> &LHS,
510 return !(LHS == RHS);
511}
512
513/// SmallPtrSet - This class implements a set which is optimized for holding
514/// SmallSize or less elements. This internally rounds up SmallSize to the next
515/// power of two if it is not already a power of two. See the comments above
516/// SmallPtrSetImplBase for details of the algorithm.
517template <class PtrType, unsigned SmallSize>
518class SmallPtrSet : public SmallPtrSetImpl<PtrType> {
519 // In small mode SmallPtrSet uses linear search for the elements, so it is
520 // not a good idea to choose this value too high. You may consider using a
521 // DenseSet<> instead if you expect many elements in the set.
522 static_assert(SmallSize <= 32, "SmallSize should be small");
523
524 using BaseT = SmallPtrSetImpl<PtrType>;
525
526 // Make sure that SmallSize is a power of two, round up if not.
527 static constexpr size_t SmallSizePowTwo = llvm::bit_ceil_constexpr(SmallSize);
528 /// SmallStorage - Fixed size storage used in 'small mode'.
529 const void *SmallStorage[SmallSizePowTwo];
530
531public:
532 SmallPtrSet() : BaseT(SmallStorage, SmallSizePowTwo) {}
533 SmallPtrSet(const SmallPtrSet &that) : BaseT(SmallStorage, that) {}
535 : BaseT(SmallStorage, SmallSizePowTwo, that.SmallStorage,
536 std::move(that)) {}
537
538 template <typename It>
539 SmallPtrSet(It I, It E) : BaseT(SmallStorage, SmallSizePowTwo) {
540 this->insert(I, E);
541 }
542
543 template <typename Range>
546
547 SmallPtrSet(std::initializer_list<PtrType> IL)
548 : BaseT(SmallStorage, SmallSizePowTwo) {
549 this->insert(IL.begin(), IL.end());
550 }
551
554 if (&RHS != this)
555 this->copyFrom(SmallStorage, RHS);
556 return *this;
557 }
558
561 if (&RHS != this)
562 this->moveFrom(SmallStorage, SmallSizePowTwo, RHS.SmallStorage,
563 std::move(RHS));
564 return *this;
565 }
566
568 operator=(std::initializer_list<PtrType> IL) {
569 this->clear();
570 this->insert(IL.begin(), IL.end());
571 return *this;
572 }
573
574 /// swap - Swaps the elements of two sets.
576 SmallPtrSetImplBase::swap(SmallStorage, RHS.SmallStorage, RHS);
577 }
578};
579
580} // namespace llvm
581
582namespace std {
583
584/// Implement std::swap in terms of SmallPtrSet swap.
585template <class T, unsigned N>
589
590} // namespace std
591
592#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:60
size_type size() const
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:83
unsigned NumEntries
Number of elements in CurArray that contain a value.
Definition SmallPtrSet.h:72
const void ** CurArray
The current set of buckets, in either small or big representation.
Definition SmallPtrSet.h:65
bool IsSmall
Whether the set is in small representation.
Definition SmallPtrSet.h:74
LLVM_ABI void copyFrom(const void **SmallStorage, const SmallPtrSetImplBase &RHS)
void reserve(size_type NewNumEntries)
bool contains_imp(const void *Ptr) const
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:67
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
friend class SmallPtrSetIterator
Definition SmallPtrSet.h:61
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
This implements a const_iterator for SmallPtrSet.
const PtrTy operator*() const
std::ptrdiff_t difference_type
SmallPtrSetIterator(const void *const *BP, const void *const *E, const DebugEpochBase &Epoch)
SmallPtrSetIterator operator++(int)
bool operator==(const SmallPtrSetIterator &RHS) const
SmallPtrSetIterator & operator++()
std::forward_iterator_tag iterator_category
bool operator!=(const SmallPtrSetIterator &RHS) const
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:2140
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:878
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
Definition BitVector.h:880
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