LLVM 22.0.0git
StringMap.h
Go to the documentation of this file.
1//===- StringMap.h - String Hash table map interface ------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8///
9/// \file
10/// This file defines the StringMap class.
11///
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_ADT_STRINGMAP_H
15#define LLVM_ADT_STRINGMAP_H
16
18#include "llvm/ADT/iterator.h"
22#include <initializer_list>
23#include <iterator>
24#include <type_traits>
25
26namespace llvm {
27
28template <typename ValueTy, bool IsConst> class StringMapIterBase;
29template <typename ValueTy> class StringMapKeyIterator;
30
31/// StringMapImpl - This is the base class of StringMap that is shared among
32/// all of its instantiations.
34protected:
35 // Array of NumBuckets pointers to entries, null pointers are holes.
36 // TheTable[NumBuckets] contains a sentinel value for easy iteration. Followed
37 // by an array of the actual hash values as unsigned integers.
39 unsigned NumBuckets = 0;
40 unsigned NumItems = 0;
41 unsigned NumTombstones = 0;
42 unsigned ItemSize;
43
44protected:
45 explicit StringMapImpl(unsigned itemSize) : ItemSize(itemSize) {}
50 RHS.TheTable = nullptr;
51 RHS.NumBuckets = 0;
52 RHS.NumItems = 0;
53 RHS.NumTombstones = 0;
54 }
55
56 LLVM_ABI StringMapImpl(unsigned InitSize, unsigned ItemSize);
58 LLVM_ABI unsigned RehashTable(unsigned BucketNo = 0);
59
60 /// LookupBucketFor - Look up the bucket that the specified string should end
61 /// up in. If it already exists as a key in the map, the Item pointer for the
62 /// specified bucket will be non-null. Otherwise, it will be null. In either
63 /// case, the FullHashValue field of the bucket will be set to the hash value
64 /// of the string.
66 return LookupBucketFor(Key, hash(Key));
67 }
68
69 /// Overload that explicitly takes precomputed hash(Key).
70 LLVM_ABI unsigned LookupBucketFor(StringRef Key, uint32_t FullHashValue);
71
72 /// FindKey - Look up the bucket that contains the specified key. If it exists
73 /// in the map, return the bucket number of the key. Otherwise return -1.
74 /// This does not modify the map.
75 int FindKey(StringRef Key) const { return FindKey(Key, hash(Key)); }
76
77 /// Overload that explicitly takes precomputed hash(Key).
78 LLVM_ABI int FindKey(StringRef Key, uint32_t FullHashValue) const;
79
80 /// RemoveKey - Remove the specified StringMapEntry from the table, but do not
81 /// delete it. This aborts if the value isn't in the table.
83
84 /// RemoveKey - Remove the StringMapEntry for the specified key from the
85 /// table, returning it. If the key is not in the table, this returns null.
87
88 /// Allocate the table with the specified number of buckets and otherwise
89 /// setup the map as empty.
90 LLVM_ABI void init(unsigned Size);
91
95
96public:
97 static constexpr uintptr_t TombstoneIntVal =
98 static_cast<uintptr_t>(-1)
100
102 return reinterpret_cast<StringMapEntryBase *>(TombstoneIntVal);
103 }
104
105 [[nodiscard]] unsigned getNumBuckets() const { return NumBuckets; }
106 [[nodiscard]] unsigned getNumItems() const { return NumItems; }
107
108 [[nodiscard]] bool empty() const { return NumItems == 0; }
109 [[nodiscard]] unsigned size() const { return NumItems; }
110
111 /// Returns the hash value that will be used for the given string.
112 /// This allows precomputing the value and passing it explicitly
113 /// to some of the functions.
114 /// The implementation of this function is not guaranteed to be stable
115 /// and may change.
116 [[nodiscard]] LLVM_ABI static uint32_t hash(StringRef Key);
117
119 std::swap(TheTable, Other.TheTable);
120 std::swap(NumBuckets, Other.NumBuckets);
121 std::swap(NumItems, Other.NumItems);
122 std::swap(NumTombstones, Other.NumTombstones);
123 }
124};
125
126/// StringMap - This is an unconventional map that is specialized for handling
127/// keys that are "strings", which are basically ranges of bytes. This does some
128/// funky memory allocation and hashing things to make it extremely efficient,
129/// storing the string data *after* the value in the map.
130template <typename ValueTy, typename AllocatorTy = MallocAllocator>
132 : public StringMapImpl,
133 private detail::AllocatorHolder<AllocatorTy> {
135
136public:
138
139 StringMap() : StringMapImpl(static_cast<unsigned>(sizeof(MapEntryTy))) {}
140
141 explicit StringMap(unsigned InitialSize)
142 : StringMapImpl(InitialSize, static_cast<unsigned>(sizeof(MapEntryTy))) {}
143
144 explicit StringMap(AllocatorTy A)
145 : StringMapImpl(static_cast<unsigned>(sizeof(MapEntryTy))), AllocTy(A) {}
146
147 StringMap(unsigned InitialSize, AllocatorTy A)
148 : StringMapImpl(InitialSize, static_cast<unsigned>(sizeof(MapEntryTy))),
149 AllocTy(A) {}
150
151 StringMap(std::initializer_list<std::pair<StringRef, ValueTy>> List)
152 : StringMapImpl(List.size(), static_cast<unsigned>(sizeof(MapEntryTy))) {
153 insert(List);
154 }
155
158
160 : StringMapImpl(static_cast<unsigned>(sizeof(MapEntryTy))),
161 AllocTy(RHS.getAllocator()) {
162 if (RHS.empty())
163 return;
164
165 // Allocate TheTable of the same size as RHS's TheTable, and set the
166 // sentinel appropriately (and NumBuckets).
167 init(RHS.NumBuckets);
168 unsigned *HashTable = (unsigned *)(TheTable + NumBuckets + 1),
169 *RHSHashTable = (unsigned *)(RHS.TheTable + NumBuckets + 1);
170
171 NumItems = RHS.NumItems;
172 NumTombstones = RHS.NumTombstones;
173 for (unsigned I = 0, E = NumBuckets; I != E; ++I) {
174 StringMapEntryBase *Bucket = RHS.TheTable[I];
175 if (!Bucket || Bucket == getTombstoneVal()) {
176 TheTable[I] = Bucket;
177 continue;
178 }
179
181 static_cast<MapEntryTy *>(Bucket)->getKey(), getAllocator(),
182 static_cast<MapEntryTy *>(Bucket)->getValue());
183 HashTable[I] = RHSHashTable[I];
184 }
185
186 // Note that here we've copied everything from the RHS into this object,
187 // tombstones included. We could, instead, have re-probed for each key to
188 // instantiate this new object without any tombstone buckets. The
189 // assumption here is that items are rarely deleted from most StringMaps,
190 // and so tombstones are rare, so the cost of re-probing for all inputs is
191 // not worthwhile.
192 }
193
196 std::swap(getAllocator(), RHS.getAllocator());
197 return *this;
198 }
199
201 // Delete all the elements in the map, but don't reset the elements
202 // to default values. This is a copy of clear(), but avoids unnecessary
203 // work not required in the destructor.
204 if (!empty()) {
205 for (StringMapEntryBase *Bucket : buckets()) {
206 if (Bucket && Bucket != getTombstoneVal()) {
207 static_cast<MapEntryTy *>(Bucket)->Destroy(getAllocator());
208 }
209 }
210 }
211 }
212
213 using AllocTy::getAllocator;
214
215 using key_type = const char *;
216 using mapped_type = ValueTy;
218 using size_type = size_t;
219
222
223 [[nodiscard]] iterator begin() { return iterator(TheTable, NumBuckets != 0); }
224 [[nodiscard]] iterator end() { return iterator(TheTable + NumBuckets); }
225 [[nodiscard]] const_iterator begin() const {
226 return const_iterator(TheTable, NumBuckets != 0);
227 }
228 [[nodiscard]] const_iterator end() const {
230 }
231
236
237 [[nodiscard]] iterator find(StringRef Key) { return find(Key, hash(Key)); }
238
239 [[nodiscard]] iterator find(StringRef Key, uint32_t FullHashValue) {
240 int Bucket = FindKey(Key, FullHashValue);
241 if (Bucket == -1)
242 return end();
243 return iterator(TheTable + Bucket);
244 }
245
246 [[nodiscard]] const_iterator find(StringRef Key) const {
247 return find(Key, hash(Key));
248 }
249
251 uint32_t FullHashValue) const {
252 int Bucket = FindKey(Key, FullHashValue);
253 if (Bucket == -1)
254 return end();
255 return const_iterator(TheTable + Bucket);
256 }
257
258 /// lookup - Return the entry for the specified key, or a default
259 /// constructed value if no such entry exists.
260 [[nodiscard]] ValueTy lookup(StringRef Key) const {
261 const_iterator Iter = find(Key);
262 if (Iter != end())
263 return Iter->second;
264 return ValueTy();
265 }
266
267 /// at - Return the entry for the specified key, or abort if no such
268 /// entry exists.
269 [[nodiscard]] const ValueTy &at(StringRef Val) const {
270 auto Iter = this->find(Val);
271 assert(Iter != this->end() && "StringMap::at failed due to a missing key");
272 return Iter->second;
273 }
274
275 /// Lookup the ValueTy for the \p Key, or create a default constructed value
276 /// if the key is not in the map.
277 ValueTy &operator[](StringRef Key) { return try_emplace(Key).first->second; }
278
279 /// contains - Return true if the element is in the map, false otherwise.
280 [[nodiscard]] bool contains(StringRef Key) const {
281 return find(Key) != end();
282 }
283
284 /// count - Return 1 if the element is in the map, 0 otherwise.
285 [[nodiscard]] size_type count(StringRef Key) const {
286 return contains(Key) ? 1 : 0;
287 }
288
289 template <typename InputTy>
290 [[nodiscard]] size_type count(const StringMapEntry<InputTy> &MapEntry) const {
291 return count(MapEntry.getKey());
292 }
293
294 /// equal - check whether both of the containers are equal.
295 [[nodiscard]] bool operator==(const StringMap &RHS) const {
296 if (size() != RHS.size())
297 return false;
298
299 for (const auto &KeyValue : *this) {
300 auto FindInRHS = RHS.find(KeyValue.getKey());
301
302 if (FindInRHS == RHS.end())
303 return false;
304
305 if constexpr (!std::is_same_v<ValueTy, std::nullopt_t>) {
306 if (!(KeyValue.getValue() == FindInRHS->getValue()))
307 return false;
308 }
309 }
310
311 return true;
312 }
313
314 [[nodiscard]] bool operator!=(const StringMap &RHS) const {
315 return !(*this == RHS);
316 }
317
318 /// insert - Insert the specified key/value pair into the map. If the key
319 /// already exists in the map, return false and ignore the request, otherwise
320 /// insert it and return true.
321 bool insert(MapEntryTy *KeyValue) {
322 unsigned BucketNo = LookupBucketFor(KeyValue->getKey());
323 StringMapEntryBase *&Bucket = TheTable[BucketNo];
324 if (Bucket && Bucket != getTombstoneVal())
325 return false; // Already exists in map.
326
327 if (Bucket == getTombstoneVal())
329 Bucket = KeyValue;
330 ++NumItems;
332
333 RehashTable();
334 return true;
335 }
336
337 /// insert - Inserts the specified key/value pair into the map if the key
338 /// isn't already in the map. The bool component of the returned pair is true
339 /// if and only if the insertion takes place, and the iterator component of
340 /// the pair points to the element with key equivalent to the key of the pair.
341 std::pair<iterator, bool> insert(std::pair<StringRef, ValueTy> KV) {
342 return try_emplace_with_hash(KV.first, hash(KV.first),
343 std::move(KV.second));
344 }
345
346 std::pair<iterator, bool> insert(std::pair<StringRef, ValueTy> KV,
347 uint32_t FullHashValue) {
348 return try_emplace_with_hash(KV.first, FullHashValue, std::move(KV.second));
349 }
350
351 /// Inserts elements from range [first, last). If multiple elements in the
352 /// range have keys that compare equivalent, it is unspecified which element
353 /// is inserted .
354 template <typename InputIt> void insert(InputIt First, InputIt Last) {
355 for (InputIt It = First; It != Last; ++It)
356 insert(*It);
357 }
358
359 /// Inserts elements from initializer list ilist. If multiple elements in
360 /// the range have keys that compare equivalent, it is unspecified which
361 /// element is inserted
362 void insert(std::initializer_list<std::pair<StringRef, ValueTy>> List) {
363 insert(List.begin(), List.end());
364 }
365
366 /// Inserts an element or assigns to the current element if the key already
367 /// exists. The return type is the same as try_emplace.
368 template <typename V>
369 std::pair<iterator, bool> insert_or_assign(StringRef Key, V &&Val) {
370 auto Ret = try_emplace(Key, std::forward<V>(Val));
371 if (!Ret.second)
372 Ret.first->second = std::forward<V>(Val);
373 return Ret;
374 }
375
376 /// Emplace a new element for the specified key into the map if the key isn't
377 /// already in the map. The bool component of the returned pair is true
378 /// if and only if the insertion takes place, and the iterator component of
379 /// the pair points to the element with key equivalent to the key of the pair.
380 template <typename... ArgsTy>
381 std::pair<iterator, bool> try_emplace(StringRef Key, ArgsTy &&...Args) {
382 return try_emplace_with_hash(Key, hash(Key), std::forward<ArgsTy>(Args)...);
383 }
384
385 template <typename... ArgsTy>
386 std::pair<iterator, bool> try_emplace_with_hash(StringRef Key,
387 uint32_t FullHashValue,
388 ArgsTy &&...Args) {
389 unsigned BucketNo = LookupBucketFor(Key, FullHashValue);
390 StringMapEntryBase *&Bucket = TheTable[BucketNo];
391 if (Bucket && Bucket != getTombstoneVal())
392 return {iterator(TheTable + BucketNo), false}; // Already exists in map.
393
394 if (Bucket == getTombstoneVal())
396 Bucket =
397 MapEntryTy::create(Key, getAllocator(), std::forward<ArgsTy>(Args)...);
398 ++NumItems;
400
401 BucketNo = RehashTable(BucketNo);
402 return {iterator(TheTable + BucketNo), true};
403 }
404
405 // clear - Empties out the StringMap
406 void clear() {
407 if (empty())
408 return;
409
410 // Zap all values, resetting the keys back to non-present (not tombstone),
411 // which is safe because we're removing all elements.
412 for (StringMapEntryBase *&Bucket : buckets()) {
413 if (Bucket && Bucket != getTombstoneVal()) {
414 static_cast<MapEntryTy *>(Bucket)->Destroy(getAllocator());
415 }
416 Bucket = nullptr;
417 }
418
419 NumItems = 0;
420 NumTombstones = 0;
421 }
422
423 /// remove - Remove the specified key/value pair from the map, but do not
424 /// erase it. This aborts if the key is not in the map.
425 void remove(MapEntryTy *KeyValue) { RemoveKey(KeyValue); }
426
428 MapEntryTy &V = *I;
429 remove(&V);
430 V.Destroy(getAllocator());
431 }
432
434 iterator I = find(Key);
435 if (I == end())
436 return false;
437 erase(I);
438 return true;
439 }
440};
441
442template <typename ValueTy, bool IsConst> class StringMapIterBase {
443 StringMapEntryBase **Ptr = nullptr;
444
445public:
446 using iterator_category = std::forward_iterator_tag;
448 using difference_type = std::ptrdiff_t;
449 using pointer = std::conditional_t<IsConst, const value_type *, value_type *>;
450 using reference =
451 std::conditional_t<IsConst, const value_type &, value_type &>;
452
453 StringMapIterBase() = default;
454
455 explicit StringMapIterBase(StringMapEntryBase **Bucket, bool Advance = false)
456 : Ptr(Bucket) {
457 if (Advance)
458 AdvancePastEmptyBuckets();
459 }
460
461 [[nodiscard]] reference operator*() const {
462 return *static_cast<value_type *>(*Ptr);
463 }
464 [[nodiscard]] pointer operator->() const {
465 return static_cast<value_type *>(*Ptr);
466 }
467
468 StringMapIterBase &operator++() { // Preincrement
469 ++Ptr;
470 AdvancePastEmptyBuckets();
471 return *this;
472 }
473
474 StringMapIterBase operator++(int) { // Post-increment
475 StringMapIterBase Tmp(*this);
476 ++*this;
477 return Tmp;
478 }
479
480 template <bool ToConst,
481 typename = typename std::enable_if<!IsConst && ToConst>::type>
485
486 friend bool operator==(const StringMapIterBase &LHS,
487 const StringMapIterBase &RHS) {
488 return LHS.Ptr == RHS.Ptr;
489 }
490
491 friend bool operator!=(const StringMapIterBase &LHS,
492 const StringMapIterBase &RHS) {
493 return !(LHS == RHS);
494 }
495
496private:
497 void AdvancePastEmptyBuckets() {
498 while (*Ptr == nullptr || *Ptr == StringMapImpl::getTombstoneVal())
499 ++Ptr;
500 }
501};
502
503template <typename ValueTy>
505 : public iterator_adaptor_base<StringMapKeyIterator<ValueTy>,
506 StringMapIterBase<ValueTy, true>,
507 std::forward_iterator_tag, StringRef> {
510 std::forward_iterator_tag, StringRef>;
511
512public:
515 : base(std::move(Iter)) {}
516
517 StringRef operator*() const { return this->wrapped()->getKey(); }
518};
519
520} // end namespace llvm
521
522#endif // LLVM_ADT_STRINGMAP_H
for(const MachineOperand &MO :llvm::drop_begin(OldMI.operands(), Desc.getNumOperands()))
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file defines the StringMapEntry class - it is intended to be a low dependency implementation det...
This file defines MallocAllocator.
#define LLVM_ALLOCATORHOLDER_EMPTYBASE
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
#define LLVM_ABI
Definition Compiler.h:213
#define I(x, y, z)
Definition MD5.cpp:58
static bool contains(SmallPtrSetImpl< ConstantExpr * > &Cache, ConstantExpr *Expr, Constant *C)
Definition Value.cpp:480
static const BasicSubtargetSubTypeKV * find(StringRef S, ArrayRef< BasicSubtargetSubTypeKV > A)
Find KV in array using binary search.
Value * RHS
Value * LHS
StringMapEntryBase - Shared base class of StringMapEntry instances.
StringMapEntry - This is used to represent one value that is inserted into a StringMap.
static StringMapEntry * create(StringRef key, AllocatorTy &allocator, InitTy &&...initVals)
StringRef getKey() const
iterator_range< StringMapEntryBase ** > buckets()
Definition StringMap.h:92
void swap(StringMapImpl &Other)
Definition StringMap.h:118
static StringMapEntryBase * getTombstoneVal()
Definition StringMap.h:101
unsigned LookupBucketFor(StringRef Key)
LookupBucketFor - Look up the bucket that the specified string should end up in.
Definition StringMap.h:65
LLVM_ABI unsigned RehashTable(unsigned BucketNo=0)
RehashTable - Grow the table, redistributing values into the buckets with the appropriate mod-of-hash...
LLVM_ABI void RemoveKey(StringMapEntryBase *V)
RemoveKey - Remove the specified StringMapEntry from the table, but do not delete it.
StringMapEntryBase ** TheTable
Definition StringMap.h:38
unsigned getNumBuckets() const
Definition StringMap.h:105
unsigned size() const
Definition StringMap.h:109
StringMapImpl(unsigned itemSize)
Definition StringMap.h:45
LLVM_ABI void init(unsigned Size)
Allocate the table with the specified number of buckets and otherwise setup the map as empty.
Definition StringMap.cpp:59
static LLVM_ABI uint32_t hash(StringRef Key)
Returns the hash value that will be used for the given string.
Definition StringMap.cpp:46
unsigned getNumItems() const
Definition StringMap.h:106
unsigned NumBuckets
Definition StringMap.h:39
static constexpr uintptr_t TombstoneIntVal
Definition StringMap.h:97
unsigned NumTombstones
Definition StringMap.h:41
int FindKey(StringRef Key) const
FindKey - Look up the bucket that contains the specified key.
Definition StringMap.h:75
bool empty() const
Definition StringMap.h:108
StringMapImpl(StringMapImpl &&RHS)
Definition StringMap.h:46
std::forward_iterator_tag iterator_category
Definition StringMap.h:446
StringMapIterBase & operator++()
Definition StringMap.h:468
pointer operator->() const
Definition StringMap.h:464
StringMapIterBase(StringMapEntryBase **Bucket, bool Advance=false)
Definition StringMap.h:455
StringMapEntry< ValueTy > value_type
Definition StringMap.h:447
StringMapIterBase operator++(int)
Definition StringMap.h:474
reference operator*() const
Definition StringMap.h:461
std::conditional_t< IsConst, const value_type *, value_type * > pointer
Definition StringMap.h:449
friend bool operator==(const StringMapIterBase &LHS, const StringMapIterBase &RHS)
Definition StringMap.h:486
friend bool operator!=(const StringMapIterBase &LHS, const StringMapIterBase &RHS)
Definition StringMap.h:491
std::conditional_t< IsConst, const value_type &, value_type & > reference
Definition StringMap.h:450
StringRef operator*() const
Definition StringMap.h:517
StringMapKeyIterator(StringMapIterBase< ValueTy, true > Iter)
Definition StringMap.h:514
size_type count(const StringMapEntry< InputTy > &MapEntry) const
Definition StringMap.h:290
StringMap(StringMap &&RHS)
Definition StringMap.h:156
bool erase(StringRef Key)
Definition StringMap.h:433
iterator end()
Definition StringMap.h:224
StringMap(std::initializer_list< std::pair< StringRef, ValueTy > > List)
Definition StringMap.h:151
bool operator!=(const StringMap &RHS) const
Definition StringMap.h:314
iterator begin()
Definition StringMap.h:223
void remove(MapEntryTy *KeyValue)
remove - Remove the specified key/value pair from the map, but do not erase it.
Definition StringMap.h:425
std::pair< iterator, bool > insert_or_assign(StringRef Key, V &&Val)
Inserts an element or assigns to the current element if the key already exists.
Definition StringMap.h:369
iterator find(StringRef Key)
Definition StringMap.h:237
const_iterator end() const
Definition StringMap.h:228
StringMap(const StringMap &RHS)
Definition StringMap.h:159
const ValueTy & at(StringRef Val) const
at - Return the entry for the specified key, or abort if no such entry exists.
Definition StringMap.h:269
bool contains(StringRef Key) const
contains - Return true if the element is in the map, false otherwise.
Definition StringMap.h:280
StringMapIterBase< ValueTy, false > iterator
Definition StringMap.h:221
ValueTy mapped_type
Definition StringMap.h:216
const char * key_type
Definition StringMap.h:215
iterator find(StringRef Key, uint32_t FullHashValue)
Definition StringMap.h:239
std::pair< iterator, bool > insert(std::pair< StringRef, ValueTy > KV)
insert - Inserts the specified key/value pair into the map if the key isn't already in the map.
Definition StringMap.h:341
iterator_range< StringMapKeyIterator< ValueTy > > keys() const
Definition StringMap.h:232
const_iterator find(StringRef Key) const
Definition StringMap.h:246
size_type count(StringRef Key) const
count - Return 1 if the element is in the map, 0 otherwise.
Definition StringMap.h:285
StringMap(AllocatorTy A)
Definition StringMap.h:144
StringMap & operator=(StringMap RHS)
Definition StringMap.h:194
void insert(InputIt First, InputIt Last)
Inserts elements from range [first, last).
Definition StringMap.h:354
ValueTy lookup(StringRef Key) const
lookup - Return the entry for the specified key, or a default constructed value if no such entry exis...
Definition StringMap.h:260
StringMapEntry< ValueTy > value_type
Definition StringMap.h:217
const_iterator find(StringRef Key, uint32_t FullHashValue) const
Definition StringMap.h:250
StringMapIterBase< ValueTy, true > const_iterator
Definition StringMap.h:220
const_iterator begin() const
Definition StringMap.h:225
std::pair< iterator, bool > try_emplace_with_hash(StringRef Key, uint32_t FullHashValue, ArgsTy &&...Args)
Definition StringMap.h:386
void erase(iterator I)
Definition StringMap.h:427
StringMap(unsigned InitialSize)
Definition StringMap.h:141
std::pair< iterator, bool > try_emplace(StringRef Key, ArgsTy &&...Args)
Definition StringMap.h:381
std::pair< iterator, bool > insert(std::pair< StringRef, ValueTy > KV, uint32_t FullHashValue)
Definition StringMap.h:346
StringMap(unsigned InitialSize, AllocatorTy A)
Definition StringMap.h:147
ValueTy & operator[](StringRef Key)
Lookup the ValueTy for the Key, or create a default constructed value if the key is not in the map.
Definition StringMap.h:277
bool operator==(const StringMap &RHS) const
equal - check whether both of the containers are equal.
Definition StringMap.h:295
StringMapEntry< ValueTy > MapEntryTy
Definition StringMap.h:137
void insert(std::initializer_list< std::pair< StringRef, ValueTy > > List)
Inserts elements from initializer list ilist.
Definition StringMap.h:362
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
A range adaptor for a pair of iterators.
This is an optimization pass for GlobalISel generic memory operations.
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
LLVM_ATTRIBUTE_VISIBILITY_DEFAULT AnalysisKey InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key
@ Other
Any other memory.
Definition ModRef.h:68
@ First
Helpers to iterate all locations in the MemoryEffectsBase class.
Definition ModRef.h:71
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition STLExtras.h:1847
Implement std::hash so that hash_code can be used in STL containers.
Definition BitVector.h:870
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
Definition BitVector.h:872
A traits type that is used to handle pointer types and things that are just wrappers for pointers as ...