Go to the documentation of this file.
14 #ifndef LLVM_ADT_STRINGMAP_H
15 #define LLVM_ADT_STRINGMAP_H
21 #include <initializer_list>
49 RHS.TheTable =
nullptr;
52 RHS.NumTombstones = 0;
80 void init(
unsigned Size);
84 static_cast<uintptr_t
>(-1)
109 template <
typename ValueTy,
typename AllocatorTy = MallocAllocator>
111 AllocatorTy Allocator;
129 StringMap(std::initializer_list<std::pair<StringRef, ValueTy>> List)
160 static_cast<MapEntryTy *
>(Bucket)->getValue());
161 HashTable[
I] = RHSHashTable[
I];
248 template <
typename InputTy>
258 for (
const auto &KeyValue : *
this) {
259 auto FindInRHS =
RHS.find(KeyValue.getKey());
261 if (FindInRHS ==
RHS.end())
264 if (!(KeyValue.getValue() == FindInRHS->getValue()))
296 std::pair<iterator, bool>
insert(std::pair<StringRef, ValueTy> KV) {
303 template <
typename InputIt>
void insert(InputIt First, InputIt Last) {
304 for (InputIt It =
First; It != Last; ++It)
311 void insert(std::initializer_list<std::pair<StringRef, ValueTy>> List) {
317 template <
typename V>
321 Ret.first->second = std::forward<V>(Val);
329 template <
typename... ArgsTy>
385 template <
typename DerivedTy,
typename ValueTy>
396 bool NoAdvance =
false)
399 AdvancePastEmptyBuckets();
404 return static_cast<DerivedTy &
>(*this);
408 return LHS.Ptr ==
RHS.Ptr;
413 AdvancePastEmptyBuckets();
414 return static_cast<DerivedTy &
>(*this);
424 void AdvancePastEmptyBuckets() {
430 template <
typename ValueTy>
431 class StringMapConstIterator
432 :
public StringMapIterBase<StringMapConstIterator<ValueTy>,
433 const StringMapEntry<ValueTy>> {
434 using base = StringMapIterBase<StringMapConstIterator<ValueTy>,
435 const StringMapEntry<ValueTy>>;
440 bool NoAdvance =
false)
441 :
base(Bucket, NoAdvance) {}
448 template <
typename ValueTy>
449 class StringMapIterator :
public StringMapIterBase<StringMapIterator<ValueTy>,
450 StringMapEntry<ValueTy>> {
452 StringMapIterBase<StringMapIterator<ValueTy>, StringMapEntry<ValueTy>>;
457 bool NoAdvance =
false)
458 :
base(Bucket, NoAdvance) {}
469 template <
typename ValueTy>
470 class StringMapKeyIterator
471 :
public iterator_adaptor_base<StringMapKeyIterator<ValueTy>,
472 StringMapConstIterator<ValueTy>,
473 std::forward_iterator_tag, StringRef> {
474 using base = iterator_adaptor_base<StringMapKeyIterator<ValueTy>,
475 StringMapConstIterator<ValueTy>,
476 std::forward_iterator_tag, StringRef>;
488 #endif // LLVM_ADT_STRINGMAP_H
static constexpr uintptr_t TombstoneIntVal
unsigned RehashTable(unsigned BucketNo=0)
RehashTable - Grow the table, redistributing values into the buckets with the appropriate mod-of-hash...
StringMapIterator()=default
This is an optimization pass for GlobalISel generic memory operations.
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
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
StringMapEntry - This is used to represent one value that is inserted into a StringMap.
static StringMapEntry * Create(StringRef key, AllocatorTy &allocator, InitTy &&... initVals)
Create a StringMapEntry for the specified key construct the value using InitiVals.
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.
StringMapImpl - This is the base class of StringMap that is shared among all of its instantiations.
StringMapEntryBase ** Ptr
void remove(MapEntryTy *KeyValue)
remove - Remove the specified key/value pair from the map, but do not erase it.
const AllocatorTy & getAllocator() const
const StringMapEntry< ValueTy > & operator*() const
StringMapImpl(StringMapImpl &&RHS)
CRTP base class for adapting an iterator to a different type.
StringMapIterBase()=default
iterator find(StringRef Key)
StringMap & operator=(StringMap RHS)
StringMapConstIterator()=default
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
StringMapEntryBase - Shared base class of StringMapEntry instances.
StringMapIterator< ValueTy > iterator
ValueTy & operator[](StringRef Key)
Lookup the ValueTy for the Key, or create a default constructed value if the key is not in the map.
bool erase(StringRef Key)
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
bool operator!=(const StringMap &RHS) const
bool insert(MapEntryTy *KeyValue)
insert - Insert the specified key/value pair into the map.
const_iterator find(StringRef Key) const
StringMapEntryBase ** TheTable
into llvm powi allowing the code generator to produce balanced multiplication trees First
unsigned getNumItems() const
int FindKey(StringRef Key) const
FindKey - Look up the bucket that contains the specified key.
static StringMapEntryBase * getTombstoneVal()
const_iterator begin() const
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
friend bool operator==(const DerivedTy &LHS, const DerivedTy &RHS)
void init(unsigned Size)
Allocate the table with the specified number of buckets and otherwise setup the map as empty.
void insert(std::initializer_list< std::pair< StringRef, ValueTy >> List)
Inserts elements from initializer list ilist.
StringMapIterator(StringMapEntryBase **Bucket, bool NoAdvance=false)
StringRef operator*() const
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.
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
ValueTy lookup(StringRef Key) const
lookup - Return the entry for the specified key, or a default constructed value if no such entry exis...
CRTP base class which implements the entire standard iterator facade in terms of a minimal subset of ...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
void Destroy(AllocatorTy &allocator)
Destroy - Destroy this StringMapEntry, releasing memory back to the specified allocator.
AllocatorTy & getAllocator()
DerivedTy operator++(int)
StringMapKeyIterator()=default
void insert(InputIt First, InputIt Last)
Inserts elements from range [first, last).
unsigned LookupBucketFor(StringRef Key)
LookupBucketFor - Look up the bucket that the specified string should end up in.
StringRef - Represent a constant reference to a string, i.e.
void swap(StringMapImpl &Other)
StringMapKeyIterator(StringMapConstIterator< ValueTy > Iter)
StringMapConstIterator(StringMapEntryBase **Bucket, bool NoAdvance=false)
iterator_range< StringMapKeyIterator< ValueTy > > keys() const
StringMapImpl(unsigned itemSize)
StringMap(const StringMap &RHS)
const_iterator end() const
size_type count(StringRef Key) const
count - Return 1 if the element is in the map, 0 otherwise.
DerivedTy & operator=(const DerivedTy &Other)
A traits type that is used to handle pointer types and things that are just wrappers for pointers as ...
StringMapIterBase(StringMapEntryBase **Bucket, bool NoAdvance=false)
StringMap(StringMap &&RHS)
void RemoveKey(StringMapEntryBase *V)
RemoveKey - Remove the specified StringMapEntry from the table, but do not delete it.
A range adaptor for a pair of iterators.
bool operator==(const StringMap &RHS) const
equal - check whether both of the containers are equal.
size_type count(const StringMapEntry< InputTy > &MapEntry) const
StringMapEntry< ValueTy > & operator*() const
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
StringMap(std::initializer_list< std::pair< StringRef, ValueTy >> List)
StringMapConstIterator< ValueTy > const_iterator
StringMap(unsigned InitialSize)
StringMap(unsigned InitialSize, AllocatorTy A)
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.
unsigned getNumBuckets() const
Optional< std::vector< StOtherPiece > > Other