14#ifndef LLVM_ADT_DENSESET_H
15#define LLVM_ADT_DENSESET_H
22#include <initializer_list>
53template <
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(); }
98 return TheMap.count(V);
102 return TheMap.erase(V);
112 typename MapTy::iterator I;
142 typename MapTy::const_iterator I;
186 return TheMap.find(V) != TheMap.end();
194 template <
class LookupKeyT>
196 return Iterator(TheMap.find_as(Val));
198 template <
class LookupKeyT>
208 return TheMap.try_emplace(V,
Empty);
213 return TheMap.try_emplace(std::move(V),
Empty);
218 template <
typename LookupKeyT>
220 const LookupKeyT &LookupKey) {
223 template <
typename LookupKeyT>
229 template<
typename InputIt>
242template <
typename ValueT,
typename MapTy,
typename ValueInfoT>
245 if (
LHS.size() !=
RHS.size())
258template <
typename ValueT,
typename MapTy,
typename ValueInfoT>
267template <
typename ValueT,
typename ValueInfoT = DenseMapInfo<ValueT>>
269 ValueT, DenseMap<ValueT, detail::DenseSetEmpty, ValueInfoT,
270 detail::DenseSetPair<ValueT>>,
284template <
typename ValueT,
unsigned InlineBuckets = 4,
288 ValueT, SmallDenseMap<ValueT, detail::DenseSetEmpty, InlineBuckets,
289 ValueInfoT, detail::DenseSetPair<ValueT>>,
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This file defines DenseMapInfo traits for DenseMap.
This file defines the DenseMap class.
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml", "ocaml 3.10-compatible collector")
Implements a dense probed hash-table based set.
Implements a dense probed hash-table based set with some number of buckets stored inline.
ConstIterator operator++(int)
const ValueT & operator*() const
friend bool operator!=(const ConstIterator &X, const ConstIterator &Y)
friend bool operator==(const ConstIterator &X, const ConstIterator &Y)
typename MapTy::const_iterator::difference_type difference_type
ConstIterator & operator++()
ConstIterator(const typename MapTy::const_iterator &i)
std::forward_iterator_tag iterator_category
const ValueT * operator->() const
ConstIterator(const Iterator &B)
friend bool operator==(const Iterator &X, const Iterator &Y)
const ValueT & operator*() const
const ValueT * operator->() const
std::forward_iterator_tag iterator_category
friend bool operator!=(const Iterator &X, const Iterator &Y)
typename MapTy::iterator::difference_type difference_type
Iterator(const typename MapTy::iterator &i)
Base class for DenseSet and DenseSmallSet.
const_iterator find(const_arg_type_t< ValueT > V) const
std::pair< iterator, bool > insert(ValueT &&V)
std::pair< iterator, bool > insert(const ValueT &V)
size_t getMemorySize() const
const_iterator end() const
const_iterator begin() const
iterator find(const_arg_type_t< ValueT > V)
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.
void reserve(size_t Size)
Grow the DenseSet so that it can contain at least NumEntries items before resizing again.
iterator find_as(const LookupKeyT &Val)
Alternative version of find() which allows a different, and possibly less expensive,...
const_iterator find_as(const LookupKeyT &Val) const
std::pair< iterator, bool > insert_as(ValueT &&V, const LookupKeyT &LookupKey)
void insert(InputIt I, InputIt E)
void swap(DenseSetImpl &RHS)
DenseSetImpl(unsigned InitialReserve=0)
bool contains(const_arg_type_t< ValueT > V) const
Check if the set contains the given element.
DenseSetImpl(const InputIt &I, const InputIt &E)
void resize(size_t Size)
Grow the DenseSet so that it has at least Size buckets.
void erase(ConstIterator CI)
bool erase(const ValueT &V)
DenseSetImpl(std::initializer_list< ValueT > Elems)
size_type count(const_arg_type_t< ValueT > V) const
Return 1 if the specified key is in the set, 0 otherwise.
const DenseSetEmpty & getSecond() const
const KeyT & getFirst() const
DenseSetEmpty & getSecond()
bool operator!=(const DenseSetImpl< ValueT, MapTy, ValueInfoT > &LHS, const DenseSetImpl< ValueT, MapTy, ValueInfoT > &RHS)
Inequality comparison for DenseSet.
This is an optimization pass for GlobalISel generic memory operations.
bool operator==(const AddressRangeValuePair &LHS, const AddressRangeValuePair &RHS)
uint64_t PowerOf2Ceil(uint64_t A)
Returns the power of two which is greater than or equal to the given value.
Implement std::hash so that hash_code can be used in STL containers.
An information struct used to provide DenseMap with the various necessary components for a given valu...