LLVM 17.0.0git
|
StringMap - This is an unconventional map that is specialized for handling keys that are "strings", which are basically ranges of bytes. More...
#include "llvm/ADT/StringMap.h"
Inherits llvm::StringMapImpl, and llvm::detail::AllocatorHolder< Alloc >.
Inherited by llvm::StringSet< AllocatorTy >.
Public Types | |
using | MapEntryTy = StringMapEntry< ValueTy > |
using | key_type = const char * |
using | mapped_type = ValueTy |
using | value_type = StringMapEntry< ValueTy > |
using | size_type = size_t |
using | const_iterator = StringMapConstIterator< ValueTy > |
using | iterator = StringMapIterator< ValueTy > |
Public Member Functions | |
StringMap () | |
StringMap (unsigned InitialSize) | |
StringMap (AllocatorTy A) | |
StringMap (unsigned InitialSize, AllocatorTy A) | |
StringMap (std::initializer_list< std::pair< StringRef, ValueTy > > List) | |
StringMap (StringMap &&RHS) | |
StringMap (const StringMap &RHS) | |
StringMap & | operator= (StringMap RHS) |
~StringMap () | |
iterator | begin () |
iterator | end () |
const_iterator | begin () const |
const_iterator | end () const |
iterator_range< StringMapKeyIterator< ValueTy > > | keys () const |
iterator | find (StringRef Key) |
const_iterator | find (StringRef Key) const |
ValueTy | lookup (StringRef Key) const |
lookup - Return the entry for the specified key, or a default constructed value if no such entry exists. | |
const ValueTy & | at (StringRef Val) const |
at - Return the entry for the specified key, or abort if no such entry exists. | |
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 | contains (StringRef Key) const |
contains - Return true if the element is in the map, false otherwise. | |
size_type | count (StringRef Key) const |
count - Return 1 if the element is in the map, 0 otherwise. | |
template<typename InputTy > | |
size_type | count (const StringMapEntry< InputTy > &MapEntry) const |
bool | operator== (const StringMap &RHS) const |
equal - check whether both of the containers are equal. | |
bool | operator!= (const StringMap &RHS) const |
bool | insert (MapEntryTy *KeyValue) |
insert - Insert the specified key/value pair into the map. | |
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. | |
template<typename InputIt > | |
void | insert (InputIt First, InputIt Last) |
Inserts elements from range [first, last). | |
void | insert (std::initializer_list< std::pair< StringRef, ValueTy > > List) |
Inserts elements from initializer list ilist. | |
template<typename V > | |
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. | |
template<typename... ArgsTy> | |
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. | |
void | clear () |
void | remove (MapEntryTy *KeyValue) |
remove - Remove the specified key/value pair from the map, but do not erase it. | |
void | erase (iterator I) |
bool | erase (StringRef Key) |
![]() | |
unsigned | getNumBuckets () const |
unsigned | getNumItems () const |
bool | empty () const |
unsigned | size () const |
void | swap (StringMapImpl &Other) |
Additional Inherited Members | |
![]() | |
static StringMapEntryBase * | getTombstoneVal () |
![]() | |
static constexpr uintptr_t | TombstoneIntVal |
![]() | |
StringMapImpl (unsigned itemSize) | |
StringMapImpl (StringMapImpl &&RHS) | |
StringMapImpl (unsigned InitSize, unsigned ItemSize) | |
unsigned | RehashTable (unsigned BucketNo=0) |
RehashTable - Grow the table, redistributing values into the buckets with the appropriate mod-of-hashtable-size. | |
unsigned | LookupBucketFor (StringRef Key) |
LookupBucketFor - Look up the bucket that the specified string should end up in. | |
int | FindKey (StringRef Key) const |
FindKey - Look up the bucket that contains the specified key. | |
void | RemoveKey (StringMapEntryBase *V) |
RemoveKey - Remove the specified StringMapEntry from the table, but do not delete it. | |
StringMapEntryBase * | RemoveKey (StringRef Key) |
RemoveKey - Remove the StringMapEntry for the specified key from the table, returning it. | |
void | init (unsigned Size) |
Allocate the table with the specified number of buckets and otherwise setup the map as empty. | |
![]() | |
StringMapEntryBase ** | TheTable = nullptr |
unsigned | NumBuckets = 0 |
unsigned | NumItems = 0 |
unsigned | NumTombstones = 0 |
unsigned | ItemSize |
StringMap - This is an unconventional map that is specialized for handling keys that are "strings", which are basically ranges of bytes.
This does some funky memory allocation and hashing things to make it extremely efficient, storing the string data after the value in the map.
Definition at line 110 of file StringMap.h.
using llvm::StringMap< ValueTy, AllocatorTy >::const_iterator = StringMapConstIterator<ValueTy> |
Definition at line 200 of file StringMap.h.
using llvm::StringMap< ValueTy, AllocatorTy >::iterator = StringMapIterator<ValueTy> |
Definition at line 201 of file StringMap.h.
using llvm::StringMap< ValueTy, AllocatorTy >::key_type = const char * |
Definition at line 195 of file StringMap.h.
using llvm::StringMap< ValueTy, AllocatorTy >::MapEntryTy = StringMapEntry<ValueTy> |
Definition at line 115 of file StringMap.h.
using llvm::StringMap< ValueTy, AllocatorTy >::mapped_type = ValueTy |
Definition at line 196 of file StringMap.h.
using llvm::StringMap< ValueTy, AllocatorTy >::size_type = size_t |
Definition at line 198 of file StringMap.h.
using llvm::StringMap< ValueTy, AllocatorTy >::value_type = StringMapEntry<ValueTy> |
Definition at line 197 of file StringMap.h.
|
inline |
Definition at line 117 of file StringMap.h.
|
inlineexplicit |
Definition at line 119 of file StringMap.h.
|
inlineexplicit |
Definition at line 122 of file StringMap.h.
|
inline |
Definition at line 125 of file StringMap.h.
|
inline |
Definition at line 129 of file StringMap.h.
References llvm::StringMap< ValueTy, AllocatorTy >::insert(), and llvm::List.
|
inline |
Definition at line 134 of file StringMap.h.
|
inline |
Definition at line 137 of file StringMap.h.
References llvm::StringMapEntry< ValueTy >::create(), E, llvm::detail::AllocatorHolder< Alloc >::getAllocator(), llvm::StringMapImpl::getTombstoneVal(), I, llvm::StringMapImpl::init(), llvm::StringMapImpl::NumBuckets, llvm::StringMapImpl::NumItems, llvm::StringMapImpl::NumTombstones, RHS, and llvm::StringMapImpl::TheTable.
|
inline |
Definition at line 178 of file StringMap.h.
References E, llvm::StringMapImpl::empty(), llvm::detail::AllocatorHolder< Alloc >::getAllocator(), llvm::StringMapImpl::getTombstoneVal(), I, llvm::StringMapImpl::NumBuckets, and llvm::StringMapImpl::TheTable.
|
inline |
at - Return the entry for the specified key, or abort if no such entry exists.
Definition at line 242 of file StringMap.h.
References assert(), llvm::StringMap< ValueTy, AllocatorTy >::end(), and llvm::StringMap< ValueTy, AllocatorTy >::find().
|
inline |
Definition at line 203 of file StringMap.h.
References llvm::StringMapImpl::NumBuckets, and llvm::StringMapImpl::TheTable.
Referenced by llvm::ValueSymbolTable::begin(), llvm::RecordStreamer::begin(), llvm::codeview::DebugStringTableSubsection::begin(), llvm::DCData::begin(), llvm::orc::SymbolStringPool::clearDeadEntries(), llvm::IRComparer< T >::compare(), llvm::computeLTOCacheKey(), llvm::ExecutionEngine::getGlobalValueAtAddress(), llvm::LLVMContext::getMDKindNames(), llvm::StringSet< AllocatorTy >::insert(), llvm::StringMap< ValueTy, AllocatorTy >::keys(), LookupNearestOption(), and sortOpts().
|
inline |
Definition at line 205 of file StringMap.h.
References llvm::StringMapImpl::NumBuckets, and llvm::StringMapImpl::TheTable.
|
inline |
Definition at line 359 of file StringMap.h.
References E, llvm::StringMapImpl::empty(), llvm::detail::AllocatorHolder< Alloc >::getAllocator(), llvm::StringMapImpl::getTombstoneVal(), I, llvm::StringMapImpl::NumBuckets, llvm::StringMapImpl::NumItems, llvm::StringMapImpl::NumTombstones, and llvm::StringMapImpl::TheTable.
Referenced by llvm::ExecutionEngine::clearAllGlobalMappings(), llvm::RuntimeDyldELF::finalizeLoad(), llvm::symbolize::LLVMSymbolizer::flush(), llvm::MCContext::reset(), llvm::LTOCodeGenerator::setModule(), and llvm::PerTargetMIParsingState::setTarget().
|
inline |
contains - Return true if the element is in the map, false otherwise.
Definition at line 253 of file StringMap.h.
References llvm::StringMap< ValueTy, AllocatorTy >::end(), and llvm::StringMap< ValueTy, AllocatorTy >::find().
Referenced by llvm::StringMap< ValueTy, AllocatorTy >::count(), llvm::Logger::hasAnyObservationForContext(), and llvm::SpecialCaseList::parse().
|
inline |
Definition at line 259 of file StringMap.h.
References llvm::StringMap< ValueTy, AllocatorTy >::count(), and llvm::StringMapEntry< ValueTy >::getKey().
|
inline |
count - Return 1 if the element is in the map, 0 otherwise.
Definition at line 256 of file StringMap.h.
References llvm::StringMap< ValueTy, AllocatorTy >::contains().
Referenced by llvm::AArch64Subtarget::AArch64Subtarget(), llvm::jitlink::MachOLinkGraphBuilder::addCustomSectionParser(), llvm::StringMap< ValueTy, AllocatorTy >::count(), llvm::DCData::getSuccessorLabel(), HandlePrefixedOrGroupedOption(), llvm::OffloadEntriesInfoManager::hasDeviceGlobalVarEntryInfo(), llvm::ModuleSummaryIndex::hasExportedFunctions(), llvm::AMDGPU::insertWaveSizeFeature(), llvm::CachedPathResolver::resolve(), and shouldApply().
|
inline |
Definition at line 204 of file StringMap.h.
References llvm::StringMapImpl::NumBuckets, and llvm::StringMapImpl::TheTable.
Referenced by llvm::RuntimeDyldImpl::applyExternalSymbolRelocations(), llvm::StringMap< ValueTy, AllocatorTy >::at(), llvm::orc::SymbolStringPool::clearDeadEntries(), llvm::computeLTOCacheKey(), llvm::StringMap< ValueTy, AllocatorTy >::contains(), llvm::ValueSymbolTable::end(), llvm::RecordStreamer::end(), llvm::codeview::DebugStringTableSubsection::end(), llvm::DCData::end(), llvm::StringMap< ValueTy, AllocatorTy >::erase(), llvm::StringMap< ValueTy, AllocatorTy >::find(), llvm::RecordStreamer::flushSymverDirectives(), llvm::ExecutionEngine::getAddressToGlobalIfAvailable(), llvm::ReplayInlineAdvisor::getAdviceImpl(), llvm::PerTargetMIParsingState::getBitmaskTargetFlag(), llvm::orc::ExecutorProcessControl::getBootstrapMapValue(), llvm::PerTargetMIParsingState::getDirectTargetFlag(), llvm::ExecutionEngine::getGlobalValueAtAddress(), llvm::codeview::DebugStringTableSubsection::getIdForString(), llvm::LLVMContext::getMDKindNames(), llvm::PerTargetMIParsingState::getMMOTargetFlag(), llvm::ModuleSummaryIndex::getModule(), llvm::ModuleSummaryIndex::getModuleHash(), llvm::SlotTracker::getModulePathSlot(), llvm::LLVMContextImpl::getOperandBundleTagID(), getOptionPred(), llvm::PerTargetMIParsingState::getRegBank(), llvm::PerTargetMIParsingState::getRegClass(), llvm::PerTargetMIParsingState::getRegMask(), llvm::RuntimeDyldMachO::getRelocationValueRef(), llvm::pdb::DbiStreamBuilder::getSourceFileNameIndex(), llvm::PerTargetMIParsingState::getSubRegIndex(), llvm::RuntimeDyldImpl::getSymbol(), llvm::RuntimeDyldImpl::getSymbolLocalAddress(), llvm::RuntimeDyldImpl::getSymbolSectionID(), llvm::PerTargetMIParsingState::getTargetIndex(), llvm::SlotTracker::getTypeIdSlot(), llvm::FunctionImporter::importFunctions(), llvm::StringSet< AllocatorTy >::insert(), llvm::StringMap< ValueTy, AllocatorTy >::keys(), llvm::StringMap< ValueTy, AllocatorTy >::lookup(), LookupNearestOption(), llvm::PerTargetMIParsingState::parseInstrName(), llvm::Annotations::pointsWithPayload(), llvm::Annotations::pointWithPayload(), llvm::RuntimeDyldMachOARM::processRelocationRef(), llvm::RuntimeDyldELF::processRelocationRef(), llvm::sampleprof::ProfiledCallGraph::ProfiledCallGraph(), llvm::Annotations::rangesWithPayload(), llvm::Annotations::rangeWithPayload(), llvm::ImportedFunctionsInliningStatistics::recordInline(), llvm::sampleprof::SampleRecord::removeCalledTarget(), llvm::ExecutionEngineState::RemoveMapping(), and sortOpts().
|
inline |
Definition at line 208 of file StringMap.h.
References llvm::StringMapImpl::NumBuckets, and llvm::StringMapImpl::TheTable.
|
inline |
Definition at line 381 of file StringMap.h.
References llvm::detail::AllocatorHolder< Alloc >::getAllocator(), I, and llvm::StringMap< ValueTy, AllocatorTy >::remove().
Referenced by llvm::orc::SymbolStringPool::clearDeadEntries(), llvm::StringMap< ValueTy, AllocatorTy >::erase(), llvm::Module::eraseNamedMetadata(), llvm::sampleprof::SampleRecord::removeCalledTarget(), and llvm::ExecutionEngineState::RemoveMapping().
|
inline |
Definition at line 387 of file StringMap.h.
References llvm::StringMap< ValueTy, AllocatorTy >::end(), llvm::StringMap< ValueTy, AllocatorTy >::erase(), llvm::StringMap< ValueTy, AllocatorTy >::find(), and I.
|
inline |
Definition at line 217 of file StringMap.h.
References llvm::StringMap< ValueTy, AllocatorTy >::end(), llvm::StringMapImpl::FindKey(), and llvm::StringMapImpl::TheTable.
Referenced by llvm::RuntimeDyldImpl::applyExternalSymbolRelocations(), llvm::StringMap< ValueTy, AllocatorTy >::at(), llvm::StringMap< ValueTy, AllocatorTy >::contains(), llvm::StringMap< ValueTy, AllocatorTy >::erase(), llvm::RecordStreamer::flushSymverDirectives(), llvm::ExecutionEngine::getAddressToGlobalIfAvailable(), llvm::ReplayInlineAdvisor::getAdviceImpl(), llvm::PerTargetMIParsingState::getBitmaskTargetFlag(), llvm::orc::ExecutorProcessControl::getBootstrapMapValue(), llvm::PerTargetMIParsingState::getDirectTargetFlag(), llvm::codeview::DebugStringTableSubsection::getIdForString(), llvm::PerTargetMIParsingState::getMMOTargetFlag(), llvm::ModuleSummaryIndex::getModule(), llvm::ModuleSummaryIndex::getModuleHash(), llvm::SlotTracker::getModulePathSlot(), llvm::LLVMContextImpl::getOperandBundleTagID(), getOptionPred(), llvm::PerTargetMIParsingState::getRegBank(), llvm::PerTargetMIParsingState::getRegClass(), llvm::PerTargetMIParsingState::getRegMask(), llvm::RuntimeDyldMachO::getRelocationValueRef(), llvm::pdb::DbiStreamBuilder::getSourceFileNameIndex(), llvm::PerTargetMIParsingState::getSubRegIndex(), llvm::DCData::getSuccessorLabel(), llvm::RuntimeDyldImpl::getSymbol(), llvm::RuntimeDyldImpl::getSymbolLocalAddress(), llvm::RuntimeDyldImpl::getSymbolSectionID(), llvm::PerTargetMIParsingState::getTargetIndex(), llvm::SlotTracker::getTypeIdSlot(), HandlePrefixedOrGroupedOption(), llvm::FunctionImporter::importFunctions(), llvm::StringMap< ValueTy, AllocatorTy >::lookup(), llvm::PerTargetMIParsingState::parseInstrName(), llvm::Annotations::pointsWithPayload(), llvm::Annotations::pointWithPayload(), llvm::RuntimeDyldMachOARM::processRelocationRef(), llvm::RuntimeDyldELF::processRelocationRef(), llvm::sampleprof::ProfiledCallGraph::ProfiledCallGraph(), llvm::Annotations::rangesWithPayload(), llvm::Annotations::rangeWithPayload(), llvm::ImportedFunctionsInliningStatistics::recordInline(), llvm::sampleprof::SampleRecord::removeCalledTarget(), and llvm::ExecutionEngineState::RemoveMapping().
|
inline |
Definition at line 224 of file StringMap.h.
References llvm::StringMap< ValueTy, AllocatorTy >::end(), llvm::StringMapImpl::FindKey(), and llvm::StringMapImpl::TheTable.
|
inline |
Inserts elements from range [first, last).
If multiple elements in the range have keys that compare equivalent, it is unspecified which element is inserted .
Definition at line 313 of file StringMap.h.
References llvm::StringMap< ValueTy, AllocatorTy >::insert(), and llvm::Last.
|
inline |
insert - Insert the specified key/value pair into the map.
If the key already exists in the map, return false and ignore the request, otherwise insert it and return true.
Definition at line 286 of file StringMap.h.
References assert(), llvm::StringMapEntry< ValueTy >::getKey(), llvm::StringMapImpl::getTombstoneVal(), llvm::StringMapImpl::LookupBucketFor(), llvm::StringMapImpl::NumBuckets, llvm::StringMapImpl::NumItems, llvm::StringMapImpl::NumTombstones, llvm::StringMapImpl::RehashTable(), and llvm::StringMapImpl::TheTable.
Referenced by llvm::pdb::DbiStreamBuilder::addModuleSourceFile(), llvm::DCData::addSuccessorLabel(), llvm::CodeViewContext::addToStringTable(), llvm::ComputeCrossModuleImportForModuleFromIndex(), computeImportForFunction(), llvm::MCContext::createELFRelSection(), createIndexMap(), llvm::IRComparer< T >::generateFunctionData(), llvm::NonRelocatableStringpool::getEntry(), llvm::LLVMContext::getMDKindID(), llvm::StringToOffsetTable::GetOrAddStringOffset(), llvm::LLVMContextImpl::getOrInsertBundleTag(), llvm::Module::getOrInsertComdat(), llvm::Module::getUniqueIntrinsicName(), llvm::lto::initImportList(), llvm::StringMap< ValueTy, AllocatorTy >::insert(), llvm::codeview::DebugStringTableSubsection::insert(), llvm::AMDGPU::insertWaveSizeFeature(), llvm::NonRelocatableStringpool::internString(), printMemberHeader(), llvm::CachedPathResolver::resolve(), llvm::RuntimeDyldImpl::resolveExternalSymbols(), llvm::Logger::startObservation(), llvm::StringMap< ValueTy, AllocatorTy >::StringMap(), and llvm::MCDwarfLineTableHeader::tryGetFile().
|
inline |
Inserts elements from initializer list ilist.
If multiple elements in the range have keys that compare equivalent, it is unspecified which element is inserted
Definition at line 321 of file StringMap.h.
References llvm::StringMap< ValueTy, AllocatorTy >::insert(), and llvm::List.
|
inline |
insert - Inserts the specified key/value pair into the map if the key isn't already in the map.
The bool component of the returned pair is true if and only if the insertion takes place, and the iterator component of the pair points to the element with key equivalent to the key of the pair.
Definition at line 306 of file StringMap.h.
References llvm::StringMap< ValueTy, AllocatorTy >::try_emplace().
|
inline |
Inserts an element or assigns to the current element if the key already exists.
The return type is the same as try_emplace.
Definition at line 328 of file StringMap.h.
References llvm::StringMap< ValueTy, AllocatorTy >::try_emplace().
|
inline |
Definition at line 212 of file StringMap.h.
References llvm::StringMap< ValueTy, AllocatorTy >::begin(), llvm::StringMap< ValueTy, AllocatorTy >::end(), and llvm::make_range().
Referenced by llvm::Annotations::all_points(), llvm::Annotations::all_ranges(), and llvm::InstrProfSymtab::dumpNames().
|
inline |
lookup - Return the entry for the specified key, or a default constructed value if no such entry exists.
Definition at line 233 of file StringMap.h.
References llvm::StringMap< ValueTy, AllocatorTy >::end(), and llvm::StringMap< ValueTy, AllocatorTy >::find().
Referenced by llvm::gatherImportedSummariesForModule(), llvm::ModuleSummaryIndex::getModuleId(), llvm::Module::getNamedMetadata(), llvm::OpenMPIRBuilder::getOpenMPDefaultSimdAlign(), llvm::PassRegistry::getPassInfo(), llvm::ValueSymbolTable::lookup(), and llvm::MCContext::lookupSymbol().
|
inline |
Definition at line 281 of file StringMap.h.
References RHS.
|
inline |
Definition at line 172 of file StringMap.h.
References llvm::detail::AllocatorHolder< Alloc >::getAllocator(), RHS, std::swap(), and llvm::StringMapImpl::swap().
|
inline |
equal - check whether both of the containers are equal.
Definition at line 264 of file StringMap.h.
References RHS, and llvm::StringMapImpl::size().
|
inline |
Lookup the ValueTy for the Key
, or create a default constructed value if the key is not in the map.
Definition at line 250 of file StringMap.h.
References llvm::StringMap< ValueTy, AllocatorTy >::try_emplace().
|
inline |
remove - Remove the specified key/value pair from the map, but do not erase it.
This aborts if the key is not in the map.
Definition at line 379 of file StringMap.h.
References llvm::StringMapImpl::RemoveKey().
Referenced by llvm::StringMap< ValueTy, AllocatorTy >::erase(), and llvm::StructType::setName().
|
inline |
Emplace a new element for the specified key into the map if the key isn't already in the map.
The bool component of the returned pair is true if and only if the insertion takes place, and the iterator component of the pair points to the element with key equivalent to the key of the pair.
Definition at line 340 of file StringMap.h.
References assert(), llvm::StringMapEntry< ValueTy >::create(), llvm::detail::AllocatorHolder< Alloc >::getAllocator(), llvm::StringMapImpl::getTombstoneVal(), llvm::StringMapImpl::LookupBucketFor(), llvm::StringMapImpl::NumBuckets, llvm::StringMapImpl::NumItems, llvm::StringMapImpl::NumTombstones, llvm::StringMapImpl::RehashTable(), and llvm::StringMapImpl::TheTable.
Referenced by llvm::StringMap< ValueTy, AllocatorTy >::insert(), llvm::StringSet< AllocatorTy >::insert(), llvm::StringMap< ValueTy, AllocatorTy >::insert_or_assign(), llvm::orc::SymbolStringPool::intern(), llvm::StringMap< ValueTy, AllocatorTy >::operator[](), and llvm::GCOVFile::readGCNO().