LLVM: llvm::IndexedInstrProfReader Class Reference (original) (raw)

Reader for the indexed binary instrprof format. More...

#include "[llvm/ProfileData/InstrProfReader.h](InstrProfReader%5F8h%5Fsource.html)"

Public Member Functions
IndexedInstrProfReader (std::unique_ptr< MemoryBuffer > DataBuffer, std::unique_ptr< MemoryBuffer > RemappingBuffer=nullptr)
IndexedInstrProfReader (const IndexedInstrProfReader &)=delete
IndexedInstrProfReader & operator= (const IndexedInstrProfReader &)=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 indexed instr profile.
Error readHeader () override
Read the file header.
Error readNextRecord (NamedInstrProfRecord &Record) override
Read a single record.
Expected< NamedInstrProfRecord > getInstrProfRecord (StringRef FuncName, uint64_t FuncHash, StringRef DeprecatedFuncName="", uint64_t *MismatchedFuncSum=nullptr)
Return the NamedInstrProfRecord associated with FuncName and FuncHash.
Expected< memprof::MemProfRecord > getMemProfRecord (uint64_t FuncNameHash)
Return the memprof record for the function identified by llvm::md5(Name).
DenseMap< uint64_t, SmallVector< memprof::CallEdgeTy, 0 > > getMemProfCallerCalleePairs ()
memprof::AllMemProfData getAllMemProfData () const
Error getFunctionCounts (StringRef FuncName, uint64_t FuncHash, std::vector< uint64_t > &Counts)
Fill Counts with the profile data for the given function name.
Error getFunctionBitmap (StringRef FuncName, uint64_t FuncHash, BitVector &Bitmap)
Fill Bitmap with the profile data for the given function name.
uint64_t getMaximumFunctionCount (bool UseCS)
Return the maximum of all known function counts.
void setValueProfDataEndianness (llvm::endianness Endianness)
InstrProfSymtab & getSymtab () override
Return the PGO symtab.
ProfileSummary & getSummary (bool UseCS)
Return the profile summary.
memprof::MemProfSummary * getMemProfSummary () const
Return the MemProf summary. Will be null if unavailable (version < 4).
memprof::DataAccessProfData * getDataAccessProfileData () const
Returns non-owned pointer to the data access profile data.
Error readBinaryIds (std::vector< llvm::object::BuildID > &BinaryIds) override
Read a list of binary ids.
Error printBinaryIds (raw_ostream &OS) override
Print binary ids.
Public Member Functions inherited from llvm::InstrProfReader
InstrProfReader ()=default
virtual ~InstrProfReader ()=default
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 &DataBuffer)
Return true if the given buffer is in an indexed instrprof format.
static Expected< std::unique_ptr< IndexedInstrProfReader > > create (const Twine &Path, vfs::FileSystem &FS, const Twine &RemappingPath="")
Factory method to create an indexed reader.
static Expected< std::unique_ptr< IndexedInstrProfReader > > create (std::unique_ptr< MemoryBuffer > Buffer, std::unique_ptr< MemoryBuffer > RemappingBuffer=nullptr)
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< InstrProfSymtab > Symtab
SmallVector< TemporalProfTraceTy > TemporalProfTraces
A list of temporal profile traces.
uint64_t TemporalProfTraceStreamSize = 0
The total number of temporal profile traces seen.

Reader for the indexed binary instrprof format.

Definition at line 744 of file InstrProfReader.h.

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

IndexedInstrProfReader() [2/2]

create() [1/2]

create() [2/2]

functionEntryOnly()

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

getAllMemProfData()

getDataAccessProfileData()

Returns non-owned pointer to the data access profile data.

Will be null if unavailable (version < 4).

Definition at line 910 of file InstrProfReader.h.

getFunctionBitmap()

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

Definition at line 1583 of file InstrProfReader.cpp.

References llvm::BitVector::apply(), assert(), error, llvm::FuncHash, getInstrProfRecord(), I, llvm::little, N, llvm::support::endian::read(), llvm::BitVector::resize(), llvm::InstrProfReader::success(), and X.

getFunctionCounts()

getInstrProfRecord()

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. If FuncName is not found, try to lookup DeprecatedFuncName to handle profiles built by older compilers.

Definition at line 1372 of file InstrProfReader.cpp.

References llvm::Data, error, llvm::FuncHash, llvm::handleErrors(), llvm::NamedInstrProfRecord::hasCSFlagInHash(), llvm::hash_mismatch, I, llvm::make_error(), llvm::Error::success(), and llvm::unknown_function.

Referenced by getFunctionBitmap(), and getFunctionCounts().

getMaximumFunctionCount()

uint64_t llvm::IndexedInstrProfReader::getMaximumFunctionCount ( bool UseCS) inline

Return the maximum of all known function counts.

UseCS indicates whether to use the context-sensitive count.

Definition at line 862 of file InstrProfReader.h.

References assert().

getMemProfCallerCalleePairs()

getMemProfRecord()

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

Definition at line 839 of file InstrProfReader.h.

getMemProfSummary()

Return the MemProf summary. Will be null if unavailable (version < 4).

Definition at line 904 of file InstrProfReader.h.

getProfileKind()

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

getSummary()

Return the profile summary.

UseCS indicates whether to use the context-sensitive summary.

Definition at line 893 of file InstrProfReader.h.

References assert().

getSymtab()

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 1351 of file InstrProfReader.cpp.

References llvm::consumeError(), error, llvm::InstrProfReader::Symtab, and llvm::InstrProfError::take().

getVersion()

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

hasCSIRLevelProfile()

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

hasFormat()

hasMemoryProfile()

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

hasSingleByteCoverage()

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

hasTemporalProfile()

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

instrEntryBBEnabled()

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

instrLoopEntriesEnabled()

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

isIRLevelProfile()

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

operator=()

printBinaryIds()

Error IndexedInstrProfReader::printBinaryIds ( raw_ostream & OS) overridevirtual

readBinaryIds()

readHeader()

Error IndexedInstrProfReader::readHeader ( ) overridevirtual

Read the file header.

Implements llvm::InstrProfReader.

Definition at line 1234 of file InstrProfReader.cpp.

References llvm::bad_header, error, llvm::IndexedInstrProf::Last, llvm::make_error(), llvm::malformed, llvm::IndexedInstrProf::Header::readFromBuffer(), llvm::support::endian::readNext(), llvm::IndexedInstrProf::Header::size(), llvm::InstrProfReader::success(), llvm::InstrProfReader::TemporalProfTraces, llvm::InstrProfReader::TemporalProfTraceStreamSize, llvm::truncated, llvm::unsupported_hash_type, VARIANT_MASK_CSIR_PROF, VARIANT_MASK_MEMPROF, and VARIANT_MASK_TEMPORAL_PROF.

readNextRecord()

setValueProfDataEndianness()

void llvm::IndexedInstrProfReader::setValueProfDataEndianness ( llvm::endianness Endianness) inline

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