14#ifndef LLVM_ADT_SMALLSET_H
15#define LLVM_ADT_SMALLSET_H
24#include <initializer_list>
32template <
typename T,
unsigned N,
typename C>
35 std::forward_iterator_tag, T> {
37 using SetIterTy =
typename std::set<T, C>::const_iterator;
88 IsSmall =
Other.IsSmall;
102 IsSmall =
Other.IsSmall;
111 if (IsSmall !=
RHS.IsSmall)
133template <
typename T,
unsigned N,
typename C = std::less<T>>
144 static_assert(
N <= 32,
"N should be small");
160 template <
typename Range>
169 [[nodiscard]]
bool empty()
const {
return Vector.empty() && Set.empty(); }
172 return isSmall() ? Vector.size() : Set.size();
182 std::pair<const_iterator, bool>
insert(
const T &V) {
return insertImpl(V); }
184 std::pair<const_iterator, bool>
insert(
T &&V) {
185 return insertImpl(std::move(V));
188 template <
typename IterT>
202 if (
I != Vector.end()) {
216 return {Vector.begin()};
217 return {Set.begin()};
222 return {Vector.end()};
229 return vfind(V) != Vector.end();
230 return Set.find(V) != Set.end();
234 bool isSmall()
const {
return Set.empty(); }
236 template <
typename ArgType>
237 std::pair<const_iterator, bool> insertImpl(ArgType &&V) {
238 static_assert(std::is_convertible_v<ArgType, T>,
239 "ArgType must be convertible to T!");
241 auto [
I, Inserted] = Set.insert(std::forward<ArgType>(V));
249 Vector.push_back(std::forward<ArgType>(V));
253 Set.insert(std::make_move_iterator(
Vector.begin()),
254 std::make_move_iterator(
Vector.end()));
261 typename SmallVector<T, N>::const_iterator vfind(
const T &V)
const {
271template <
typename Po
inteeType,
unsigned N>
282template <
typename T,
unsigned LN,
unsigned RN,
typename C>
284 if (
LHS.size() !=
RHS.size())
294template <
typename T,
unsigned LN,
unsigned RN,
typename C>
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
ConstantRange Range(APInt(BitWidth, Low), APInt(BitWidth, High))
This file contains library features backported from future STL versions.
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)
void insert_range(Range &&R)
std::pair< const_iterator, bool > insert(T &&V)
SmallSet(std::initializer_list< T > L)
SmallSet(llvm::from_range_t, Range &&R)
SmallSet & operator=(const SmallSet &)=default
SmallSet(SmallSet &&)=default
SmallSet(const SmallSet &)=default
const_iterator end() const
SmallSet(IterT Begin, IterT End)
bool contains(const T &V) const
Check if the SmallSet contains the given element.
SmallSet & operator=(SmallSet &&)=default
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.
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...
bool operator!=(uint64_t V1, const APInt &V2)
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...
bool operator==(const AddressRangeValuePair &LHS, const AddressRangeValuePair &RHS)