class IndexedInstrProfReader

Declaration

class IndexedInstrProfReader : public InstrProfReader { /* full declaration omitted */ };

Description

Reader for the indexed binary instrprof format.

Declared at: llvm/include/llvm/ProfileData/InstrProfReader.h:552

Inherits from: InstrProfReader

Member Variables

private std::unique_ptr<MemoryBuffer> DataBuffer
The profile data file contents.
private std::unique_ptr<MemoryBuffer> RemappingBuffer
The profile remapping file contents.
private std::unique_ptr<InstrProfReaderIndexBase> Index
The index into the profile data.
private std::unique_ptr<InstrProfReaderRemapper> Remapper
The profile remapping file contents.
private std::unique_ptr<ProfileSummary> Summary
Profile summary data.
private std::unique_ptr<ProfileSummary> CS_Summary
Context sensitive profile summary data.
private memprof::MemProfSchema Schema
MemProf profile schema (if available).
private std::unique_ptr<MemProfRecordHashTable> MemProfRecordTable
MemProf record profile data on-disk indexed via llvm::md5(FunctionName).
private std::unique_ptr<MemProfFrameHashTable> MemProfFrameTable
MemProf frame profile data on-disk indexed via frame id.
private unsigned int RecordIndex

Inherited from InstrProfReader:

protected Symtab

Method Overview

Inherited from InstrProfReader:

Methods

IndexedInstrProfReader(
    std::unique_ptr<MemoryBuffer> DataBuffer,
    std::unique_ptr<MemoryBuffer>
        RemappingBuffer = nullptr)

Declared at: llvm/include/llvm/ProfileData/InstrProfReader.h:583

Parameters

std::unique_ptr<MemoryBuffer> DataBuffer
std::unique_ptr<MemoryBuffer> RemappingBuffer = nullptr

IndexedInstrProfReader(
    const llvm::IndexedInstrProfReader&)

Declared at: llvm/include/llvm/ProfileData/InstrProfReader.h:588

Parameters

const llvm::IndexedInstrProfReader&

static Expected<
    std::unique_ptr<IndexedInstrProfReader>>
create(std::unique_ptr<MemoryBuffer> Buffer,
       std::unique_ptr<MemoryBuffer>
           RemappingBuffer = nullptr)

Declared at: llvm/include/llvm/ProfileData/InstrProfReader.h:656

Parameters

std::unique_ptr<MemoryBuffer> Buffer
std::unique_ptr<MemoryBuffer> RemappingBuffer = nullptr

static Expected<
    std::unique_ptr<IndexedInstrProfReader>>
create(const llvm::Twine& Path,
       const llvm::Twine& RemappingPath = "")

Description

Factory method to create an indexed reader.

Declared at: llvm/include/llvm/ProfileData/InstrProfReader.h:653

Parameters

const llvm::Twine& Path
const llvm::Twine& RemappingPath = ""

bool functionEntryOnly() const

Description

Return true if the profile only instruments function entries.

Declared at: llvm/include/llvm/ProfileData/InstrProfReader.h:606

llvm::Error getFunctionCounts(
    llvm::StringRef FuncName,
    uint64_t FuncHash,
    std::vector<uint64_t>& Counts)

Description

Fill Counts with the profile data for the given function name.

Declared at: llvm/include/llvm/ProfileData/InstrProfReader.h:636

Parameters

llvm::StringRef FuncName
uint64_t FuncHash
std::vector<uint64_t>& Counts

Expected<llvm::InstrProfRecord>
getInstrProfRecord(
    llvm::StringRef FuncName,
    uint64_t FuncHash,
    uint64_t* MismatchedFuncSum = nullptr)

Description

Return the NamedInstrProfRecord associated with FuncName and FuncHash. When return a hash_mismatch error and MismatchedFuncSum is not nullptr, the sum of all counters in the mismatched function will be set to MismatchedFuncSum. If there are multiple instances of mismatched functions, MismatchedFuncSum returns the maximum.

Declared at: llvm/include/llvm/ProfileData/InstrProfReader.h:628

Parameters

llvm::StringRef FuncName
uint64_t FuncHash
uint64_t* MismatchedFuncSum = nullptr

uint64_t getMaximumFunctionCount(bool UseCS)

Description

Return the maximum of all known function counts.\c UseCS indicates whether to use the context-sensitive count.

Declared at: llvm/include/llvm/ProfileData/InstrProfReader.h:641

Parameters

bool UseCS

Expected<memprof::MemProfRecord> getMemProfRecord(
    uint64_t FuncNameHash)

Description

Return the memprof record for the function identified by llvm::md5(Name).

Declared at: llvm/include/llvm/ProfileData/InstrProfReader.h:633

Parameters

uint64_t FuncNameHash

llvm::InstrProfKind getProfileKind() const

Description

Returns a BitsetEnum describing the attributes of the indexed instr profile.

Declared at: llvm/include/llvm/ProfileData/InstrProfReader.h:610

llvm::ProfileSummary& getSummary(bool UseCS)

Description

Return the profile summary.\c UseCS indicates whether to use the context-sensitive summary.

Declared at: llvm/include/llvm/ProfileData/InstrProfReader.h:671

Parameters

bool UseCS

llvm::InstrProfSymtab& getSymtab()

Description

Return the PGO symtab. There are three different readers: Raw, Text, and Indexed profile readers. The first two types of readers are used only by llvm-profdata tool, while the indexed profile reader is also used by llvm-cov tool and the compiler ( backend or frontend). Since creating PGO symtab can create significant runtime and memory overhead (as it touches data for the whole program), InstrProfSymtab for the indexed profile reader should be created on demand and it is recommended to be only used for dumping purpose with llvm-proftool, not with the compiler.

Declared at: llvm/include/llvm/ProfileData/InstrProfReader.h:667

uint64_t getVersion() const

Description

Return the profile version.

Declared at: llvm/include/llvm/ProfileData/InstrProfReader.h:592

bool hasCSIRLevelProfile() const

Declared at: llvm/include/llvm/ProfileData/InstrProfReader.h:594

static bool hasFormat(
    const llvm::MemoryBuffer& DataBuffer)

Description

Return true if the given buffer is in an indexed instrprof format.

Declared at: llvm/include/llvm/ProfileData/InstrProfReader.h:615

Parameters

const llvm::MemoryBuffer& DataBuffer

bool hasSingleByteCoverage() const

Description

Return true if the profile has single byte counters representing coverage.

Declared at: llvm/include/llvm/ProfileData/InstrProfReader.h:602

bool instrEntryBBEnabled() const

Declared at: llvm/include/llvm/ProfileData/InstrProfReader.h:598

bool isIRLevelProfile() const

Declared at: llvm/include/llvm/ProfileData/InstrProfReader.h:593

llvm::Error readHeader()

Description

Read the file header.

Declared at: llvm/include/llvm/ProfileData/InstrProfReader.h:618

llvm::Error readNextRecord(
    llvm::NamedInstrProfRecord& Record)

Description

Read a single record.

Declared at: llvm/include/llvm/ProfileData/InstrProfReader.h:620

Parameters

llvm::NamedInstrProfRecord& Record

const unsigned char* readSummary(
    IndexedInstrProf::ProfVersion Version,
    const unsigned char* Cur,
    bool UseCS)

Declared at: llvm/include/llvm/ProfileData/InstrProfReader.h:579

Parameters

IndexedInstrProf::ProfVersion Version
const unsigned char* Cur
bool UseCS

void setValueProfDataEndianness(
    support::endianness Endianness)

Declared at: llvm/include/llvm/ProfileData/InstrProfReader.h:660

Parameters

support::endianness Endianness