class InstrProfReader

Declaration

class InstrProfReader { /* full declaration omitted */ };

Description

Base class and interface for reading profiling data of any known instrprof format. Provides an iterator over NamedInstrProfRecords.

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

Member Variables

private llvm::instrprof_error LastError = instrprof_error::success
private std::string LastErrorMsg
protected std::unique_ptr<InstrProfSymtab> Symtab

Method Overview

Methods

InstrProfReader()

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

void accumulateCounts(
    llvm::CountSumOrPercent& Sum,
    bool IsCS)

Description

Compute the sum of counts and return in Sum.

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

Parameters

llvm::CountSumOrPercent& Sum
bool IsCS

InstrProfIterator<> begin()

Description

Iterator over profile data.

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

static Expected<std::unique_ptr<InstrProfReader>>
create(std::unique_ptr<MemoryBuffer> Buffer,
       const llvm::InstrProfCorrelator*
           Correlator = nullptr)

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

Parameters

std::unique_ptr<MemoryBuffer> Buffer
const llvm::InstrProfCorrelator* Correlator = nullptr

static Expected<std::unique_ptr<InstrProfReader>>
create(const llvm::Twine& Path,
       const llvm::InstrProfCorrelator*
           Correlator = nullptr)

Description

Factory method to create an appropriately typed reader for the given instrprof file.

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

Parameters

const llvm::Twine& Path
const llvm::InstrProfCorrelator* Correlator = nullptr

InstrProfIterator<> end()

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

llvm::Error error(llvm::Error&& E)

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

Parameters

llvm::Error&& E

llvm::Error error(llvm::instrprof_error Err,
                  const std::string& ErrMsg = "")

Description

Set the current error and return same.

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

Parameters

llvm::instrprof_error Err
const std::string& ErrMsg = ""

virtual bool functionEntryOnly() const

Description

Return true if the profile only instruments function entries.

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

llvm::Error getError()

Description

Get the current error.

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

virtual llvm::InstrProfKind getProfileKind() const

Description

Returns a BitsetEnum describing the attributes of the profile. To check individual attributes prefer using the helpers above.

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

virtual 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:135

virtual bool hasCSIRLevelProfile() const

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

bool hasError()

Description

Return true if the reader encountered an error reading profiling data.

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

virtual bool hasSingleByteCoverage() const

Description

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

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

virtual bool instrEntryBBEnabled() const

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

bool isEOF()

Description

Return true if the reader has finished reading the profile data.

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

virtual bool isIRLevelProfile() const

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

virtual llvm::Error printBinaryIds(
    llvm::raw_ostream& OS)

Description

Print binary ids on stream OS.

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

Parameters

llvm::raw_ostream& OS

virtual llvm::Error readHeader()

Description

Read the header. Required before reading first record.

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

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

Description

Read a single record.

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

Parameters

llvm::NamedInstrProfRecord& Record

llvm::Error success()

Description

Clear the current error and return a successful one.

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

virtual bool useDebugInfoCorrelate() const

Description

Return true if we must provide debug info to create PGO profiles.

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

virtual ~InstrProfReader()

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