Thanks to visit codestin.com
Credit goes to llvm.org

LLVM 22.0.0git
llvm::TextInstrProfReader Class Reference

Reader for the simple text based instrprof format. More...

#include "llvm/ProfileData/InstrProfReader.h"

Inheritance diagram for llvm::TextInstrProfReader:
[legend]

Public Member Functions

 TextInstrProfReader (std::unique_ptr< MemoryBuffer > DataBuffer_)
 TextInstrProfReader (const TextInstrProfReader &)=delete
TextInstrProfReaderoperator= (const TextInstrProfReader &)=delete
uint64_t getVersion () const override
 Return the profile version.
bool isIRLevelProfile () const override
bool hasCSIRLevelProfile () const override
bool instrEntryBBEnabled () const override
bool instrLoopEntriesEnabled () const override
 Return true if the profile instruments all loop entries.
bool hasSingleByteCoverage () const override
 Return true if the profile has single byte counters representing coverage.
bool functionEntryOnly () const override
 Return true if the profile only instruments function entries.
bool hasMemoryProfile () const override
 Return true if profile includes a memory profile.
bool hasTemporalProfile () const override
 Return true if this has a temporal profile.
InstrProfKind getProfileKind () const override
 Returns a BitsetEnum describing the attributes of the profile.
Error readHeader () override
 Read the header.
Error readNextRecord (NamedInstrProfRecord &Record) override
 Read a single record.
InstrProfSymtabgetSymtab () override
 Return the PGO symtab.
Public Member Functions inherited from llvm::InstrProfReader
 InstrProfReader ()=default
virtual ~InstrProfReader ()=default
virtual Error readBinaryIds (std::vector< llvm::object::BuildID > &BinaryIds)
 Read a list of binary ids.
virtual Error printBinaryIds (raw_ostream &OS)
 Print binary ids.
InstrProfIterator begin ()
 Iterator over profile data.
InstrProfIterator end ()
LLVM_ABI void accumulateCounts (CountSumOrPercent &Sum, bool IsCS)
 Compute the sum of counts and return in Sum.
bool isEOF ()
 Return true if the reader has finished reading the profile data.
bool hasError ()
 Return true if the reader encountered an error reading profiling data.
Error getError ()
 Get the current error.
virtual SmallVector< TemporalProfTraceTy > & getTemporalProfTraces (std::optional< uint64_t > Weight={})
uint64_t getTemporalProfTraceStreamSize ()

Static Public Member Functions

static bool hasFormat (const MemoryBuffer &Buffer)
 Return true if the given buffer is in text instrprof format.
Static Public Member Functions inherited from llvm::InstrProfReader
static LLVM_ABI Expected< std::unique_ptr< InstrProfReader > > create (const Twine &Path, vfs::FileSystem &FS, const InstrProfCorrelator *Correlator=nullptr, const object::BuildIDFetcher *BIDFetcher=nullptr, const InstrProfCorrelator::ProfCorrelatorKind BIDFetcherCorrelatorKind=InstrProfCorrelator::ProfCorrelatorKind::NONE, std::function< void(Error)> Warn=nullptr)
 Factory method to create an appropriately typed reader for the given instrprof file.
static LLVM_ABI Expected< std::unique_ptr< InstrProfReader > > create (std::unique_ptr< MemoryBuffer > Buffer, const InstrProfCorrelator *Correlator=nullptr, const object::BuildIDFetcher *BIDFetcher=nullptr, const InstrProfCorrelator::ProfCorrelatorKind BIDFetcherCorrelatorKind=InstrProfCorrelator::ProfCorrelatorKind::NONE, std::function< void(Error)> Warn=nullptr)

Additional Inherited Members

Protected Member Functions inherited from llvm::InstrProfReader
Error error (instrprof_error Err, const std::string &ErrMsg="")
 Set the current error and return same.
Error error (Error &&E)
Error success ()
 Clear the current error and return a successful one.
Protected Attributes inherited from llvm::InstrProfReader
std::unique_ptr< InstrProfSymtabSymtab
SmallVector< TemporalProfTraceTyTemporalProfTraces
 A list of temporal profile traces.
uint64_t TemporalProfTraceStreamSize = 0
 The total number of temporal profile traces seen.

Detailed Description

Reader for the simple text based instrprof format.

This format is a simple text format that's suitable for test data. Records are separated by one or more blank lines, and record fields are separated by new lines.

Each record consists of a function name, a function hash, a number of counters, and then each counter value, in that order.

Definition at line 246 of file InstrProfReader.h.

