Go to the documentation of this file.
14 #ifndef LLVM_ADT_DENSESET_H
15 #define LLVM_ADT_DENSESET_H
22 #include <initializer_list>
53 template <
typename ValueT,
typename MapTy,
typename ValueInfoT>
55 static_assert(
sizeof(
typename MapTy::value_type) ==
sizeof(
ValueT),
56 "DenseMap buckets unexpectedly large!");
67 explicit DenseSetImpl(
unsigned InitialReserve = 0) : TheMap(InitialReserve) {}
69 template <
typename InputIt>
77 insert(Elems.begin(), Elems.end());
80 bool empty()
const {
return TheMap.empty(); }
86 void resize(
size_t Size) { TheMap.resize(Size); }
90 void reserve(
size_t Size) { TheMap.reserve(Size); }
98 return TheMap.count(V);
102 return TheMap.erase(V);
112 typename MapTy::iterator I;
142 typename MapTy::const_iterator I;
179 iterator find(const_arg_type_t<ValueT> V) {
return Iterator(TheMap.find(V)); }
181 return ConstIterator(TheMap.find(V));
186 return TheMap.find(V) != TheMap.end();
194 template <
class LookupKeyT>
196 return Iterator(TheMap.find_as(Val));
198 template <
class LookupKeyT>
200 return ConstIterator(TheMap.find_as(Val));
203 void erase(Iterator
I) {
return TheMap.erase(
I.I); }
204 void erase(ConstIterator CI) {
return TheMap.erase(CI.I); }
208 return TheMap.try_emplace(V,
Empty);
218 template <
typename LookupKeyT>
220 const LookupKeyT &LookupKey) {
223 template <
typename LookupKeyT>
229 template<
typename InputIt>
242 template <
typename ValueT,
typename MapTy,
typename ValueInfoT>
245 if (
LHS.size() !=
RHS.size())
258 template <
typename ValueT,
typename MapTy,
typename ValueInfoT>
267 template <
typename ValueT,
typename ValueInfoT = DenseMapInfo<ValueT>>
269 ValueT, DenseMap<ValueT, detail::DenseSetEmpty, ValueInfoT,
270 detail::DenseSetPair<ValueT>>,
284 template <
typename ValueT,
unsigned InlineBuckets = 4,
288 ValueT, SmallDenseMap<ValueT, detail::DenseSetEmpty, InlineBuckets,
289 ValueInfoT, detail::DenseSetPair<ValueT>>,
302 #endif // LLVM_ADT_DENSESET_H
RTTIExtends< ObjectLinkingLayer, ObjectLayer > BaseT
This is an optimization pass for GlobalISel generic memory operations.
void reserve(size_t Size)
Grow the DenseSet so that it can contain at least NumEntries items before resizing again.
const ValueT * operator->() const
DenseSetEmpty & getSecond()
ConstIterator operator++(int)
bool operator!=(const DenseSetImpl< ValueT, MapTy, ValueInfoT > &LHS, const DenseSetImpl< ValueT, MapTy, ValueInfoT > &RHS)
Inequality comparison for DenseSet.
ConstIterator & operator++()
iterator find(const_arg_type_t< ValueT > V)
Implements a dense probed hash-table based set with some number of buckets stored inline.
void insert(InputIt I, InputIt E)
DenseSetImpl(std::initializer_list< ValueT > Elems)
const_iterator find(const_arg_type_t< ValueT > V) const
friend bool operator!=(const ConstIterator &X, const ConstIterator &Y)
uint64_t PowerOf2Ceil(uint64_t A)
Returns the power of two which is greater than or equal to the given value.
std::pair< iterator, bool > insert(const ValueT &V)
size_type count(const_arg_type_t< ValueT > V) const
Return 1 if the specified key is in the set, 0 otherwise.
size_t getMemorySize() const
const_iterator end() const
const ValueT & operator*() const
An information struct used to provide DenseMap with the various necessary components for a given valu...
std::pair< iterator, bool > insert_as(ValueT &&V, const LookupKeyT &LookupKey)
DenseSetImpl(unsigned InitialReserve=0)
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
void swap(DenseSetImpl &RHS)
const ValueT & operator*() const
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml", "ocaml 3.10-compatible collector")
std::forward_iterator_tag iterator_category
friend bool operator!=(const Iterator &X, const Iterator &Y)
void erase(ConstIterator CI)
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
void resize(size_t Size)
Grow the DenseSet so that it has at least Size buckets.
bool operator==(const DenseSetImpl< ValueT, MapTy, ValueInfoT > &LHS, const DenseSetImpl< ValueT, MapTy, ValueInfoT > &RHS)
Equality comparison for DenseSet.
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
Implements a dense probed hash-table based set.
std::pair< iterator, bool > insert_as(const ValueT &V, const LookupKeyT &LookupKey)
Alternative version of insert that uses a different (and possibly less expensive) key type.
ConstIterator const_iterator
const_iterator find_as(const LookupKeyT &Val) const
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
typename MapTy::const_iterator::difference_type difference_type
Iterator(const typename MapTy::iterator &i)
friend bool operator==(const Iterator &X, const Iterator &Y)
friend bool operator==(const ConstIterator &X, const ConstIterator &Y)
std::forward_iterator_tag iterator_category
const KeyT & getFirst() const
bool contains(const_arg_type_t< ValueT > V) const
Check if the set contains the given element.
std::pair< iterator, bool > insert(ValueT &&V)
ConstIterator(const typename MapTy::const_iterator &i)
iterator find_as(const LookupKeyT &Val)
Alternative version of find() which allows a different, and possibly less expensive,...
DenseSetImpl(const InputIt &I, const InputIt &E)
const DenseSetEmpty & getSecond() const
bool erase(const ValueT &V)
ConstIterator(const Iterator &B)
const_iterator begin() const
typename MapTy::iterator::difference_type difference_type
const ValueT * operator->() const
Base class for DenseSet and DenseSmallSet.