LLVM 24.0.0git
llvm::sampleprof::SampleProfileFuncOffsetTable Class Reference

A unified wrapper representing the function offset table. More...

#include "llvm/ProfileData/SampleProfReader.h"

Public Types

enum class  TableMode { InMemory , Eytzinger }

Public Member Functions

 SampleProfileFuncOffsetTable ()=delete
 SampleProfileFuncOffsetTable (const SampleProfileFuncOffsetTable &)=delete
SampleProfileFuncOffsetTableoperator= (const SampleProfileFuncOffsetTable &)=delete
 SampleProfileFuncOffsetTable (SampleProfileFuncOffsetTable &&)=delete
SampleProfileFuncOffsetTableoperator= (SampleProfileFuncOffsetTable &&)=delete
 SampleProfileFuncOffsetTable (InMemoryModeT, size_t InitialCapacity=0)
 SampleProfileFuncOffsetTable (EytzingerModeT, EytzingerTableSpan< support::ulittle64_t > NameSpan, ArrayRef< support::ulittle32_t > FuncOffsetSpan)
void insert (uint64_t GUID, uint64_t Offset)
 Insert a function GUID and its profile offset into the in-memory map.
std::optional< uint64_tlookup (uint64_t GUID) const
 Query the offset table for the profile offset associated with the given GUID.
ArrayRef< support::ulittle32_tgetFuncOffsets () const
 Direct read-only array (ArrayRef) of function offsets aligned parallel to the corresponding Eytzinger name span.
size_t getExpectedSize () const
bool isEytzinger () const

Detailed Description

A unified wrapper representing the function offset table.

This class abstracts away the physical representation of the offset table, which can either be:

  • An llvm::DenseMap mapping function GUIDs (or context hashes) to their profile offsets, populated when reading the array of offsets in context-sensitive (CS) profiles or version 103 profiles.
  • A raw slice of 32-bit relative offsets for Eytzinger parallel lookups.

It exposes a single, type-agnostic lookup interface, shielding the reader from the underlying container types. To prevent hybrid-state corruption, the table's mode is locked at construction time.

Definition at line 994 of file SampleProfReader.h.

Member Enumeration Documentation

◆ TableMode

Enumerator
InMemory 
Eytzinger 

Definition at line 996 of file SampleProfReader.h.

Constructor & Destructor Documentation

◆ SampleProfileFuncOffsetTable() [1/5]

llvm::sampleprof::SampleProfileFuncOffsetTable::SampleProfileFuncOffsetTable ( )
delete

◆ SampleProfileFuncOffsetTable() [2/5]

llvm::sampleprof::SampleProfileFuncOffsetTable::SampleProfileFuncOffsetTable ( const SampleProfileFuncOffsetTable & )
delete

◆ SampleProfileFuncOffsetTable() [3/5]

llvm::sampleprof::SampleProfileFuncOffsetTable::SampleProfileFuncOffsetTable ( SampleProfileFuncOffsetTable && )
delete

◆ SampleProfileFuncOffsetTable() [4/5]

llvm::sampleprof::SampleProfileFuncOffsetTable::SampleProfileFuncOffsetTable ( InMemoryModeT ,
size_t InitialCapacity = 0 )
inlineexplicit

Definition at line 1006 of file SampleProfReader.h.

References InMemory.

◆ SampleProfileFuncOffsetTable() [5/5]

llvm::sampleprof::SampleProfileFuncOffsetTable::SampleProfileFuncOffsetTable ( EytzingerModeT ,
EytzingerTableSpan< support::ulittle64_t > NameSpan,
ArrayRef< support::ulittle32_t > FuncOffsetSpan )
inline

Definition at line 1012 of file SampleProfReader.h.

References Eytzinger.

Member Function Documentation

◆ getExpectedSize()

size_t llvm::sampleprof::SampleProfileFuncOffsetTable::getExpectedSize ( ) const
inline

Definition at line 1050 of file SampleProfReader.h.

References assert(), and isEytzinger().

◆ getFuncOffsets()

ArrayRef< support::ulittle32_t > llvm::sampleprof::SampleProfileFuncOffsetTable::getFuncOffsets ( ) const
inline

Direct read-only array (ArrayRef) of function offsets aligned parallel to the corresponding Eytzinger name span.

Definition at line 1044 of file SampleProfReader.h.

References assert(), and isEytzinger().

◆ insert()

void llvm::sampleprof::SampleProfileFuncOffsetTable::insert ( uint64_t GUID,
uint64_t Offset )
inline

Insert a function GUID and its profile offset into the in-memory map.

Definition at line 1019 of file SampleProfReader.h.

References assert(), InMemory, and llvm::Offset.

◆ isEytzinger()

bool llvm::sampleprof::SampleProfileFuncOffsetTable::isEytzinger ( ) const
inline

Definition at line 1056 of file SampleProfReader.h.

References Eytzinger.

Referenced by getExpectedSize(), getFuncOffsets(), and lookup().

◆ lookup()

std::optional< uint64_t > llvm::sampleprof::SampleProfileFuncOffsetTable::lookup ( uint64_t GUID) const
inline

Query the offset table for the profile offset associated with the given GUID.

Returns the offset if found, or std::nullopt if the key is missing.

Definition at line 1027 of file SampleProfReader.h.

References isEytzinger().

◆ operator=() [1/2]

SampleProfileFuncOffsetTable & llvm::sampleprof::SampleProfileFuncOffsetTable::operator= ( const SampleProfileFuncOffsetTable & )
delete

◆ operator=() [2/2]

SampleProfileFuncOffsetTable & llvm::sampleprof::SampleProfileFuncOffsetTable::operator= ( SampleProfileFuncOffsetTable && )
delete

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