LLVM 20.0.0git
|
StringMapImpl - This is the base class of StringMap that is shared among all of its instantiations. More...
#include "llvm/ADT/StringMap.h"
Inherited by llvm::StringMap< BlockDataT< T > >, llvm::StringMap< FuncDataT< T > >, llvm::StringMap< std::nullopt_t, MallocAllocator >, llvm::StringMap< DenseSet< ValueInfo > >, llvm::StringMap< std::unique_ptr< llvm::AArch64Subtarget > >, llvm::StringMap< std::unique_ptr< llvm::ARMSubtarget > >, llvm::StringMap< llvm::SmallVector< size_t, 1 > >, llvm::StringMap< std::vector< std::string > >, llvm::StringMap< llvm::SmallString< 128 > >, llvm::StringMap< llvm::FunctionPathAndClusterInfo >, llvm::StringMap< llvm::StringRef >, llvm::StringMap< std::unique_ptr< llvm::CSKYSubtarget > >, llvm::StringMap< unsigned >, llvm::StringMap< uint32_t >, llvm::StringMap< std::string >, llvm::StringMap< const llvm::DIE * >, llvm::StringMap< llvm::DwarfStringPoolEntry, llvm::BumpPtrAllocatorImpl & >, llvm::StringMap< uint64_t >, llvm::StringMap< bool >, llvm::StringMap< llvm::NumericVariable * >, llvm::StringMap< llvm::GCStrategy * >, llvm::StringMap< std::unique_ptr< llvm::GCNSubtarget > >, llvm::StringMap< std::unique_ptr< llvm::GCStrategy > >, llvm::StringMap< std::unique_ptr< llvm::HexagonSubtarget > >, llvm::StringMap< std::unique_ptr< InlineGraphNode > >, llvm::StringMap< llvm::SmallDenseMap >, llvm::StringMap< std::pair< llvm::Type *, llvm::SMLoc > >, llvm::StringMap< llvm::MDString, llvm::BumpPtrAllocatorImpl >, llvm::StringMap< std::unique_ptr< llvm::ConstantDataSequential > >, llvm::StringMap< llvm::StructType * >, llvm::StringMap< uint8_t >, llvm::StringMap< GlobalValue::LinkageTypes >, llvm::StringMap< NameAndAttributes >, llvm::StringMap< size_t >, llvm::StringMap< std::unique_ptr< llvm::LoongArchSubtarget > >, llvm::StringMap< std::unique_ptr< llvm::M68kSubtarget > >, llvm::StringMap< MCSymbolTableValue, BumpPtrAllocator & >, llvm::StringMap< llvm::MCSymbol *, llvm::BumpPtrAllocatorImpl & >, llvm::StringMap< llvm::MCSectionMachO * >, llvm::StringMap< llvm::MCSectionELF * >, llvm::StringMap< llvm::MCSectionDXContainer * >, llvm::StringMap< llvm::MCAsmMacro >, llvm::StringMap< std::unique_ptr< llvm::MipsSubtarget > >, llvm::StringMap< Comdat >, llvm::StringMap< NamedMDNode * >, llvm::StringMap< ModuleHash >, llvm::StringMap< DwarfStringPoolEntry, BumpPtrAllocator >, llvm::StringMap< OffloadEntryInfoDeviceGlobalVar >, llvm::StringMap< llvm::Constant * >, llvm::StringMap< llvm::GlobalVariable *, llvm::BumpPtrAllocatorImpl >, llvm::StringMap< T >, llvm::StringMap< std::unique_ptr< llvm::PPCSubtarget > >, llvm::StringMap< const PassInfo * >, llvm::StringMap< NumericVariableMatch >, llvm::StringMap< llvm::VRegInfo * >, llvm::StringMap< llvm::Register >, llvm::StringMap< const uint32_t * >, llvm::StringMap< int >, llvm::StringMap< MachineMemOperand::Flags >, llvm::StringMap< const TargetRegisterClass * >, llvm::StringMap< const RegisterBank * >, llvm::StringMap< ProbeFactorMap >, llvm::StringMap< std::unique_ptr< const llvm::ExternalSymbolPseudoSourceValue > >, llvm::StringMap< std::unique_ptr< llvm::R600Subtarget > >, llvm::StringMap< std::unique_ptr< llvm::RISCVSubtarget > >, llvm::StringMap< State >, llvm::StringMap< SymbolTableEntry >, llvm::StringMap< llvm::SmallVector >, llvm::StringMap< LocToLocMap >, llvm::StringMap< std::unordered_map< llvm::sampleprof::LineLocation, MatchState, llvm::sampleprof::LineLocationHash > >, llvm::StringMap< llvm::SDNode * >, llvm::StringMap< std::unique_ptr< llvm::SetTheory::Operator > >, llvm::StringMap< std::unique_ptr< llvm::SetTheory::Expander > >, llvm::StringMap< llvm::Type * >, llvm::StringMap< std::unique_ptr< llvm::SparcSubtarget > >, llvm::StringMap< llvm::SpecialCaseList::Section >, llvm::StringMap< std::pair< llvm::GlobPattern, unsigned > >, llvm::StringMap< StringMap< Matcher > >, llvm::StringMap< std::unique_ptr< llvm::SystemZSubtarget > >, llvm::StringMap< CountAndDurationType >, llvm::StringMap< Value * >, llvm::StringMap< std::unique_ptr< llvm::WebAssemblySubtarget > >, llvm::StringMap< std::unique_ptr< llvm::X86Subtarget > >, llvm::StringMap< std::unique_ptr< llvm::XtensaSubtarget > >, llvm::StringMap< llvm::cl::Option * >, llvm::StringMap< std::vector< llvm::support::detail::packed_endian_specific_integral > >, llvm::StringMap< const llvm::StringInit *, llvm::BumpPtrAllocatorImpl & >, llvm::StringMap< llvm::StringMapEntry * >, llvm::StringMap< Symbol * >, llvm::StringMap< SectionParserFunction >, llvm::StringMap< size_t, BumpPtrAllocator >, llvm::StringMap< llvm::objcopy::SectionRename >, llvm::StringMap< llvm::objcopy::SectionFlagsUpdate >, llvm::StringMap< std::unique_ptr< llvm::orc::DebugObjectSection > >, llvm::StringMap< std::vector< char > >, llvm::StringMap< llvm::orc::ExecutorAddr >, llvm::StringMap< std::pair< StubKey, llvm::JITSymbolFlags > >, llvm::StringMap< RefCountType >, llvm::StringMap< llvm::codeview::FileChecksumEntry >, llvm::StringMap< unsigned, llvm::BumpPtrAllocatorImpl >, and llvm::StringMap< ValueTy, AllocatorTy >.
Public Member Functions | |
unsigned | getNumBuckets () const |
unsigned | getNumItems () const |
bool | empty () const |
unsigned | size () const |
void | swap (StringMapImpl &Other) |
Static Public Member Functions | |
static StringMapEntryBase * | getTombstoneVal () |
static uint32_t | hash (StringRef Key) |
Returns the hash value that will be used for the given string. | |
Static Public Attributes | |
static constexpr uintptr_t | TombstoneIntVal |
Protected Member Functions | |
StringMapImpl (unsigned itemSize) | |
StringMapImpl (StringMapImpl &&RHS) | |
StringMapImpl (unsigned InitSize, unsigned ItemSize) | |
~StringMapImpl () | |
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. | |
unsigned | LookupBucketFor (StringRef Key, uint32_t FullHashValue) |
Overload that explicitly takes precomputed hash(Key). | |
int | FindKey (StringRef Key) const |
FindKey - Look up the bucket that contains the specified key. | |
int | FindKey (StringRef Key, uint32_t FullHashValue) const |
Overload that explicitly takes precomputed hash(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. | |
Protected Attributes | |
StringMapEntryBase ** | TheTable = nullptr |
unsigned | NumBuckets = 0 |
unsigned | NumItems = 0 |
unsigned | NumTombstones = 0 |
unsigned | ItemSize |
StringMapImpl - This is the base class of StringMap that is shared among all of its instantiations.
Definition at line 32 of file StringMap.h.
|
inlineexplicitprotected |
Definition at line 44 of file StringMap.h.
|
inlineprotected |
Definition at line 45 of file StringMap.h.
References RHS.
Definition at line 48 of file StringMap.cpp.
References getMinBucketToReserveForEntries(), init(), ItemSize, NumBuckets, NumItems, NumTombstones, and TheTable.
|
inlineprotected |
Definition at line 56 of file StringMap.h.
References TheTable.
|
inline |
Definition at line 103 of file StringMap.h.
References NumItems.
Referenced by llvm::orc::SymbolStringPool::empty(), llvm::ValueSymbolTable::empty(), llvm::StringToOffsetTable::empty(), llvm::DwarfStringPool::empty(), llvm::objcopy::ConfigManager::getCOFFConfig(), llvm::objcopy::ConfigManager::getMachOConfig(), llvm::objcopy::ConfigManager::getWasmConfig(), llvm::objcopy::ConfigManager::getXCOFFConfig(), llvm::RISCVISAInfo::printEnabledExtensions(), llvm::RISCVISAInfo::printSupportedExtensions(), llvm::ARM::PrintSupportedExtensions(), llvm::Pattern::printVariableDefs(), and llvm::orc::SymbolStringPool::~SymbolStringPool().
|
inlineprotected |
FindKey - Look up the bucket that contains the specified key.
If it exists in the map, return the bucket number of the key. Otherwise return -1. This does not modify the map.
Definition at line 74 of file StringMap.h.
References FindKey(), and hash().
Referenced by llvm::StringSet< AllocatorTy >::contains(), FindKey(), and RemoveKey().
Overload that explicitly takes precomputed hash(Key).
FindKey - Look up the bucket that contains the specified key.
If it exists in the map, return the bucket number of the key. Otherwise return -1. This does not modify the map.
Definition at line 147 of file StringMap.cpp.
References assert(), getHashTable(), llvm::StringMapEntryBase::getKeyLength(), getTombstoneVal(), hash(), ItemSize, LLVM_LIKELY, NumBuckets, llvm::shouldReverseIterate(), and TheTable.
|
inline |
Definition at line 100 of file StringMap.h.
References NumBuckets.
|
inline |
Definition at line 101 of file StringMap.h.
References NumItems.
|
inlinestatic |
Definition at line 96 of file StringMap.h.
References TombstoneIntVal.
Referenced by FindKey(), LookupBucketFor(), RehashTable(), and RemoveKey().
Returns the hash value that will be used for the given string.
This allows precomputing the value and passing it explicitly to some of the functions. The implementation of this function is not guaranteed to be stable and may change.
Definition at line 46 of file StringMap.cpp.
References llvm::xxh3_64bits().
Referenced by FindKey(), and LookupBucketFor().
|
protected |
Allocate the table with the specified number of buckets and otherwise setup the map as empty.
Definition at line 67 of file StringMap.cpp.
References assert(), createTable(), NumBuckets, NumItems, NumTombstones, and TheTable.
Referenced by LookupBucketFor(), and StringMapImpl().
LookupBucketFor - Look up the bucket that the specified string should end up in.
If it already exists as a key in the map, the Item pointer for the specified bucket will be non-null. Otherwise, it will be null. In either case, the FullHashValue field of the bucket will be set to the hash value of the string.
Definition at line 64 of file StringMap.h.
References hash(), and LookupBucketFor().
Referenced by LookupBucketFor().
Overload that explicitly takes precomputed hash(Key).
LookupBucketFor - Look up the bucket that the specified string should end up in.
If it already exists as a key in the map, the Item pointer for the specified bucket will be non-null. Otherwise, it will be null. In either case, the FullHashValue field of the bucket will be set to the hash value of the string.
Definition at line 86 of file StringMap.cpp.
References assert(), getHashTable(), llvm::StringMapEntryBase::getKeyLength(), getTombstoneVal(), hash(), init(), ItemSize, LLVM_LIKELY, Name, NumBuckets, llvm::shouldReverseIterate(), and TheTable.
RehashTable - Grow the table, redistributing values into the buckets with the appropriate mod-of-hashtable-size.
Definition at line 218 of file StringMap.cpp.
References createTable(), getHashTable(), getTombstoneVal(), I, LLVM_UNLIKELY, NumBuckets, NumItems, NumTombstones, and TheTable.
|
protected |
RemoveKey - Remove the specified StringMapEntry from the table, but do not delete it.
This aborts if the value isn't in the table.
Definition at line 193 of file StringMap.cpp.
References assert(), ItemSize, and RemoveKey().
Referenced by RemoveKey().
|
protected |
RemoveKey - Remove the StringMapEntry for the specified key from the table, returning it.
If the key is not in the table, this returns null.
Definition at line 202 of file StringMap.cpp.
References assert(), FindKey(), getTombstoneVal(), NumBuckets, NumItems, NumTombstones, and TheTable.
|
inline |
Definition at line 104 of file StringMap.h.
References NumItems.
Referenced by llvm::pdb::DbiStreamBuilder::addModuleSourceFile(), llvm::orc::LocalIndirectStubsManager< TargetT >::createStubs(), llvm::NonRelocatableStringpool::getEntriesForEmission(), llvm::StableFunctionMap::getIdOrCreateForName(), llvm::LLVMContext::getMDKindID(), llvm::LLVMContext::getMDKindNames(), llvm::LLVMContextImpl::getOperandBundleTags(), llvm::LLVMContextImpl::getOrInsertBundleTag(), ProcessThinLTOModule(), llvm::codeview::DebugStringTableSubsection::size(), llvm::ValueSymbolTable::size(), llvm::DwarfStringPool::size(), and llvm::TimeTraceProfiler::write().
|
inline |
Definition at line 113 of file StringMap.h.
References NumBuckets, NumItems, NumTombstones, llvm::Other, std::swap(), and TheTable.
|
protected |
Definition at line 41 of file StringMap.h.
Referenced by FindKey(), LookupBucketFor(), RemoveKey(), and StringMapImpl().
|
protected |
Definition at line 38 of file StringMap.h.
Referenced by FindKey(), getNumBuckets(), init(), LookupBucketFor(), RehashTable(), RemoveKey(), StringMapImpl(), and swap().
|
protected |
Definition at line 39 of file StringMap.h.
Referenced by empty(), getNumItems(), init(), RehashTable(), RemoveKey(), size(), StringMapImpl(), and swap().
|
protected |
Definition at line 40 of file StringMap.h.
Referenced by init(), RehashTable(), RemoveKey(), StringMapImpl(), and swap().
|
protected |
Definition at line 37 of file StringMap.h.
Referenced by FindKey(), init(), LookupBucketFor(), RehashTable(), RemoveKey(), StringMapImpl(), swap(), and ~StringMapImpl().
|
staticconstexpr |
Definition at line 92 of file StringMap.h.
Referenced by getTombstoneVal().