14 #ifndef LLVM_ADT_DENSEMAP_H
15 #define LLVM_ADT_DENSEMAP_H
29 #include <type_traits>
38 template <
typename KeyT,
typename ValueT>
49 typename KeyT,
typename ValueT,
typename KeyInfoT = DenseMapInfo<KeyT>,
50 typename Bucket = detail::DenseMapPair<KeyT, ValueT>,
bool IsConst =
false>
53 template <
typename DerivedT,
typename KeyT,
typename ValueT,
typename KeyInfoT,
74 return iterator(getBucketsEnd(), getBucketsEnd(), *
this,
true);
81 return const_iterator(getBucketsEnd(), getBucketsEnd(), *
this,
true);
85 return getNumEntries() == 0;
87 unsigned size()
const {
return getNumEntries(); }
94 if (NumBuckets > getNumBuckets())
100 if (getNumEntries() == 0 && getNumTombstones() == 0)
return;
104 if (getNumEntries() * 4 < getNumBuckets() && getNumBuckets() > 64) {
110 unsigned NumEntries = getNumEntries();
111 for (BucketT *
P = getBuckets(), *
E = getBucketsEnd();
P !=
E; ++
P) {
114 P->getSecond().~ValueT();
117 P->getFirst() = EmptyKey;
120 assert(NumEntries == 0 &&
"Node count imbalance!");
127 const BucketT *TheBucket;
128 return LookupBucketFor(Val, TheBucket) ? 1 : 0;
133 if (LookupBucketFor(Val, TheBucket))
134 return iterator(TheBucket, getBucketsEnd(), *
this,
true);
138 const BucketT *TheBucket;
139 if (LookupBucketFor(Val, TheBucket))
149 template<
class LookupKeyT>
152 if (LookupBucketFor(Val, TheBucket))
153 return iterator(TheBucket, getBucketsEnd(), *
this,
true);
156 template<
class LookupKeyT>
158 const BucketT *TheBucket;
159 if (LookupBucketFor(Val, TheBucket))
167 const BucketT *TheBucket;
168 if (LookupBucketFor(Val, TheBucket))
169 return TheBucket->getSecond();
176 std::pair<iterator, bool>
insert(
const std::pair<KeyT, ValueT> &KV) {
183 std::pair<iterator, bool>
insert(std::pair<KeyT, ValueT> &&KV) {
184 return try_emplace(std::move(KV.first), std::move(KV.second));
190 template <
typename... Ts>
193 if (LookupBucketFor(Key, TheBucket))
194 return std::make_pair(
iterator(TheBucket, getBucketsEnd(), *
this,
true),
199 InsertIntoBucket(TheBucket, std::move(Key), std::forward<Ts>(
Args)...);
200 return std::make_pair(
iterator(TheBucket, getBucketsEnd(), *
this,
true),
207 template <
typename... Ts>
210 if (LookupBucketFor(Key, TheBucket))
211 return std::make_pair(
iterator(TheBucket, getBucketsEnd(), *
this,
true),
215 TheBucket = InsertIntoBucket(TheBucket, Key, std::forward<Ts>(
Args)...);
216 return std::make_pair(
iterator(TheBucket, getBucketsEnd(), *
this,
true),
225 template <
typename LookupKeyT>
226 std::pair<iterator, bool>
insert_as(std::pair<KeyT, ValueT> &&KV,
227 const LookupKeyT &Val) {
229 if (LookupBucketFor(Val, TheBucket))
230 return std::make_pair(
iterator(TheBucket, getBucketsEnd(), *
this,
true),
234 TheBucket = InsertIntoBucketWithLookup(TheBucket, std::move(KV.first),
235 std::move(KV.second), Val);
236 return std::make_pair(
iterator(TheBucket, getBucketsEnd(), *
this,
true),
241 template<
typename InputIt>
249 if (!LookupBucketFor(Val, TheBucket))
252 TheBucket->getSecond().~ValueT();
254 decrementNumEntries();
255 incrementNumTombstones();
259 BucketT *TheBucket = &*
I;
260 TheBucket->getSecond().~ValueT();
262 decrementNumEntries();
263 incrementNumTombstones();
268 if (LookupBucketFor(Key, TheBucket))
271 return *InsertIntoBucket(TheBucket, Key);
280 if (LookupBucketFor(Key, TheBucket))
283 return *InsertIntoBucket(TheBucket, std::move(Key));
294 return Ptr >= getBuckets() && Ptr < getBucketsEnd();
306 if (getNumBuckets() == 0)
310 for (BucketT *
P = getBuckets(), *
E = getBucketsEnd();
P !=
E; ++
P) {
313 P->getSecond().~ValueT();
314 P->getFirst().~KeyT();
322 assert((getNumBuckets() & (getNumBuckets()-1)) == 0 &&
323 "# initial buckets must be a power of two!");
325 for (BucketT *
B = getBuckets(), *
E = getBucketsEnd();
B !=
E; ++
B)
326 ::
new (&
B->getFirst()) KeyT(EmptyKey);
346 for (BucketT *
B = OldBucketsBegin, *
E = OldBucketsEnd;
B !=
E; ++
B) {
351 bool FoundVal = LookupBucketFor(
B->getFirst(), DestBucket);
353 assert(!FoundVal &&
"Key already in new map?");
354 DestBucket->getFirst() = std::move(
B->getFirst());
355 ::new (&DestBucket->getSecond())
ValueT(std::move(
B->getSecond()));
356 incrementNumEntries();
359 B->getSecond().~ValueT();
361 B->getFirst().~KeyT();
365 template <
typename OtherBaseT>
369 assert(getNumBuckets() == other.getNumBuckets());
371 setNumEntries(other.getNumEntries());
372 setNumTombstones(other.getNumTombstones());
375 memcpy(getBuckets(), other.getBuckets(),
376 getNumBuckets() *
sizeof(BucketT));
378 for (
size_t i = 0; i < getNumBuckets(); ++i) {
379 ::new (&getBuckets()[i].getFirst())
380 KeyT(other.getBuckets()[i].getFirst());
383 ::
new (&getBuckets()[i].getSecond())
384 ValueT(other.getBuckets()[i].getSecond());
389 return KeyInfoT::getHashValue(Val);
392 template<
typename LookupKeyT>
394 return KeyInfoT::getHashValue(Val);
398 static_assert(std::is_base_of<DenseMapBase, DerivedT>::value,
399 "Must pass the derived type to this template!");
400 return KeyInfoT::getEmptyKey();
404 return KeyInfoT::getTombstoneKey();
408 unsigned getNumEntries()
const {
409 return static_cast<const DerivedT *
>(
this)->getNumEntries();
412 void setNumEntries(
unsigned Num) {
413 static_cast<DerivedT *
>(
this)->setNumEntries(Num);
416 void incrementNumEntries() {
417 setNumEntries(getNumEntries() + 1);
420 void decrementNumEntries() {
421 setNumEntries(getNumEntries() - 1);
424 unsigned getNumTombstones()
const {
425 return static_cast<const DerivedT *
>(
this)->getNumTombstones();
428 void setNumTombstones(
unsigned Num) {
429 static_cast<DerivedT *
>(
this)->setNumTombstones(Num);
432 void incrementNumTombstones() {
433 setNumTombstones(getNumTombstones() + 1);
436 void decrementNumTombstones() {
437 setNumTombstones(getNumTombstones() - 1);
440 const BucketT *getBuckets()
const {
441 return static_cast<const DerivedT *
>(
this)->getBuckets();
444 BucketT *getBuckets() {
445 return static_cast<DerivedT *
>(
this)->getBuckets();
448 unsigned getNumBuckets()
const {
449 return static_cast<const DerivedT *
>(
this)->getNumBuckets();
452 BucketT *getBucketsEnd() {
453 return getBuckets() + getNumBuckets();
456 const BucketT *getBucketsEnd()
const {
457 return getBuckets() + getNumBuckets();
460 void grow(
unsigned AtLeast) {
461 static_cast<DerivedT *
>(
this)->grow(AtLeast);
464 void shrink_and_clear() {
465 static_cast<DerivedT *
>(
this)->shrink_and_clear();
468 template <
typename KeyArg,
typename... ValueArgs>
469 BucketT *InsertIntoBucket(BucketT *TheBucket, KeyArg &&Key,
470 ValueArgs &&... Values) {
471 TheBucket = InsertIntoBucketImpl(Key, Key, TheBucket);
473 TheBucket->getFirst() = std::forward<KeyArg>(Key);
474 ::new (&TheBucket->getSecond())
ValueT(std::forward<ValueArgs>(Values)...);
478 template <
typename LookupKeyT>
479 BucketT *InsertIntoBucketWithLookup(BucketT *TheBucket, KeyT &&Key,
481 TheBucket = InsertIntoBucketImpl(Key, Lookup, TheBucket);
483 TheBucket->getFirst() = std::move(Key);
484 ::new (&TheBucket->getSecond())
ValueT(std::move(Value));
488 template <
typename LookupKeyT>
489 BucketT *InsertIntoBucketImpl(
const KeyT &Key,
const LookupKeyT &Lookup,
490 BucketT *TheBucket) {
502 unsigned NewNumEntries = getNumEntries() + 1;
503 unsigned NumBuckets = getNumBuckets();
505 this->grow(NumBuckets * 2);
506 LookupBucketFor(Lookup, TheBucket);
507 NumBuckets = getNumBuckets();
508 }
else if (
LLVM_UNLIKELY(NumBuckets-(NewNumEntries+getNumTombstones()) <=
510 this->grow(NumBuckets);
511 LookupBucketFor(Lookup, TheBucket);
517 incrementNumEntries();
522 decrementNumTombstones();
531 template<
typename LookupKeyT>
532 bool LookupBucketFor(
const LookupKeyT &Val,
533 const BucketT *&FoundBucket)
const {
534 const BucketT *BucketsPtr = getBuckets();
535 const unsigned NumBuckets = getNumBuckets();
537 if (NumBuckets == 0) {
538 FoundBucket =
nullptr;
543 const BucketT *FoundTombstone =
nullptr;
548 "Empty/Tombstone value shouldn't be inserted into map!");
551 unsigned ProbeAmt = 1;
553 const BucketT *ThisBucket = BucketsPtr + BucketNo;
556 FoundBucket = ThisBucket;
565 FoundBucket = FoundTombstone ? FoundTombstone : ThisBucket;
573 FoundTombstone = ThisBucket;
577 BucketNo += ProbeAmt++;
578 BucketNo &= (NumBuckets-1);
582 template <
typename LookupKeyT>
583 bool LookupBucketFor(
const LookupKeyT &Val, BucketT *&FoundBucket) {
584 const BucketT *ConstFoundBucket;
586 ->LookupBucketFor(Val, ConstFoundBucket);
587 FoundBucket =
const_cast<BucketT *
>(ConstFoundBucket);
597 return getNumBuckets() *
sizeof(BucketT);
601 template <
typename KeyT,
typename ValueT,
602 typename KeyInfoT = DenseMapInfo<KeyT>,
603 typename BucketT = detail::DenseMapPair<KeyT, ValueT>>
605 KeyT, ValueT, KeyInfoT, BucketT> {
614 unsigned NumTombstones;
620 explicit DenseMap(
unsigned InitialReserve = 0) {
init(InitialReserve); }
632 template<
typename InputIt>
634 init(std::distance(I, E));
640 operator delete(Buckets);
648 std::swap(NumTombstones, RHS.NumTombstones);
660 operator delete(Buckets);
668 operator delete(Buckets);
669 if (allocateBuckets(other.NumBuckets)) {
677 void init(
unsigned InitNumEntries) {
679 if (allocateBuckets(InitBuckets)) {
688 unsigned OldNumBuckets = NumBuckets;
689 BucketT *OldBuckets = Buckets;
691 allocateBuckets(std::max<unsigned>(64, static_cast<unsigned>(
NextPowerOf2(AtLeast-1))));
701 operator delete(OldBuckets);
705 unsigned OldNumEntries = NumEntries;
709 unsigned NewNumBuckets = 0;
712 if (NewNumBuckets == NumBuckets) {
717 operator delete(Buckets);
722 unsigned getNumEntries()
const {
726 void setNumEntries(
unsigned Num) {
730 unsigned getNumTombstones()
const {
731 return NumTombstones;
734 void setNumTombstones(
unsigned Num) {
738 BucketT *getBuckets()
const {
742 unsigned getNumBuckets()
const {
746 bool allocateBuckets(
unsigned Num) {
748 if (NumBuckets == 0) {
753 Buckets =
static_cast<BucketT*
>(
operator new(
sizeof(BucketT) * NumBuckets));
758 template <
typename KeyT,
typename ValueT,
unsigned InlineBuckets = 4,
759 typename KeyInfoT = DenseMapInfo<KeyT>,
760 typename BucketT = detail::DenseMapPair<KeyT, ValueT>>
763 SmallDenseMap<KeyT, ValueT, InlineBuckets, KeyInfoT, BucketT>, KeyT,
764 ValueT, KeyInfoT, BucketT> {
772 "InlineBuckets must be a power of 2.");
775 unsigned NumEntries : 31;
776 unsigned NumTombstones;
789 init(NumInitBuckets);
802 template<
typename InputIt>
814 unsigned TmpNumEntries = RHS.NumEntries;
815 RHS.NumEntries = NumEntries;
816 NumEntries = TmpNumEntries;
817 std::swap(NumTombstones, RHS.NumTombstones);
821 if (Small && RHS.Small) {
826 for (
unsigned i = 0, e = InlineBuckets; i != e; ++i) {
827 BucketT *LHSB = &getInlineBuckets()[i],
828 *RHSB = &RHS.getInlineBuckets()[i];
833 if (hasLHSValue && hasRHSValue) {
839 std::swap(LHSB->getFirst(), RHSB->getFirst());
841 ::new (&RHSB->getSecond())
ValueT(std::move(LHSB->getSecond()));
842 LHSB->getSecond().~ValueT();
843 }
else if (hasRHSValue) {
844 ::new (&LHSB->getSecond())
ValueT(std::move(RHSB->getSecond()));
845 RHSB->getSecond().~ValueT();
850 if (!Small && !RHS.Small) {
851 std::swap(getLargeRep()->Buckets, RHS.getLargeRep()->Buckets);
852 std::swap(getLargeRep()->NumBuckets, RHS.getLargeRep()->NumBuckets);
860 LargeRep TmpRep = std::move(*LargeSide.getLargeRep());
861 LargeSide.getLargeRep()->~LargeRep();
862 LargeSide.Small =
true;
867 for (
unsigned i = 0, e = InlineBuckets; i != e; ++i) {
868 BucketT *NewB = &LargeSide.getInlineBuckets()[i],
869 *OldB = &SmallSide.getInlineBuckets()[i];
870 ::new (&NewB->getFirst()) KeyT(std::move(OldB->getFirst()));
871 OldB->getFirst().~KeyT();
874 ::new (&NewB->getSecond())
ValueT(std::move(OldB->getSecond()));
875 OldB->getSecond().~ValueT();
881 SmallSide.Small =
false;
882 new (SmallSide.getLargeRep()) LargeRep(std::move(TmpRep));
903 if (other.getNumBuckets() > InlineBuckets) {
905 new (getLargeRep()) LargeRep(allocateBuckets(other.getNumBuckets()));
910 void init(
unsigned InitBuckets) {
912 if (InitBuckets > InlineBuckets) {
914 new (getLargeRep()) LargeRep(allocateBuckets(InitBuckets));
920 if (AtLeast >= InlineBuckets)
921 AtLeast = std::max<unsigned>(64,
NextPowerOf2(AtLeast-1));
924 if (AtLeast < InlineBuckets)
929 BucketT *TmpBegin =
reinterpret_cast<BucketT *
>(TmpStorage.
buffer);
930 BucketT *TmpEnd = TmpBegin;
936 for (BucketT *
P = getBuckets(), *
E =
P + InlineBuckets;
P !=
E; ++
P) {
939 assert(
size_t(TmpEnd - TmpBegin) < InlineBuckets &&
940 "Too many inline buckets!");
941 ::new (&TmpEnd->getFirst()) KeyT(std::move(
P->getFirst()));
942 ::new (&TmpEnd->getSecond())
ValueT(std::move(
P->getSecond()));
944 P->getSecond().~ValueT();
946 P->getFirst().~KeyT();
952 new (getLargeRep()) LargeRep(allocateBuckets(AtLeast));
957 LargeRep OldRep = std::move(*getLargeRep());
958 getLargeRep()->~LargeRep();
959 if (AtLeast <= InlineBuckets) {
962 new (getLargeRep()) LargeRep(allocateBuckets(AtLeast));
968 operator delete(OldRep.Buckets);
972 unsigned OldSize = this->
size();
976 unsigned NewNumBuckets = 0;
979 if (NewNumBuckets > InlineBuckets && NewNumBuckets < 64u)
982 if ((Small && NewNumBuckets <= InlineBuckets) ||
983 (!Small && NewNumBuckets == getLargeRep()->NumBuckets)) {
993 unsigned getNumEntries()
const {
997 void setNumEntries(
unsigned Num) {
999 assert(Num < (1U << 31) &&
"Cannot support more than 1<<31 entries");
1003 unsigned getNumTombstones()
const {
1004 return NumTombstones;
1007 void setNumTombstones(
unsigned Num) {
1008 NumTombstones = Num;
1011 const BucketT *getInlineBuckets()
const {
1016 return reinterpret_cast<const BucketT *
>(storage.
buffer);
1019 BucketT *getInlineBuckets() {
1020 return const_cast<BucketT *
>(
1021 const_cast<const SmallDenseMap *
>(
this)->getInlineBuckets());
1024 const LargeRep *getLargeRep()
const {
1027 return reinterpret_cast<const LargeRep *
>(storage.
buffer);
1030 LargeRep *getLargeRep() {
1031 return const_cast<LargeRep *
>(
1035 const BucketT *getBuckets()
const {
1036 return Small ? getInlineBuckets() : getLargeRep()->Buckets;
1039 BucketT *getBuckets() {
1040 return const_cast<BucketT *
>(
1044 unsigned getNumBuckets()
const {
1045 return Small ? InlineBuckets : getLargeRep()->NumBuckets;
1048 void deallocateBuckets() {
1052 operator delete(getLargeRep()->Buckets);
1053 getLargeRep()->~LargeRep();
1056 LargeRep allocateBuckets(
unsigned Num) {
1057 assert(Num > InlineBuckets &&
"Must allocate more buckets than are inline");
1059 static_cast<BucketT*
>(
operator new(
sizeof(BucketT) * Num)), Num
1065 template <
typename KeyT,
typename ValueT,
typename KeyInfoT,
typename Bucket,
1067 class DenseMapIterator : DebugEpochBase::HandleBase {
1076 typename std::conditional<IsConst, const Bucket, Bucket>::type;
1089 bool NoAdvance =
false)
1091 assert(isHandleInSync() &&
"invalid construction!");
1092 if (!NoAdvance) AdvancePastEmptyBuckets();
1098 template <
bool IsConstSrc,
1099 typename =
typename std::enable_if<!IsConstSrc && IsConst>::type>
1105 assert(isHandleInSync() &&
"invalid iterator access!");
1109 assert(isHandleInSync() &&
"invalid iterator access!");
1114 assert((!
Ptr || isHandleInSync()) &&
"handle not in sync!");
1117 "comparing incomparable iterators!");
1118 return Ptr == RHS.Ptr;
1121 assert((!
Ptr || isHandleInSync()) &&
"handle not in sync!");
1124 "comparing incomparable iterators!");
1125 return Ptr != RHS.Ptr;
1129 assert(isHandleInSync() &&
"invalid iterator access!");
1131 AdvancePastEmptyBuckets();
1135 assert(isHandleInSync() &&
"invalid iterator access!");
1140 void AdvancePastEmptyBuckets() {
1141 const KeyT
Empty = KeyInfoT::getEmptyKey();
1142 const KeyT Tombstone = KeyInfoT::getTombstoneKey();
1150 template<
typename KeyT,
typename ValueT,
typename KeyInfoT>
1151 static inline size_t
1158 #endif // LLVM_ADT_DENSEMAP_H
unsigned Log2_32_Ceil(uint32_t Value)
Return the ceil log base 2 of the specified value, 32 if the value is zero.
ValueT & operator[](const KeyT &Key)
ValueT lookup(const_arg_type_t< KeyT > Val) const
lookup - Return the entry for the specified key, or a default constructed value if no such entry exis...
void copyFrom(const DenseMap &other)
void moveFromOldBuckets(BucketT *OldBucketsBegin, BucketT *OldBucketsEnd)
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
const_iterator find_as(const LookupKeyT &Val) const
void init(unsigned InitNumEntries)
#define LLVM_UNLIKELY(EXPR)
#define LLVM_LIKELY(EXPR)
typename std::conditional< IsConst, const Bucket, Bucket >::type value_type
constexpr char IsConst[]
Key for Kernel::Arg::Metadata::mIsConst.
const KeyT & getFirst() const
void init(unsigned InitBuckets)
static size_t capacity_in_bytes(const BitVector &X)
const_iterator begin() const
static const KeyT getTombstoneKey()
const_iterator end() const
DenseMap(unsigned InitialReserve=0)
Create a DenseMap wth an optional InitialReserve that guarantee that this number of elements can be i...
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
DenseMapIterator< KeyT, ValueT, KeyInfoT, BucketT, true > const_iterator
size_t getMemorySize() const
Return the approximate size (in bytes) of the actual map.
A base class for data structure classes wishing to make iterators ("handles") pointing into themselve...
const void * getEpochAddress() const
Returns a pointer to the epoch word stored in the data structure this handle points into...
static int Lookup(ArrayRef< TableEntry > Table, unsigned Opcode)
const void * getPointerIntoBucketsArray() const
getPointerIntoBucketsArray() - Return an opaque pointer into the buckets array.
void incrementEpoch()
Calling incrementEpoch invalidates all handles pointing into the calling instance.
SmallDenseMap(SmallDenseMap &&other)
std::pair< iterator, bool > try_emplace(KeyT &&Key, Ts &&...Args)
static bool isEqual(const Function &Caller, const Function &Callee)
unsigned getMinBucketToReserveForEntries(unsigned NumEntries)
Returns the number of buckets to allocate to ensure that the DenseMap can accommodate NumEntries with...
static const KeyT getEmptyKey()
void copyFrom(const DenseMapBase< OtherBaseT, KeyT, ValueT, KeyInfoT, BucketT > &other)
SmallDenseMap(unsigned NumInitBuckets=0)
void grow(unsigned AtLeast)
value_type & FindAndConstruct(const KeyT &Key)
iterator find(const_arg_type_t< KeyT > Val)
std::forward_iterator_tag iterator_category
Function Alias Analysis false
bool isHandleInSync() const
Returns true if the DebugEpochBase this Handle is linked to has not called incrementEpoch on itself s...
bool erase(const KeyT &Val)
DenseMap(DenseMap &&other)
SmallDenseMap(const SmallDenseMap &other)
static unsigned getHashValue(const LookupKeyT &Val)
bool operator!=(const ConstIterator &RHS) const
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
void grow(unsigned AtLeast)
constexpr bool isPowerOf2_64(uint64_t Value)
Return true if the argument is a power of two > 0 (64 bit edition.)
DenseMap(const DenseMap &other)
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang","erlang-compatible garbage collector")
static const unsigned End
void reserve(size_type NumEntries)
Grow the densemap so that it can contain at least NumEntries items before resizing again...
llvm::AlignedCharArray< alignof(llvm::detail::AlignerImpl< T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 >), sizeof(::llvm::detail::SizerImpl< T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 >)>::buffer char buffer[Size]
uint64_t NextPowerOf2(uint64_t A)
Returns the next power of two (in 64-bits) that is strictly greater than A.
void insert(InputIt I, InputIt E)
insert - Range insertion of pairs.
SmallDenseMap & operator=(const SmallDenseMap &other)
const_iterator find(const_arg_type_t< KeyT > Val) const
isPodLike - This is a type trait that is used to determine whether a given type can be copied around ...
DenseMapIterator operator++(int)
void swap(SmallDenseMap &RHS)
DenseMap & operator=(const DenseMap &other)
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
SmallDenseMap & operator=(SmallDenseMap &&other)
void copyFrom(const SmallDenseMap &other)
size_type count(const_arg_type_t< KeyT > Val) const
Return 1 if the specified key is in the map, 0 otherwise.
bool isPointerIntoBucketsArray(const void *Ptr) const
isPointerIntoBucketsArray - Return true if the specified pointer points somewhere into the DenseMap's...
DenseMapIterator & operator++()
ValueT & operator[](KeyT &&Key)
DenseMapIterator< KeyT, ValueT, KeyInfoT, BucketT > iterator
std::pair< iterator, bool > insert(std::pair< KeyT, ValueT > &&KV)
LLVM_NODISCARD bool empty() const
#define LLVM_NODISCARD
LLVM_NODISCARD - Warn if a type or return value is discarded.
iterator find_as(const LookupKeyT &Val)
Alternate version of find() which allows a different, and possibly less expensive, key type.
const ValueT & getSecond() const
value_type & FindAndConstruct(KeyT &&Key)
SmallDenseMap(const InputIt &I, const InputIt &E)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
DenseMap(const InputIt &I, const InputIt &E)
DenseMapIterator(const DenseMapIterator< KeyT, ValueT, KeyInfoT, Bucket, IsConstSrc > &I)
bool operator==(const ConstIterator &RHS) const
DenseMap & operator=(DenseMap &&other)
reference operator*() const
DenseMapIterator(pointer Pos, pointer E, const DebugEpochBase &Epoch, bool NoAdvance=false)
std::pair< iterator, bool > try_emplace(const KeyT &Key, Ts &&...Args)
std::pair< iterator, bool > insert_as(std::pair< KeyT, ValueT > &&KV, const LookupKeyT &Val)
Alternate version of insert() which allows a different, and possibly less expensive, key type.
static unsigned getHashValue(const KeyT &Val)
pointer operator->() const