|
LLVM
10.0.0
|
Reader for the indexed binary instrprof format. More...
#include "llvm/ProfileData/InstrProfReader.h"
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 |
| Return the profile version. More... | |
| bool | isIRLevelProfile () const override |
| bool | hasCSIRLevelProfile () const override |
| Error | readHeader () override |
| Read the file header. More... | |
| Error | readNextRecord (NamedInstrProfRecord &Record) override |
| Read a single record. More... | |
| Expected< InstrProfRecord > | getInstrProfRecord (StringRef FuncName, uint64_t FuncHash) |
| Return the NamedInstrProfRecord associated with FuncName and FuncHash. More... | |
| Error | getFunctionCounts (StringRef FuncName, uint64_t FuncHash, std::vector< uint64_t > &Counts) |
| Fill Counts with the profile data for the given function name. More... | |
| uint64_t | getMaximumFunctionCount (bool UseCS) |
| Return the maximum of all known function counts. More... | |
| void | setValueProfDataEndianness (support::endianness Endianness) |
| InstrProfSymtab & | getSymtab () override |
| Return the PGO symtab. More... | |
| ProfileSummary & | getSummary (bool UseCS) |
| Return the profile summary. More... | |
Public Member Functions inherited from llvm::InstrProfReader | |
| InstrProfReader ()=default | |
| virtual | ~InstrProfReader ()=default |
| InstrProfIterator | begin () |
| Iterator over profile data. More... | |
| InstrProfIterator | end () |
| void | accumulateCounts (CountSumOrPercent &Sum, bool IsCS) |
| Compute the sum of counts and return in Sum. More... | |
| bool | isEOF () |
| Return true if the reader has finished reading the profile data. More... | |
| bool | hasError () |
| Return true if the reader encountered an error reading profiling data. More... | |
| Error | getError () |
| Get the current error. More... | |
Static Public Member Functions | |
| static bool | hasFormat (const MemoryBuffer &DataBuffer) |
| Return true if the given buffer is in an indexed instrprof format. More... | |
| static Expected< std::unique_ptr< IndexedInstrProfReader > > | create (const Twine &Path, const Twine &RemappingPath="") |
| Factory method to create an indexed reader. More... | |
| 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 Expected< std::unique_ptr< InstrProfReader > > | create (const Twine &Path) |
| Factory method to create an appropriately typed reader for the given instrprof file. More... | |
| static Expected< std::unique_ptr< InstrProfReader > > | create (std::unique_ptr< MemoryBuffer > Buffer) |
Additional Inherited Members | |
Protected Member Functions inherited from llvm::InstrProfReader | |
| Error | error (instrprof_error Err) |
| Set the current error and return same. More... | |
| Error | error (Error &&E) |
| Error | success () |
| Clear the current error and return a successful one. More... | |
Protected Attributes inherited from llvm::InstrProfReader | |
| std::unique_ptr< InstrProfSymtab > | Symtab |
Reader for the indexed binary instrprof format.
Definition at line 426 of file InstrProfReader.h.
|
inline |
Definition at line 450 of file InstrProfReader.h.
|
delete |
|
static |
Factory method to create an indexed reader.
Definition at line 92 of file InstrProfReader.cpp.
References E, setupMemoryBuffer(), and llvm::Twine::str().
Referenced by annotateAllFunctions(), and llvm::coverage::CoverageMapping::load().
|
static |
Definition at line 113 of file InstrProfReader.cpp.
References llvm::bad_magic, E, hasFormat(), initializeReader(), llvm::max(), llvm::InstrProfError::take(), and llvm::too_large.
| Error IndexedInstrProfReader::getFunctionCounts | ( | StringRef | FuncName, |
| uint64_t | FuncHash, | ||
| std::vector< uint64_t > & | Counts | ||
| ) |
Fill Counts with the profile data for the given function name.
Definition at line 888 of file InstrProfReader.cpp.
References E, llvm::InstrProfReader::error(), llvm::Expected< T >::get(), llvm::InstrProfReader::success(), and llvm::Expected< T >::takeError().
Referenced by llvm::coverage::CounterMappingContext::evaluate().
| Expected< InstrProfRecord > IndexedInstrProfReader::getInstrProfRecord | ( | StringRef | FuncName, |
| uint64_t | FuncHash | ||
| ) |
Return the NamedInstrProfRecord associated with FuncName and FuncHash.
Definition at line 872 of file InstrProfReader.cpp.
References llvm::Data.
Referenced by sumEdgeCount().
|
inline |
Return the maximum of all known function counts.
UseCS indicates whether to use the context-sensitive count.
Definition at line 483 of file InstrProfReader.h.
References assert().
|
inline |
Return the profile summary.
UseCS indicates whether to use the context-sensitive summary.
Definition at line 513 of file InstrProfReader.h.
References assert().
|
overridevirtual |
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 858 of file InstrProfReader.cpp.
References llvm::consumeError(), E, llvm::InstrProfReader::error(), and llvm::InstrProfError::take().
|
inline |
Return the profile version.
Definition at line 459 of file InstrProfReader.h.
|
inlineoverridevirtual |
Implements llvm::InstrProfReader.
Definition at line 461 of file InstrProfReader.h.
|
static |
Return true if the given buffer is in an indexed instrprof format.
Definition at line 736 of file InstrProfReader.cpp.
References llvm::IndexedInstrProf::allocSummary(), llvm::IndexedInstrProf::Summary::Entry::Cutoff, llvm::ProfileSummaryBuilder::DefaultCutoffs, llvm::MemoryBuffer::getBufferSize(), llvm::MemoryBuffer::getBufferStart(), llvm::IndexedInstrProf::Summary::getSize(), llvm::InstrProfSummaryBuilder::getSummary(), I, Magic, llvm::IndexedInstrProf::Magic, llvm::IndexedInstrProf::Summary::Entry::MinBlockCount, llvm::IndexedInstrProf::Summary::Entry::NumBlocks, llvm::IndexedInstrProf::Summary::NumCutoffEntries, llvm::IndexedInstrProf::Summary::NumSummaryFields, llvm::ProfileSummary::PSK_CSInstr, llvm::ProfileSummary::PSK_Instr, llvm::IndexedInstrProf::Version, and llvm::IndexedInstrProf::Version4.
Referenced by llvm::InstrProfReader::create(), and create().
|
inlineoverridevirtual |
Implements llvm::InstrProfReader.
Definition at line 460 of file InstrProfReader.h.
|
delete |
|
overridevirtual |
Read the file header.
Implements llvm::InstrProfReader.
Definition at line 801 of file InstrProfReader.cpp.
|
overridevirtual |
Read a single record.
Implements llvm::InstrProfReader.
Definition at line 899 of file InstrProfReader.cpp.
References llvm::Data, E, llvm::InstrProfReader::error(), llvm::ArrayRef< T >::size(), and llvm::InstrProfReader::success().
|
inline |
Definition at line 502 of file InstrProfReader.h.
1.8.13