LLVM  14.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 // This file defines the StringMap class.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_ADT_STRINGMAP_H
14 #define LLVM_ADT_STRINGMAP_H
15 
19 #include <initializer_list>
20 #include <iterator>
21 
22 namespace llvm {
23 
24 template <typename ValueTy> class StringMapConstIterator;
25 template <typename ValueTy> class StringMapIterator;
26 template <typename ValueTy> class StringMapKeyIterator;
27 
28 /// StringMapImpl - This is the base class of StringMap that is shared among
29 /// all of its instantiations.
31 protected:
32  // Array of NumBuckets pointers to entries, null pointers are holes.
33  // TheTable[NumBuckets] contains a sentinel value for easy iteration. Followed
34  // by an array of the actual hash values as unsigned integers.
36  unsigned NumBuckets = 0;
37  unsigned NumItems = 0;
38  unsigned NumTombstones = 0;
39  unsigned ItemSize;
40 
41 protected:
42  explicit StringMapImpl(unsigned itemSize) : ItemSize(itemSize) {}
46  ItemSize(RHS.ItemSize) {
47  RHS.TheTable = nullptr;
48  RHS.NumBuckets = 0;
49  RHS.NumItems = 0;
50  RHS.NumTombstones = 0;
51  }
52 
53  StringMapImpl(unsigned InitSize, unsigned ItemSize);
54  unsigned RehashTable(unsigned BucketNo = 0);
55 
56  /// LookupBucketFor - Look up the bucket that the specified string should end
57  /// up in. If it already exists as a key in the map, the Item pointer for the
58  /// specified bucket will be non-null. Otherwise, it will be null. In either
59  /// case, the FullHashValue field of the bucket will be set to the hash value
60  /// of the string.
61  unsigned LookupBucketFor(StringRef Key);
62 
63  /// FindKey - Look up the bucket that contains the specified key. If it exists
64  /// in the map, return the bucket number of the key. Otherwise return -1.
65  /// This does not modify the map.
66  int FindKey(StringRef Key) const;
67 
68  /// RemoveKey - Remove the specified StringMapEntry from the table, but do not
69  /// delete it. This aborts if the value isn't in the table.
71 
72  /// RemoveKey - Remove the StringMapEntry for the specified key from the
73  /// table, returning it. If the key is not in the table, this returns null.
75 
76  /// Allocate the table with the specified number of buckets and otherwise
77  /// setup the map as empty.
78  void init(unsigned Size);
79 
80 public:
81  static constexpr uintptr_t TombstoneIntVal =
82  static_cast<uintptr_t>(-1)
84 
86  return reinterpret_cast<StringMapEntryBase *>(TombstoneIntVal);
87  }
88 
89  unsigned getNumBuckets() const { return NumBuckets; }
90  unsigned getNumItems() const { return NumItems; }
91 
92  bool empty() const { return NumItems == 0; }
93  unsigned size() const { return NumItems; }
94 
95  void swap(StringMapImpl &Other) {
96  std::swap(TheTable, Other.TheTable);
97  std::swap(NumBuckets, Other.NumBuckets);
98  std::swap(NumItems, Other.NumItems);
99  std::swap(NumTombstones, Other.NumTombstones);
100  }
101 };
102 
103 /// StringMap - This is an unconventional map that is specialized for handling
104 /// keys that are "strings", which are basically ranges of bytes. This does some
105 /// funky memory allocation and hashing things to make it extremely efficient,
106 /// storing the string data *after* the value in the map.
107 template <typename ValueTy, typename AllocatorTy = MallocAllocator>
108 class StringMap : public StringMapImpl {
109  AllocatorTy Allocator;
110 
111 public:
113 
114  StringMap() : StringMapImpl(static_cast<unsigned>(sizeof(MapEntryTy))) {}
115 
116  explicit StringMap(unsigned InitialSize)
117  : StringMapImpl(InitialSize, static_cast<unsigned>(sizeof(MapEntryTy))) {}
118 
119  explicit StringMap(AllocatorTy A)
120  : StringMapImpl(static_cast<unsigned>(sizeof(MapEntryTy))), Allocator(A) {
121  }
122 
123  StringMap(unsigned InitialSize, AllocatorTy A)
124  : StringMapImpl(InitialSize, static_cast<unsigned>(sizeof(MapEntryTy))),
125  Allocator(A) {}
126 
127  StringMap(std::initializer_list<std::pair<StringRef, ValueTy>> List)
128  : StringMapImpl(List.size(), static_cast<unsigned>(sizeof(MapEntryTy))) {
129  insert(List);
130  }
131 
133  : StringMapImpl(std::move(RHS)), Allocator(std::move(RHS.Allocator)) {}
134 
135  StringMap(const StringMap &RHS)
136  : StringMapImpl(static_cast<unsigned>(sizeof(MapEntryTy))),
137  Allocator(RHS.Allocator) {
138  if (RHS.empty())
139  return;
140 
141  // Allocate TheTable of the same size as RHS's TheTable, and set the
142  // sentinel appropriately (and NumBuckets).
143  init(RHS.NumBuckets);
144  unsigned *HashTable = (unsigned *)(TheTable + NumBuckets + 1),
145  *RHSHashTable = (unsigned *)(RHS.TheTable + NumBuckets + 1);
146 
147  NumItems = RHS.NumItems;
149  for (unsigned I = 0, E = NumBuckets; I != E; ++I) {
150  StringMapEntryBase *Bucket = RHS.TheTable[I];
151  if (!Bucket || Bucket == getTombstoneVal()) {
152  TheTable[I] = Bucket;
153  continue;
154  }
155 
157  static_cast<MapEntryTy *>(Bucket)->getKey(), Allocator,
158  static_cast<MapEntryTy *>(Bucket)->getValue());
159  HashTable[I] = RHSHashTable[I];
160  }
161 
162  // Note that here we've copied everything from the RHS into this object,
163  // tombstones included. We could, instead, have re-probed for each key to
164  // instantiate this new object without any tombstone buckets. The
165  // assumption here is that items are rarely deleted from most StringMaps,
166  // and so tombstones are rare, so the cost of re-probing for all inputs is
167  // not worthwhile.
168  }
169 
171  StringMapImpl::swap(RHS);
172  std::swap(Allocator, RHS.Allocator);
173  return *this;
174  }
175 
177  // Delete all the elements in the map, but don't reset the elements
178  // to default values. This is a copy of clear(), but avoids unnecessary
179  // work not required in the destructor.
180  if (!empty()) {
181  for (unsigned I = 0, E = NumBuckets; I != E; ++I) {
182  StringMapEntryBase *Bucket = TheTable[I];
183  if (Bucket && Bucket != getTombstoneVal()) {
184  static_cast<MapEntryTy *>(Bucket)->Destroy(Allocator);
185  }
186  }
187  }
188  free(TheTable);
189  }
190 
191  AllocatorTy &getAllocator() { return Allocator; }
192  const AllocatorTy &getAllocator() const { return Allocator; }
193 
194  using key_type = const char *;
195  using mapped_type = ValueTy;
197  using size_type = size_t;
198 
201 
203  iterator end() { return iterator(TheTable + NumBuckets, true); }
205  return const_iterator(TheTable, NumBuckets == 0);
206  }
207  const_iterator end() const {
208  return const_iterator(TheTable + NumBuckets, true);
209  }
210 
214  }
215 
217  int Bucket = FindKey(Key);
218  if (Bucket == -1)
219  return end();
220  return iterator(TheTable + Bucket, true);
221  }
222 
224  int Bucket = FindKey(Key);
225  if (Bucket == -1)
226  return end();
227  return const_iterator(TheTable + Bucket, true);
228  }
229 
230  /// lookup - Return the entry for the specified key, or a default
231  /// constructed value if no such entry exists.
232  ValueTy lookup(StringRef Key) const {
234  if (it != end())
235  return it->second;
236  return ValueTy();
237  }
238 
239  /// Lookup the ValueTy for the \p Key, or create a default constructed value
240  /// if the key is not in the map.
241  ValueTy &operator[](StringRef Key) { return try_emplace(Key).first->second; }
242 
243  /// count - Return 1 if the element is in the map, 0 otherwise.
244  size_type count(StringRef Key) const { return find(Key) == end() ? 0 : 1; }
245 
246  template <typename InputTy>
247  size_type count(const StringMapEntry<InputTy> &MapEntry) const {
248  return count(MapEntry.getKey());
249  }
250 
251  /// equal - check whether both of the containers are equal.
252  bool operator==(const StringMap &RHS) const {
253  if (size() != RHS.size())
254  return false;
255 
256  for (const auto &KeyValue : *this) {
257  auto FindInRHS = RHS.find(KeyValue.getKey());
258 
259  if (FindInRHS == RHS.end())
260  return false;
261 
262  if (!(KeyValue.getValue() == FindInRHS->getValue()))
263  return false;
264  }
265 
266  return true;
267  }
268 
269  bool operator!=(const StringMap &RHS) const { return !(*this == RHS); }
270 
271  /// insert - Insert the specified key/value pair into the map. If the key
272  /// already exists in the map, return false and ignore the request, otherwise
273  /// insert it and return true.
274  bool insert(MapEntryTy *KeyValue) {
275  unsigned BucketNo = LookupBucketFor(KeyValue->getKey());
276  StringMapEntryBase *&Bucket = TheTable[BucketNo];
277  if (Bucket && Bucket != getTombstoneVal())
278  return false; // Already exists in map.
279 
280  if (Bucket == getTombstoneVal())
281  --NumTombstones;
282  Bucket = KeyValue;
283  ++NumItems;
285 
286  RehashTable();
287  return true;
288  }
289 
290  /// insert - Inserts the specified key/value pair into the map if the key
291  /// isn't already in the map. The bool component of the returned pair is true
292  /// if and only if the insertion takes place, and the iterator component of
293  /// the pair points to the element with key equivalent to the key of the pair.
294  std::pair<iterator, bool> insert(std::pair<StringRef, ValueTy> KV) {
295  return try_emplace(KV.first, std::move(KV.second));
296  }
297 
298  /// Inserts elements from range [first, last). If multiple elements in the
299  /// range have keys that compare equivalent, it is unspecified which element
300  /// is inserted .
301  template <typename InputIt> void insert(InputIt First, InputIt Last) {
302  for (InputIt It = First; It != Last; ++It)
303  insert(*It);
304  }
305 
306  /// Inserts elements from initializer list ilist. If multiple elements in
307  /// the range have keys that compare equivalent, it is unspecified which
308  /// element is inserted
309  void insert(std::initializer_list<std::pair<StringRef, ValueTy>> List) {
310  insert(List.begin(), List.end());
311  }
312 
313  /// Inserts an element or assigns to the current element if the key already
314  /// exists. The return type is the same as try_emplace.
315  template <typename V>
316  std::pair<iterator, bool> insert_or_assign(StringRef Key, V &&Val) {
317  auto Ret = try_emplace(Key, std::forward<V>(Val));
318  if (!Ret.second)
319  Ret.first->second = std::forward<V>(Val);
320  return Ret;
321  }
322 
323  /// Emplace a new element for the specified key into the map if the key isn't
324  /// already in the map. The bool component of the returned pair is true
325  /// if and only if the insertion takes place, and the iterator component of
326  /// the pair points to the element with key equivalent to the key of the pair.
327  template <typename... ArgsTy>
328  std::pair<iterator, bool> try_emplace(StringRef Key, ArgsTy &&... Args) {
329  unsigned BucketNo = LookupBucketFor(Key);
330  StringMapEntryBase *&Bucket = TheTable[BucketNo];
331  if (Bucket && Bucket != getTombstoneVal())
332  return std::make_pair(iterator(TheTable + BucketNo, false),
333  false); // Already exists in map.
334 
335  if (Bucket == getTombstoneVal())
336  --NumTombstones;
337  Bucket = MapEntryTy::Create(Key, Allocator, std::forward<ArgsTy>(Args)...);
338  ++NumItems;
340 
341  BucketNo = RehashTable(BucketNo);
342  return std::make_pair(iterator(TheTable + BucketNo, false), true);
343  }
344 
345  // clear - Empties out the StringMap
346  void clear() {
347  if (empty())
348  return;
349 
350  // Zap all values, resetting the keys back to non-present (not tombstone),
351  // which is safe because we're removing all elements.
352  for (unsigned I = 0, E = NumBuckets; I != E; ++I) {
353  StringMapEntryBase *&Bucket = TheTable[I];
354  if (Bucket && Bucket != getTombstoneVal()) {
355  static_cast<MapEntryTy *>(Bucket)->Destroy(Allocator);
356  }
357  Bucket = nullptr;
358  }
359 
360  NumItems = 0;
361  NumTombstones = 0;
362  }
363 
364  /// remove - Remove the specified key/value pair from the map, but do not
365  /// erase it. This aborts if the key is not in the map.
366  void remove(MapEntryTy *KeyValue) { RemoveKey(KeyValue); }
367 
368  void erase(iterator I) {
369  MapEntryTy &V = *I;
370  remove(&V);
371  V.Destroy(Allocator);
372  }
373 
375  iterator I = find(Key);
376  if (I == end())
377  return false;
378  erase(I);
379  return true;
380  }
381 };
382 
383 template <typename DerivedTy, typename ValueTy>
385  : public iterator_facade_base<DerivedTy, std::forward_iterator_tag,
386  ValueTy> {
387 protected:
388  StringMapEntryBase **Ptr = nullptr;
389 
390 public:
391  StringMapIterBase() = default;
392 
394  bool NoAdvance = false)
395  : Ptr(Bucket) {
396  if (!NoAdvance)
397  AdvancePastEmptyBuckets();
398  }
399 
400  DerivedTy &operator=(const DerivedTy &Other) {
401  Ptr = Other.Ptr;
402  return static_cast<DerivedTy &>(*this);
403  }
404 
405  friend bool operator==(const DerivedTy &LHS, const DerivedTy &RHS) {
406  return LHS.Ptr == RHS.Ptr;
407  }
408 
409  DerivedTy &operator++() { // Preincrement
410  ++Ptr;
411  AdvancePastEmptyBuckets();
412  return static_cast<DerivedTy &>(*this);
413  }
414 
415  DerivedTy operator++(int) { // Post-increment
416  DerivedTy Tmp(Ptr);
417  ++*this;
418  return Tmp;
419  }
420 
421 private:
422  void AdvancePastEmptyBuckets() {
423  while (*Ptr == nullptr || *Ptr == StringMapImpl::getTombstoneVal())
424  ++Ptr;
425  }
426 };
427 
428 template <typename ValueTy>
429 class StringMapConstIterator
430  : public StringMapIterBase<StringMapConstIterator<ValueTy>,
431  const StringMapEntry<ValueTy>> {
432  using base = StringMapIterBase<StringMapConstIterator<ValueTy>,
433  const StringMapEntry<ValueTy>>;
434 
435 public:
436  StringMapConstIterator() = default;
438  bool NoAdvance = false)
439  : base(Bucket, NoAdvance) {}
440 
442  return *static_cast<const StringMapEntry<ValueTy> *>(*this->Ptr);
443  }
444 };
445 
446 template <typename ValueTy>
447 class StringMapIterator : public StringMapIterBase<StringMapIterator<ValueTy>,
448  StringMapEntry<ValueTy>> {
449  using base =
450  StringMapIterBase<StringMapIterator<ValueTy>, StringMapEntry<ValueTy>>;
451 
452 public:
453  StringMapIterator() = default;
455  bool NoAdvance = false)
456  : base(Bucket, NoAdvance) {}
457 
459  return *static_cast<StringMapEntry<ValueTy> *>(*this->Ptr);
460  }
461 
463  return StringMapConstIterator<ValueTy>(this->Ptr, true);
464  }
465 };
466 
467 template <typename ValueTy>
468 class StringMapKeyIterator
469  : public iterator_adaptor_base<StringMapKeyIterator<ValueTy>,
470  StringMapConstIterator<ValueTy>,
471  std::forward_iterator_tag, StringRef> {
472  using base = iterator_adaptor_base<StringMapKeyIterator<ValueTy>,
473  StringMapConstIterator<ValueTy>,
474  std::forward_iterator_tag, StringRef>;
475 
476 public:
477  StringMapKeyIterator() = default;
479  : base(std::move(Iter)) {}
480 
481  StringRef operator*() const { return this->wrapped()->getKey(); }
482 };
483 
484 } // end namespace llvm
485 
486 #endif // LLVM_ADT_STRINGMAP_H
llvm::Check::Size
@ Size
Definition: FileCheck.h:73
llvm::StringMapImpl::TombstoneIntVal
static constexpr uintptr_t TombstoneIntVal
Definition: StringMap.h:81
llvm::StringMapImpl::RehashTable
unsigned RehashTable(unsigned BucketNo=0)
RehashTable - Grow the table, redistributing values into the buckets with the appropriate mod-of-hash...
Definition: StringMap.cpp:200
StringMapEntry.h
llvm::StringMapIterator::StringMapIterator
StringMapIterator()=default
llvm
This file implements support for optimizing divisions by a constant.
Definition: AllocatorList.h:23
it
into xmm2 addss xmm2 xmm1 xmm3 addss xmm3 movaps xmm0 unpcklps xmm0 ret seems silly when it could just be one addps Expand libm rounding functions main should enable SSE DAZ mode and other fast SSE modes Think about doing i64 math in SSE regs on x86 This testcase should have no SSE instructions in it
Definition: README-SSE.txt:81
llvm::make_range
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
Definition: iterator_range.h:53
llvm::StringMapEntry
StringMapEntry - This is used to represent one value that is inserted into a StringMap.
Definition: StringMapEntry.h:98
llvm::StringMapEntry::Create
static StringMapEntry * Create(StringRef key, AllocatorTy &allocator, InitTy &&... initVals)
Create a StringMapEntry for the specified key construct the value using InitiVals.
Definition: StringMapEntry.h:120
llvm::StringMap::insert_or_assign
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:316
llvm::StringMapImpl
StringMapImpl - This is the base class of StringMap that is shared among all of its instantiations.
Definition: StringMap.h:30
llvm::StringMapImpl::NumTombstones
unsigned NumTombstones
Definition: StringMap.h:38
llvm::StringMapIterBase::Ptr
StringMapEntryBase ** Ptr
Definition: StringMap.h:388
llvm::StringMap::remove
void remove(MapEntryTy *KeyValue)
remove - Remove the specified key/value pair from the map, but do not erase it.
Definition: StringMap.h:366
llvm::StringMap::getAllocator
const AllocatorTy & getAllocator() const
Definition: StringMap.h:192
llvm::StringMapConstIterator::operator*
const StringMapEntry< ValueTy > & operator*() const
Definition: StringMap.h:441
llvm::StringMap::end
iterator end()
Definition: StringMap.h:203
llvm::StringMapImpl::StringMapImpl
StringMapImpl(StringMapImpl &&RHS)
Definition: StringMap.h:43
llvm::iterator_adaptor_base
CRTP base class for adapting an iterator to a different type.
Definition: iterator.h:229
llvm::StringMapIterBase::StringMapIterBase
StringMapIterBase()=default
llvm::MipsISD::Ret
@ Ret
Definition: MipsISelLowering.h:116
llvm::StringMapImpl::NumBuckets
unsigned NumBuckets
Definition: StringMap.h:36
llvm::StringMap::find
iterator find(StringRef Key)
Definition: StringMap.h:216
llvm::StringMap::operator=
StringMap & operator=(StringMap RHS)
Definition: StringMap.h:170
llvm::StringMapIterBase::operator++
DerivedTy & operator++()
Definition: StringMap.h:409
size_t
llvm::StringMapConstIterator::StringMapConstIterator
StringMapConstIterator()=default
wrapped
is currently compiled esp esp jne LBB1_1 esp ret esp esp jne L_abort $stub esp ret This can be applied to any no return function call that takes no arguments etc the stack save restore logic could be shrink wrapped
Definition: README.txt:412
llvm::StringMapEntryBase
StringMapEntryBase - Shared base class of StringMapEntry instances.
Definition: StringMapEntry.h:23
llvm::StringMap::iterator
StringMapIterator< ValueTy > iterator
Definition: StringMap.h:200
llvm::StringMap::operator[]
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:241
llvm::StringMap::erase
bool erase(StringRef Key)
Definition: StringMap.h:374
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
llvm::StringMap::operator!=
bool operator!=(const StringMap &RHS) const
Definition: StringMap.h:269
llvm::StringMap::insert
bool insert(MapEntryTy *KeyValue)
insert - Insert the specified key/value pair into the map.
Definition: StringMap.h:274
llvm::StringMap::find
const_iterator find(StringRef Key) const
Definition: StringMap.h:223
llvm::StringMapImpl::TheTable
StringMapEntryBase ** TheTable
Definition: StringMap.h:35
llvm::StringMapConstIterator
Definition: StringMap.h:24
llvm::AMDGPU::PALMD::Key
Key
PAL metadata keys.
Definition: AMDGPUMetadata.h:481
First
into llvm powi allowing the code generator to produce balanced multiplication trees First
Definition: README.txt:54
llvm::StringMapImpl::getNumItems
unsigned getNumItems() const
Definition: StringMap.h:90
llvm::StringMap::clear
void clear()
Definition: StringMap.h:346
PointerLikeTypeTraits.h
llvm::StringMapImpl::FindKey
int FindKey(StringRef Key) const
FindKey - Look up the bucket that contains the specified key.
Definition: StringMap.cpp:132
llvm::StringMapImpl::getTombstoneVal
static StringMapEntryBase * getTombstoneVal()
Definition: StringMap.h:85
llvm::StringMap::begin
const_iterator begin() const
Definition: StringMap.h:204
llvm::StringMap< std::unique_ptr< llvm::vfs::detail::InMemoryNode > >::mapped_type
std::unique_ptr< llvm::vfs::detail::InMemoryNode > mapped_type
Definition: StringMap.h:195
AllocatorBase.h
llvm::StringMap
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Definition: StringMap.h:108
llvm::StringMapIterBase::operator==
friend bool operator==(const DerivedTy &LHS, const DerivedTy &RHS)
Definition: StringMap.h:405
llvm::StringMapImpl::init
void init(unsigned Size)
Allocate the table with the specified number of buckets and otherwise setup the map as empty.
Definition: StringMap.cpp:50
llvm::StringMapKeyIterator
Definition: StringMap.h:26
llvm::StringMap::insert
void insert(std::initializer_list< std::pair< StringRef, ValueTy >> List)
Inserts elements from initializer list ilist.
Definition: StringMap.h:309
llvm::StringMap::~StringMap
~StringMap()
Definition: StringMap.h:176
llvm::StringMapIterator::StringMapIterator
StringMapIterator(StringMapEntryBase **Bucket, bool NoAdvance=false)
Definition: StringMap.h:454
llvm::StringMapKeyIterator::operator*
StringRef operator*() const
Definition: StringMap.h:481
llvm::StringMap::insert
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:294
llvm::StringMapIterator
Definition: StringMap.h:25
llvm::StringMap::erase
void erase(iterator I)
Definition: StringMap.h:368
llvm::StringMapImpl::NumItems
unsigned NumItems
Definition: StringMap.h:37
move
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
Definition: README.txt:546
I
#define I(x, y, z)
Definition: MD5.cpp:59
llvm::StringMap::lookup
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:232
llvm::iterator_facade_base
CRTP base class which implements the entire standard iterator facade in terms of a minimal subset of ...
Definition: iterator.h:66
llvm::StringMapEntry::getKey
StringRef getKey() const
Definition: StringMapEntry.h:102
llvm::StringMap::begin
iterator begin()
Definition: StringMap.h:202
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::move
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:1609
std::swap
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
Definition: BitVector.h:840
llvm::StringMapEntry::Destroy
void Destroy(AllocatorTy &allocator)
Destroy - Destroy this StringMapEntry, releasing memory back to the specified allocator.
Definition: StringMapEntry.h:136
llvm::StringMap::getAllocator
AllocatorTy & getAllocator()
Definition: StringMap.h:191
llvm::StringMapIterBase::operator++
DerivedTy operator++(int)
Definition: StringMap.h:415
llvm::StringMapImpl::size
unsigned size() const
Definition: StringMap.h:93
llvm::StringMapKeyIterator::StringMapKeyIterator
StringMapKeyIterator()=default
llvm::StringMap::insert
void insert(InputIt First, InputIt Last)
Inserts elements from range [first, last).
Definition: StringMap.h:301
llvm::StringMapImpl::LookupBucketFor
unsigned LookupBucketFor(StringRef Key)
LookupBucketFor - Look up the bucket that the specified string should end up in.
Definition: StringMap.cpp:74
llvm::StringMap::StringMap
StringMap()
Definition: StringMap.h:114
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::StringMapImpl::swap
void swap(StringMapImpl &Other)
Definition: StringMap.h:95
llvm::StringMap< std::unique_ptr< llvm::vfs::detail::InMemoryNode > >::key_type
const char * key_type
Definition: StringMap.h:194
llvm::StringMapKeyIterator::StringMapKeyIterator
StringMapKeyIterator(StringMapConstIterator< ValueTy > Iter)
Definition: StringMap.h:478
llvm::StringMapConstIterator::StringMapConstIterator
StringMapConstIterator(StringMapEntryBase **Bucket, bool NoAdvance=false)
Definition: StringMap.h:437
llvm::StringMap::keys
iterator_range< StringMapKeyIterator< ValueTy > > keys() const
Definition: StringMap.h:211
std
Definition: BitVector.h:838
llvm::StringMapImpl::StringMapImpl
StringMapImpl(unsigned itemSize)
Definition: StringMap.h:42
llvm::StringMap::StringMap
StringMap(const StringMap &RHS)
Definition: StringMap.h:135
llvm::StringMap::StringMap
StringMap(AllocatorTy A)
Definition: StringMap.h:119
llvm::StringMap::end
const_iterator end() const
Definition: StringMap.h:207
llvm::StringMap::count
size_type count(StringRef Key) const
count - Return 1 if the element is in the map, 0 otherwise.
Definition: StringMap.h:244
llvm::StringMapIterBase
Definition: StringMap.h:384
llvm::StringMapIterBase::operator=
DerivedTy & operator=(const DerivedTy &Other)
Definition: StringMap.h:400
llvm::PointerLikeTypeTraits
A traits type that is used to handle pointer types and things that are just wrappers for pointers as ...
Definition: PointerLikeTypeTraits.h:25
llvm::StringMapIterBase::StringMapIterBase
StringMapIterBase(StringMapEntryBase **Bucket, bool NoAdvance=false)
Definition: StringMap.h:393
llvm::StringMapImpl::empty
bool empty() const
Definition: StringMap.h:92
Allocator
Basic Register Allocator
Definition: RegAllocBasic.cpp:146
List
const NodeList & List
Definition: RDFGraph.cpp:201
llvm::StringMap::StringMap
StringMap(StringMap &&RHS)
Definition: StringMap.h:132
llvm::StringMapImpl::RemoveKey
void RemoveKey(StringMapEntryBase *V)
RemoveKey - Remove the specified StringMapEntry from the table, but do not delete it.
Definition: StringMap.cpp:175
llvm::iterator_range
A range adaptor for a pair of iterators.
Definition: iterator_range.h:30
llvm::StringMap::operator==
bool operator==(const StringMap &RHS) const
equal - check whether both of the containers are equal.
Definition: StringMap.h:252
llvm::StringMap::count
size_type count(const StringMapEntry< InputTy > &MapEntry) const
Definition: StringMap.h:247
llvm::StringMapIterator::operator*
StringMapEntry< ValueTy > & operator*() const
Definition: StringMap.h:458
llvm::AMDGPU::HSAMD::Kernel::Key::Args
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
Definition: AMDGPUMetadata.h:389
llvm::StringMap::StringMap
StringMap(std::initializer_list< std::pair< StringRef, ValueTy >> List)
Definition: StringMap.h:127
llvm::StringMap::const_iterator
StringMapConstIterator< ValueTy > const_iterator
Definition: StringMap.h:199
llvm::StringMap::StringMap
StringMap(unsigned InitialSize)
Definition: StringMap.h:116
llvm::StringMap::StringMap
StringMap(unsigned InitialSize, AllocatorTy A)
Definition: StringMap.h:123
llvm::StringMap::try_emplace
std::pair< iterator, bool > try_emplace(StringRef Key, ArgsTy &&... Args)
Emplace a new element for the specified key into the map if the key isn't already in the map.
Definition: StringMap.h:328
llvm::StringMapImpl::getNumBuckets
unsigned getNumBuckets() const
Definition: StringMap.h:89
Other
Optional< std::vector< StOtherPiece > > Other
Definition: ELFYAML.cpp:1184
llvm::StringMapImpl::ItemSize
unsigned ItemSize
Definition: StringMap.h:39