LLVM 24.0.0git
llvm::dwarf_linker::parallel::TypePool Class Reference

TypePool keeps type descriptors which contain partially cloned DIE correspinding to each type. More...

#include "DWARFLinker/Parallel/TypePool.h"

Inheritance diagram for llvm::dwarf_linker::parallel::TypePool:
[legend]

Public Member Functions

 TypePool ()
TypeEntryinsert (StringRef Name)
TypeEntryBodygetOrCreateTypeEntryBody (TypeEntry *Entry, TypeEntry *ParentEntry)
 Create or return existing type entry body for the specified Entry.
void sortTypes ()
 Sort children for each kept type entry.
TypeEntrygetRoot () const
 Return root for all type entries.
BumpPtrAllocatorgetThreadLocalAllocator ()
 Return thread local allocator used by pool.

Protected Attributes

std::function< bool(const TypeEntry *LHS, const TypeEntry *RHS)> TypesComparator
TypeEntryRoot = nullptr

Detailed Description

TypePool keeps type descriptors which contain partially cloned DIE correspinding to each type.

Types are identified by names.

Definition at line 126 of file TypePool.h.

Constructor & Destructor Documentation

◆ TypePool()

Member Function Documentation

◆ getOrCreateTypeEntryBody()

TypeEntryBody * llvm::dwarf_linker::parallel::TypePool::getOrCreateTypeEntryBody ( TypeEntry * Entry,
TypeEntry * ParentEntry )
inline

Create or return existing type entry body for the specified Entry.

Link that entry as child for the specified ParentEntry. The returned body's SortKey starts at the sentinel; callers that want the entry to participate in source-order sorting must min-merge their per-CU observation into it.

Returns
The existing or created type entry body.

Definition at line 152 of file TypePool.h.

References llvm::dwarf_linker::parallel::TypeEntryBody::create(), and llvm::StringMapEntryStorage< ValueTy >::getValue().

◆ getRoot()

TypeEntry * llvm::dwarf_linker::parallel::TypePool::getRoot ( ) const
inline

Return root for all type entries.

Definition at line 179 of file TypePool.h.

References Root.

Referenced by llvm::dwarf_linker::parallel::CompileUnit::cloneAndEmit(), and sortTypes().

◆ getThreadLocalAllocator()

BumpPtrAllocator & llvm::dwarf_linker::parallel::TypePool::getThreadLocalAllocator ( )
inline

Return thread local allocator used by pool.

Definition at line 182 of file TypePool.h.

Referenced by llvm::dwarf_linker::parallel::CompileUnit::cloneDIE().

◆ insert()

◆ sortTypes()

void llvm::dwarf_linker::parallel::TypePool::sortTypes ( )
inline

Sort children for each kept type entry.

Definition at line 168 of file TypePool.h.

References getRoot(), and TypesComparator.

Member Data Documentation

◆ Root

TypeEntry* llvm::dwarf_linker::parallel::TypePool::Root = nullptr
protected

Definition at line 199 of file TypePool.h.

Referenced by getRoot(), and TypePool().

◆ TypesComparator

std::function<bool(const TypeEntry *LHS, const TypeEntry *RHS)> llvm::dwarf_linker::parallel::TypePool::TypesComparator
protected
Initial value:
= [](const TypeEntry *LHS, const TypeEntry *RHS) -> bool {
uint32_t LK =
LHS->getValue().load()->SortKey.load(std::memory_order_relaxed);
uint32_t RK =
RHS->getValue().load()->SortKey.load(std::memory_order_relaxed);
if (LK != RK)
return LK < RK;
return LHS->getKey() < RHS->getKey();
}
Value * RHS
Value * LHS
StringMapEntry< std::atomic< TypeEntryBody * > > TypeEntry
Definition TypePool.h:28

Definition at line 188 of file TypePool.h.

Referenced by sortTypes().


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