14#ifndef LLVM_ADT_SMALLSET_H
15#define LLVM_ADT_SMALLSET_H
33template <
typename T,
unsigned N,
typename C>
36 std::forward_iterator_tag, T> {
38 using SetIterTy =
typename std::set<T, C>::const_iterator;
89 isSmall =
Other.isSmall;
103 isSmall =
Other.isSmall;
112 if (isSmall !=
RHS.isSmall)
134template <
typename T,
unsigned N,
typename C = std::less<T>>
143 using SIterator =
typename std::set<T, C>::const_iterator;
149 static_assert(
N <= 32,
"N should be small");
159 [[nodiscard]]
bool empty()
const {
return Vector.empty() && Set.empty(); }
162 return isSmall() ?
Vector.size() : Set.size();
169 return vfind(V) ==
Vector.end() ? 0 : 1;
179 std::pair<const_iterator, bool>
insert(
const T &V) {
181 auto [
I, Inserted] = Set.insert(V);
185 VIterator
I = vfind(V);
195 Set.insert(
Vector.back());
201 template <
typename IterT>
226 return {Set.begin()};
238 return vfind(V) !=
Vector.end();
239 return Set.find(V) != Set.end();
243 bool isSmall()
const {
return Set.empty(); }
245 VIterator vfind(
const T &V)
const {
246 for (VIterator
I = Vector.begin(),
E = Vector.end();
I !=
E; ++
I)
255template <
typename Po
inteeType,
unsigned N>
266template <
typename T,
unsigned LN,
unsigned RN,
typename C>
268 if (
LHS.size() !=
RHS.size())
278template <
typename T,
unsigned LN,
unsigned RN,
typename C>
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This file defines the SmallPtrSet class.
This file defines the SmallVector class.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
SmallSetIterator - This class implements a const_iterator for SmallSet by delegating to the underlyin...
SmallSetIterator & operator=(SmallSetIterator &&Other)
SmallSetIterator & operator++()
bool operator==(const SmallSetIterator &RHS) const
SmallSetIterator(SetIterTy SetIter)
SmallSetIterator & operator=(const SmallSetIterator &Other)
SmallSetIterator(const SmallSetIterator &Other)
const T & operator*() const
SmallSetIterator(VecIterTy VecIter)
SmallSetIterator(SmallSetIterator &&Other)
SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less...
const_iterator begin() const
size_type count(const T &V) const
count - Return 1 if the element is in the set, 0 otherwise.
SmallSetIterator< T, N, C > const_iterator
void insert(IterT I, IterT E)
const_iterator end() const
bool contains(const T &V) const
Check if the SmallSet contains the given element.
std::pair< const_iterator, bool > insert(const T &V)
insert - Insert an element into the set if it isn't already there.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
CRTP base class which implements the entire standard iterator facade in terms of a minimal subset of ...
This is an optimization pass for GlobalISel generic memory operations.
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly.
bool operator!=(uint64_t V1, const APInt &V2)
bool operator==(const AddressRangeValuePair &LHS, const AddressRangeValuePair &RHS)