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
154
158
162
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.
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 &&
319 ++Bucket;
320 }
321
322 using BucketItTy =
323 std::conditional_t<shouldReverseIterate(),
324 std::reverse_iterator<const void *const *>,
325 const void *const *>;
326
327 BucketItTy Bucket;
328 BucketItTy End;
329};
330
331/// SmallPtrSetIterator - This implements a const_iterator for SmallPtrSet.
332template <typename PtrTy>
334 using PtrTraits = PointerLikeTypeTraits<PtrTy>;
335
336public:
337 using value_type = PtrTy;
338 using reference = PtrTy;
339 using pointer = PtrTy;
340 using difference_type = std::ptrdiff_t;
341 using iterator_category = std::forward_iterator_tag;
342
344
345 // Most methods are provided by the base class.
346
347 const PtrTy operator*() const {
348 return PtrTraits::getFromVoidPointer(dereference());
349 }
350
351 inline SmallPtrSetIterator &operator++() { // Preincrement
352 increment();
353 return *this;
354 }
355
356 SmallPtrSetIterator operator++(int) { // Postincrement
357 SmallPtrSetIterator tmp = *this;
358 increment();
359 return tmp;
360 }
361};
362
363/// A templated base class for \c SmallPtrSet which provides the
364/// typesafe interface that is common across all small sizes.
365///
366/// This is particularly useful for passing around between interface boundaries
367/// to avoid encoding a particular small size in the interface boundary.
368template <typename PtrType> class SmallPtrSetImpl : public SmallPtrSetImplBase {
369 using ConstPtrType = typename add_const_past_pointer<PtrType>::type;
370 using PtrTraits = PointerLikeTypeTraits<PtrType>;
371 using ConstPtrTraits = PointerLikeTypeTraits<ConstPtrType>;
372
373protected:
374 // Forward constructors to the base.
376
377public:
380 using key_type = ConstPtrType;
381 using value_type = PtrType;
382
384
385 /// Inserts Ptr if and only if there is no element in the container equal to
386 /// Ptr. The bool component of the returned pair is true if and only if the
387 /// insertion takes place, and the iterator component of the pair points to
388 /// the element equal to Ptr.
389 std::pair<iterator, bool> insert(PtrType Ptr) {
390 auto p = insert_imp(PtrTraits::getAsVoidPointer(Ptr));
391 return {makeIterator(p.first), p.second};
392 }
393
394 /// Insert the given pointer with an iterator hint that is ignored. This is
395 /// identical to calling insert(Ptr), but allows SmallPtrSet to be used by
396 /// std::insert_iterator and std::inserter().
397 iterator insert(iterator, PtrType Ptr) { return insert(Ptr).first; }
398
399 /// Remove pointer from the set.
400 ///
401 /// Returns whether the pointer was in the set. Invalidates iterators if
402 /// true is returned. To remove elements while iterating over the set, use
403 /// remove_if() instead.
404 bool erase(PtrType Ptr) {
405 return erase_imp(PtrTraits::getAsVoidPointer(Ptr));
406 }
407
408 /// Remove elements that match the given predicate.
409 ///
410 /// This method is a safe replacement for the following pattern, which is not
411 /// valid, because the erase() calls would invalidate the iterator:
412 ///
413 /// for (PtrType *Ptr : Set)
414 /// if (Pred(P))
415 /// Set.erase(P);
416 ///
417 /// Returns whether anything was removed. It is safe to read the set inside
418 /// the predicate function. However, the predicate must not modify the set
419 /// itself, only indicate a removal by returning true.
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 for (const void *&Bucket : buckets()) {
440 if (Bucket == getTombstoneMarker() || Bucket == getEmptyMarker())
441 continue;
442 PtrType Ptr = PtrTraits::getFromVoidPointer(const_cast<void *>(Bucket));
443 if (P(Ptr)) {
444 Bucket = getTombstoneMarker();
446 --NumEntries;
448 Removed = true;
449 }
450 }
451 return Removed;
452 }
453
454 /// count - Return 1 if the specified pointer is in the set, 0 otherwise.
455 size_type count(ConstPtrType Ptr) const {
456 return contains_imp(ConstPtrTraits::getAsVoidPointer(Ptr));
457 }
458 iterator find(ConstPtrType Ptr) const {
459 return makeIterator(find_imp(ConstPtrTraits::getAsVoidPointer(Ptr)));
460 }
461 bool contains(ConstPtrType Ptr) const {
462 return contains_imp(ConstPtrTraits::getAsVoidPointer(Ptr));
463 }
464
465 template <typename IterT> void insert(IterT I, IterT E) {
466 for (; I != E; ++I)
467 insert(*I);
468 }
469
470 void insert(std::initializer_list<PtrType> IL) {
471 insert(IL.begin(), IL.end());
472 }
473
474 template <typename Range> void insert_range(Range &&R) {
475 insert(adl_begin(R), adl_end(R));
476 }
477
478 iterator begin() const {
480 return makeIterator(EndPointer() - 1);
481 return makeIterator(CurArray);
482 }
483 iterator end() const { return makeIterator(EndPointer()); }
484
485private:
486 /// Create an iterator that dereferences to same place as the given pointer.
487 iterator makeIterator(const void *const *P) const {
489 return iterator(P == EndPointer() ? CurArray : P + 1, CurArray, *this);
490 return iterator(P, EndPointer(), *this);
491 }
492};
493
494/// Equality comparison for SmallPtrSet.
495///
496/// Iterates over elements of LHS confirming that each value from LHS is also in
497/// RHS, and that no additional values are in RHS.
498template <typename PtrType>
501 if (LHS.size() != RHS.size())
502 return false;
503
504 for (const auto *KV : LHS)
505 if (!RHS.count(KV))
506 return false;
507
508 return true;
509}
510
511/// Inequality comparison for SmallPtrSet.
512///
513/// Equivalent to !(LHS == RHS).
514template <typename PtrType>
517 return !(LHS == RHS);
518}
519
520/// SmallPtrSet - This class implements a set which is optimized for holding
521/// SmallSize or less elements. This internally rounds up SmallSize to the next
522/// power of two if it is not already a power of two. See the comments above
523/// SmallPtrSetImplBase for details of the algorithm.
524template <class PtrType, unsigned SmallSize>
525class SmallPtrSet : public SmallPtrSetImpl<PtrType> {
526 // In small mode SmallPtrSet uses linear search for the elements, so it is
527 // not a good idea to choose this value too high. You may consider using a
528 // DenseSet<> instead if you expect many elements in the set.
529 static_assert(SmallSize <= 32, "SmallSize should be small");
530
531 using BaseT = SmallPtrSetImpl<PtrType>;
532
533 // A constexpr version of llvm::bit_ceil.
534 // TODO: Replace this with std::bit_ceil once C++20 is available.
535 static constexpr size_t RoundUpToPowerOfTwo(size_t X) {
536 size_t C = 1;
537 size_t CMax = C << (std::numeric_limits<size_t>::digits - 1);
538 while (C < X && C < CMax)
539 C <<= 1;
540 return C;
541 }
542
543 // Make sure that SmallSize is a power of two, round up if not.
544 static constexpr size_t SmallSizePowTwo = RoundUpToPowerOfTwo(SmallSize);
545 /// SmallStorage - Fixed size storage used in 'small mode'.
546 const void *SmallStorage[SmallSizePowTwo];
547
548public:
549 SmallPtrSet() : BaseT(SmallStorage, SmallSizePowTwo) {}
550 SmallPtrSet(const SmallPtrSet &that) : BaseT(SmallStorage, that) {}
552 : BaseT(SmallStorage, SmallSizePowTwo, that.SmallStorage,
553 std::move(that)) {}
554
555 template <typename It>
556 SmallPtrSet(It I, It E) : BaseT(SmallStorage, SmallSizePowTwo) {
557 this->insert(I, E);
558 }
559
560 template <typename Range>
563
564 SmallPtrSet(std::initializer_list<PtrType> IL)
565 : BaseT(SmallStorage, SmallSizePowTwo) {
566 this->insert(IL.begin(), IL.end());
567 }
568
571 if (&RHS != this)
572 this->copyFrom(SmallStorage, RHS);
573 return *this;
574 }
575
578 if (&RHS != this)
579 this->moveFrom(SmallStorage, SmallSizePowTwo, RHS.SmallStorage,
580 std::move(RHS));
581 return *this;
582 }
583
585 operator=(std::initializer_list<PtrType> IL) {
586 this->clear();
587 this->insert(IL.begin(), IL.end());
588 return *this;
589 }
590
591 /// swap - Swaps the elements of two sets.
593 SmallPtrSetImplBase::swap(SmallStorage, RHS.SmallStorage, RHS);
594 }
595};
596
597} // namespace llvm
598
599namespace std {
600
601/// Implement std::swap in terms of SmallPtrSet swap.
602template <class T, unsigned N>
606
607} // namespace std
608
609#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:58
ConstantRange Range(APInt(BitWidth, Low), APInt(BitWidth, High))
#define P(N)
This file contains library features backported from future STL versions.
static TableGen::Emitter::OptClass< SkeletonEmitter > X("gen-skeleton-class", "Generate example skeleton class")
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()
const void *const * find_imp(const void *Ptr) const
Returns the raw pointer needed to construct an iterator.
unsigned NumTombstones
Number of tombstones in CurArray.
Definition SmallPtrSet.h:70
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: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)
bool contains_imp(const void *Ptr) const
friend class SmallPtrSetIteratorImpl
Definition SmallPtrSet.h:57
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:63
iterator_range< const void *const * > buckets() const
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()
static void * getTombstoneMarker()
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.
@ C
The default llvm calling convention, compatible with C.
Definition CallingConv.h:34
This is an optimization pass for GlobalISel generic memory operations.
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:314
bool operator==(const AddressRangeValuePair &LHS, const AddressRangeValuePair &RHS)
constexpr bool has_single_bit(T Value) noexcept
Definition bit.h:147
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:1847
Implement std::hash so that hash_code can be used in STL containers.
Definition BitVector.h:870
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
Definition BitVector.h:872
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:49