LLVM 20.0.0git
Classes | Public Types | Public Member Functions | List of all members
llvm::ThreadSafeTrieRawHashMap< T, NumHashBytes > Class Template Reference

Lock-free thread-safe hash-mapped trie. More...

#include "llvm/ADT/TrieRawHashMap.h"

Inheritance diagram for llvm::ThreadSafeTrieRawHashMap< T, NumHashBytes >:
Inheritance graph
[legend]

Classes

class  const_pointer
 
class  LazyValueConstructor
 
class  pointer
 
struct  value_type
 

Public Types

using HashT = std::array< uint8_t, NumHashBytes >
 
using HashType = HashT
 

Public Member Functions

pointer insertLazy (const_pointer Hint, ArrayRef< uint8_t > Hash, function_ref< void(LazyValueConstructor)> OnConstruct)
 Insert with a hint.
 
pointer insertLazy (ArrayRef< uint8_t > Hash, function_ref< void(LazyValueConstructor)> OnConstruct)
 
pointer insert (const_pointer Hint, value_type &&HashedData)
 
pointer insert (const_pointer Hint, const value_type &HashedData)
 
pointer find (ArrayRef< uint8_t > Hash)
 
const_pointer find (ArrayRef< uint8_t > Hash) const
 
 ThreadSafeTrieRawHashMap (std::optional< size_t > NumRootBits=std::nullopt, std::optional< size_t > NumSubtrieBits=std::nullopt)
 
 ~ThreadSafeTrieRawHashMap ()
 
 ThreadSafeTrieRawHashMap (ThreadSafeTrieRawHashMap &&)=default
 
ThreadSafeTrieRawHashMapoperator= (ThreadSafeTrieRawHashMap &&)=delete
 
 ThreadSafeTrieRawHashMap (const ThreadSafeTrieRawHashMap &)=delete
 
ThreadSafeTrieRawHashMapoperator= (const ThreadSafeTrieRawHashMap &)=delete
 
LLVM_DUMP_METHOD void dump () const
 
void print (raw_ostream &OS) const
 
- Public Member Functions inherited from llvm::ThreadSafeTrieRawHashMapBase
void operator delete (void *Ptr)
 
LLVM_DUMP_METHOD void dump () const
 
void print (raw_ostream &OS) const
 

Additional Inherited Members

- Static Public Member Functions inherited from llvm::ThreadSafeTrieRawHashMapBase
static void * operator new (size_t Size)
 
- Static Public Attributes inherited from llvm::ThreadSafeTrieRawHashMapBase
static constexpr size_t TrieContentBaseSize = 4
 
static constexpr size_t DefaultNumRootBits = 6
 
static constexpr size_t DefaultNumSubtrieBits = 4
 
- Protected Member Functions inherited from llvm::ThreadSafeTrieRawHashMapBase
PointerBase find (ArrayRef< uint8_t > Hash) const
 Find the stored content with hash.
 
PointerBase insert (PointerBase Hint, ArrayRef< uint8_t > Hash, function_ref< const uint8_t *(void *Mem, ArrayRef< uint8_t > Hash)> Constructor)
 Insert and return the stored content.
 
 ThreadSafeTrieRawHashMapBase ()=delete
 
 ThreadSafeTrieRawHashMapBase (size_t ContentAllocSize, size_t ContentAllocAlign, size_t ContentOffset, std::optional< size_t > NumRootBits=std::nullopt, std::optional< size_t > NumSubtrieBits=std::nullopt)
 
 ~ThreadSafeTrieRawHashMapBase ()
 Destructor, which asserts if there's anything to do.
 
void destroyImpl (function_ref< void(void *ValueMem)> Destructor)
 
 ThreadSafeTrieRawHashMapBase (ThreadSafeTrieRawHashMapBase &&RHS)
 
ThreadSafeTrieRawHashMapBaseoperator= (ThreadSafeTrieRawHashMapBase &&RHS)=delete
 
 ThreadSafeTrieRawHashMapBase (const ThreadSafeTrieRawHashMapBase &)=delete
 
ThreadSafeTrieRawHashMapBaseoperator= (const ThreadSafeTrieRawHashMapBase &)=delete
 
PointerBase getRoot () const
 
unsigned getStartBit (PointerBase P) const
 
unsigned getNumBits (PointerBase P) const
 
unsigned getNumSlotUsed (PointerBase P) const
 
std::string getTriePrefixAsString (PointerBase P) const
 
unsigned getNumTries () const
 
PointerBase getNextTrie (PointerBase P) const
 
- Static Protected Attributes inherited from llvm::ThreadSafeTrieRawHashMapBase
template<class T >
static constexpr size_t DefaultContentAllocSize = sizeof(AllocValueType<T>)
 
template<class T >
static constexpr size_t DefaultContentAllocAlign = alignof(AllocValueType<T>)
 
template<class T >
static constexpr size_t DefaultContentOffset
 

Detailed Description

template<class T, size_t NumHashBytes>
class llvm::ThreadSafeTrieRawHashMap< T, NumHashBytes >

Lock-free thread-safe hash-mapped trie.