Constructor & Destructor Documentation

◆ TextInstrProfReader() [1/2]

llvm::TextInstrProfReader::TextInstrProfReader ( std::unique_ptr< MemoryBuffer > DataBuffer_)
inline

Definition at line 260 of file InstrProfReader.h.

References llvm::move().

Referenced by operator=(), and TextInstrProfReader().

◆ TextInstrProfReader() [2/2]

llvm::TextInstrProfReader::TextInstrProfReader ( const TextInstrProfReader & )
delete

References TextInstrProfReader().

Member Function Documentation

◆ functionEntryOnly()

bool llvm::TextInstrProfReader::functionEntryOnly ( ) const
inlineoverridevirtual

Return true if the profile only instruments function entries.

Implements llvm::InstrProfReader.

Definition at line 293 of file InstrProfReader.h.

References llvm::FunctionEntryOnly.

◆ getProfileKind()

InstrProfKind llvm::TextInstrProfReader::getProfileKind ( ) const
inlineoverridevirtual

Returns a BitsetEnum describing the attributes of the profile.

To check individual attributes prefer using the helpers above.

Implements llvm::InstrProfReader.

Definition at line 306 of file InstrProfReader.h.

◆ getSymtab()

InstrProfSymtab & llvm::TextInstrProfReader::getSymtab ( )
inlineoverridevirtual

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.

Implements llvm::InstrProfReader.

Definition at line 314 of file InstrProfReader.h.

References assert(), and llvm::InstrProfReader::Symtab.

◆ getVersion()

uint64_t llvm::TextInstrProfReader::getVersion ( ) const
inlineoverridevirtual

Return the profile version.

Implements llvm::InstrProfReader.

Definition at line 269 of file InstrProfReader.h.

◆ hasCSIRLevelProfile()

bool llvm::TextInstrProfReader::hasCSIRLevelProfile ( ) const
inlineoverridevirtual

Implements llvm::InstrProfReader.

Definition at line 275 of file InstrProfReader.h.

References llvm::ContextSensitive.

◆ hasFormat()

bool TextInstrProfReader::hasFormat ( const MemoryBuffer & Buffer)
static

Return true if the given buffer is in text instrprof format.

Definition at line 240 of file InstrProfReader.cpp.

References llvm::StringRef::begin(), llvm::count(), llvm::MemoryBuffer::getBufferSize(), and llvm::MemoryBuffer::getBufferStart().

Referenced by llvm::InstrProfReader::create(), and operator=().

◆ hasMemoryProfile()

bool llvm::TextInstrProfReader::hasMemoryProfile ( ) const
inlineoverridevirtual

Return true if profile includes a memory profile.

Implements llvm::InstrProfReader.

Definition at line 297 of file InstrProfReader.h.

◆ hasSingleByteCoverage()

bool llvm::TextInstrProfReader::hasSingleByteCoverage ( ) const
inlineoverridevirtual

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

Implements llvm::InstrProfReader.

Definition at line 289 of file InstrProfReader.h.

References llvm::SingleByteCoverage.

◆ hasTemporalProfile()

bool llvm::TextInstrProfReader::hasTemporalProfile ( ) const
inlineoverridevirtual

Return true if this has a temporal profile.

Implements llvm::InstrProfReader.

Definition at line 302 of file InstrProfReader.h.

References llvm::TemporalProfile.

◆ instrEntryBBEnabled()

bool llvm::TextInstrProfReader::instrEntryBBEnabled ( ) const
inlineoverridevirtual

Implements llvm::InstrProfReader.

Definition at line 279 of file InstrProfReader.h.

References llvm::FunctionEntryInstrumentation.

◆ instrLoopEntriesEnabled()

bool llvm::TextInstrProfReader::instrLoopEntriesEnabled ( ) const
inlineoverridevirtual

Return true if the profile instruments all loop entries.

Implements llvm::InstrProfReader.

Definition at line 284 of file InstrProfReader.h.

References llvm::LoopEntriesInstrumentation.

◆ isIRLevelProfile()

bool llvm::TextInstrProfReader::isIRLevelProfile ( ) const
inlineoverridevirtual

Implements llvm::InstrProfReader.

Definition at line 271 of file InstrProfReader.h.

References llvm::IRInstrumentation.

◆ operator=()

TextInstrProfReader & llvm::TextInstrProfReader::operator= ( const TextInstrProfReader & )
delete

◆ readHeader()

◆ readNextRecord()

Error TextInstrProfReader::readNextRecord ( NamedInstrProfRecord & Record)
overridevirtual

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