LLVM 24.0.0git
llvm::densemap::detail Namespace Reference

Classes

class  DenseMapStorage
class  SmallDenseMapStorage
struct  StorageRep

Typedefs

using UsedT = uint32_t
using BucketHasher = unsigned (*)(const void *Key)
 Hashes the key, at offset 0 in a bucket.

Functions

template<typename BucketT>
void relocateBucket (BucketT *Dst, BucketT *Src)
constexpr size_t usedWords (size_t N)
bool used (const UsedT *U, size_t I)
void setUsed (UsedT *U, size_t I)
void unsetUsed (UsedT *U, size_t I)
void clearUsed (UsedT *U, unsigned Num)
template<typename Fn>
LLVM_ATTRIBUTE_ALWAYS_INLINE void forEachUsed (const UsedT *U, unsigned N, Fn Func)
template<typename BucketT>
constexpr size_t allocAlign ()
size_t allocBytes (size_t BucketSize, unsigned Num)
template<typename BucketT>
size_t allocBytes (unsigned Num)
UsedT * usedFor (void *Buckets, size_t BucketSize, unsigned Num)
template<typename KeyT, typename KeyInfoT>
constexpr BucketHasher hasherFor ()
LLVM_ABI void rehashRelocatable (void *Dst, UsedT *DstUsed, unsigned DstNumBuckets, const void *Src, const UsedT *SrcUsed, unsigned SrcNumBuckets, size_t BucketSize, BucketHasher Hasher)
 Rehash the live buckets of Src into the empty Dst, which must have room for all of them.
LLVM_ABI void * growRelocatable (void *OldBuckets, const UsedT *OldUsed, unsigned OldNumBuckets, unsigned NewNumBuckets, size_t BucketSize, size_t Align, BucketHasher Hasher, bool FreeOld)
 Allocate a table of NewNumBuckets buckets and rehash the OldNumBuckets buckets at OldBuckets into it, freeing them if FreeOld.
uint64_t mix (uint64_t x)

Variables

template<typename BucketT>
constexpr bool isRelocatableBucket
template<typename KeyT, typename KeyInfoT, typename = void>
constexpr bool hashesPointerValue = false
template<typename T>
constexpr bool hashesPointerValue< T *, DenseMapInfo< T * >, std::enable_if_t< std::is_same_v< typename DenseMapInfo< T * >::PointerValueHash, DenseMapInfo< T * > > > >

Typedef Documentation

◆ BucketHasher

Hashes the key, at offset 0 in a bucket.

Null asks the out-of-line rehash loop in DenseMap.cpp to inline the pointer hash.

Definition at line 165 of file DenseMap.h.

◆ UsedT

Definition at line 108 of file DenseMap.h.

Function Documentation

◆ allocAlign()

◆ allocBytes() [1/2]

◆ allocBytes() [2/2]

template<typename BucketT>
size_t llvm::densemap::detail::allocBytes ( unsigned Num)

Definition at line 153 of file DenseMap.h.

References allocBytes().

◆ clearUsed()

◆ forEachUsed()

template<typename Fn>
LLVM_ATTRIBUTE_ALWAYS_INLINE void llvm::densemap::detail::forEachUsed ( const UsedT * U,
unsigned N,
Fn Func )

Definition at line 132 of file DenseMap.h.

References llvm::countr_zero(), LLVM_ATTRIBUTE_ALWAYS_INLINE, N, and usedWords().

Referenced by rehashLoop().

◆ growRelocatable()

void * llvm::densemap::detail::growRelocatable ( void * OldBuckets,
const UsedT * OldUsed,
unsigned OldNumBuckets,
unsigned NewNumBuckets,
size_t BucketSize,
size_t Align,
BucketHasher Hasher,
bool FreeOld )

Allocate a table of NewNumBuckets buckets and rehash the OldNumBuckets buckets at OldBuckets into it, freeing them if FreeOld.

Definition at line 85 of file DenseMap.cpp.

References llvm::allocate_buffer(), allocBytes(), clearUsed(), llvm::deallocate_buffer(), rehashRelocatable(), and usedFor().

Referenced by llvm::densemap::detail::DenseMapStorage< BucketT >::grow(), and llvm::densemap::detail::SmallDenseMapStorage< BucketT, InlineBuckets >::grow().

◆ hasherFor()

template<typename KeyT, typename KeyInfoT>
BucketHasher llvm::densemap::detail::hasherFor ( )
constexpr

◆ mix()

◆ rehashRelocatable()

void llvm::densemap::detail::rehashRelocatable ( void * Dst,
UsedT * DstUsed,
unsigned DstNumBuckets,
const void * Src,
const UsedT * SrcUsed,
unsigned SrcNumBuckets,
size_t BucketSize,
BucketHasher Hasher )

Rehash the live buckets of Src into the empty Dst, which must have room for all of them.

Definition at line 71 of file DenseMap.cpp.

References rehashBySize().

Referenced by llvm::densemap::detail::SmallDenseMapStorage< BucketT, InlineBuckets >::grow(), and growRelocatable().

◆ relocateBucket()

template<typename BucketT>
void llvm::densemap::detail::relocateBucket ( BucketT * Dst,
BucketT * Src )

◆ setUsed()

void llvm::densemap::detail::setUsed ( UsedT * U,
size_t I )
inline

Definition at line 120 of file DenseMap.h.

References I.

Referenced by rehashLoop().

◆ unsetUsed()

void llvm::densemap::detail::unsetUsed ( UsedT * U,
size_t I )
inline

◆ used()

◆ usedFor()

UsedT * llvm::densemap::detail::usedFor ( void * Buckets,
size_t BucketSize,
unsigned Num )
inline

◆ usedWords()

size_t llvm::densemap::detail::usedWords ( size_t N)
constexpr

Definition at line 111 of file DenseMap.h.

References assert(), llvm::isPowerOf2_64(), and N.

Referenced by allocBytes(), clearUsed(), and forEachUsed().

Variable Documentation

◆ hashesPointerValue

template<typename KeyT, typename KeyInfoT, typename = void>
bool llvm::densemap::detail::hashesPointerValue = false
inlineconstexpr

Definition at line 173 of file DenseMap.h.

Referenced by hasherFor().

◆ hashesPointerValue< T *, DenseMapInfo< T * >, std::enable_if_t< std::is_same_v< typename DenseMapInfo< T * >::PointerValueHash, DenseMapInfo< T * > > > >

template<typename T>
bool llvm::densemap::detail::hashesPointerValue< T *, DenseMapInfo< T * >, std::enable_if_t< std::is_same_v< typename DenseMapInfo< T * >::PointerValueHash, DenseMapInfo< T * > > > >
inlineconstexpr
Initial value:
=
true

Definition at line 175 of file DenseMap.h.

◆ isRelocatableBucket

template<typename BucketT>
bool llvm::densemap::detail::isRelocatableBucket
inlineconstexpr
Initial value:
=
std::is_trivially_copy_constructible_v<BucketT> &&
std::is_trivially_destructible_v<BucketT>

Definition at line 94 of file DenseMap.h.