Definition at line 182 of file TrieRawHashMap.h.

Member Typedef Documentation

◆ HashT

template<class T , size_t NumHashBytes>
using llvm::ThreadSafeTrieRawHashMap< T, NumHashBytes >::HashT = std::array<uint8_t, NumHashBytes>

Definition at line 184 of file TrieRawHashMap.h.

◆ HashType

template<class T , size_t NumHashBytes>
using llvm::ThreadSafeTrieRawHashMap< T, NumHashBytes >::HashType = HashT

Definition at line 215 of file TrieRawHashMap.h.

Constructor & Destructor Documentation

◆ ThreadSafeTrieRawHashMap() [1/3]

template<class T , size_t NumHashBytes>
llvm::ThreadSafeTrieRawHashMap< T, NumHashBytes >::ThreadSafeTrieRawHashMap ( std::optional< size_t >  NumRootBits = std::nullopt,
std::optional< size_t >  NumSubtrieBits = std::nullopt 
)
inline

Definition at line 350 of file TrieRawHashMap.h.

◆ ~ThreadSafeTrieRawHashMap()

template<class T , size_t NumHashBytes>
llvm::ThreadSafeTrieRawHashMap< T, NumHashBytes >::~ThreadSafeTrieRawHashMap ( )
inline

Definition at line 357 of file TrieRawHashMap.h.

References llvm::ThreadSafeTrieRawHashMapBase::destroyImpl(), and P.

◆ ThreadSafeTrieRawHashMap() [2/3]

template<class T , size_t NumHashBytes>
llvm::ThreadSafeTrieRawHashMap< T, NumHashBytes >::ThreadSafeTrieRawHashMap ( ThreadSafeTrieRawHashMap< T, NumHashBytes > &&  )
default

◆ ThreadSafeTrieRawHashMap() [3/3]

template<class T , size_t NumHashBytes>
llvm::ThreadSafeTrieRawHashMap< T, NumHashBytes >::ThreadSafeTrieRawHashMap ( const ThreadSafeTrieRawHashMap< T, NumHashBytes > &  )
delete

Member Function Documentation

◆ dump()

template<class T , size_t NumHashBytes>
LLVM_DUMP_METHOD void llvm::ThreadSafeTrieRawHashMapBase::dump ( ) const

◆ find() [1/2]

template<class T , size_t NumHashBytes>
pointer llvm::ThreadSafeTrieRawHashMap< T, NumHashBytes >::find ( ArrayRef< uint8_t Hash)
inline

◆ find() [2/2]

template<class T , size_t NumHashBytes>
const_pointer llvm::ThreadSafeTrieRawHashMap< T, NumHashBytes >::find ( ArrayRef< uint8_t Hash) const
inline

◆ insert() [1/2]

template<class T , size_t NumHashBytes>
pointer llvm::ThreadSafeTrieRawHashMap< T, NumHashBytes >::insert ( const_pointer  Hint,
const value_type HashedData 
)
inline

◆ insert() [2/2]

template<class T , size_t NumHashBytes>
pointer llvm::ThreadSafeTrieRawHashMap< T, NumHashBytes >::insert ( const_pointer  Hint,
value_type &&  HashedData 
)
inline

◆ insertLazy() [1/2]

template<class T , size_t NumHashBytes>
pointer llvm::ThreadSafeTrieRawHashMap< T, NumHashBytes >::insertLazy ( ArrayRef< uint8_t Hash,
function_ref< void(LazyValueConstructor)>  OnConstruct 
)
inline

◆ insertLazy() [2/2]

template<class T , size_t NumHashBytes>
pointer llvm::ThreadSafeTrieRawHashMap< T, NumHashBytes >::insertLazy ( const_pointer  Hint,
ArrayRef< uint8_t Hash,
function_ref< void(LazyValueConstructor)>  OnConstruct 
)
inline

Insert with a hint.

Default-constructed hint will work, but it's recommended to start with a lookup to avoid overhead in object creation if it already exists.

Definition at line 314 of file TrieRawHashMap.h.

References llvm::ThreadSafeTrieRawHashMapBase::insert().

Referenced by llvm::ThreadSafeTrieRawHashMap< T, NumHashBytes >::insert(), and llvm::ThreadSafeTrieRawHashMap< T, NumHashBytes >::insertLazy().

◆ operator=() [1/2]

template<class T , size_t NumHashBytes>
ThreadSafeTrieRawHashMap & llvm::ThreadSafeTrieRawHashMap< T, NumHashBytes >::operator= ( const ThreadSafeTrieRawHashMap< T, NumHashBytes > &  )
delete

◆ operator=() [2/2]

template<class T , size_t NumHashBytes>
ThreadSafeTrieRawHashMap & llvm::ThreadSafeTrieRawHashMap< T, NumHashBytes >::operator= ( ThreadSafeTrieRawHashMap< T, NumHashBytes > &&  )
delete

◆ print()

template<class T , size_t NumHashBytes>
void llvm::ThreadSafeTrieRawHashMapBase::print ( raw_ostream OS) const

The documentation for this class was generated from the following file: