|
LLVM
4.0.0
|
Reader for the indexed binary instrprof format. More...
#include <InstrProfReader.h>
Public Member Functions | |
| uint64_t | getVersion () const |
| Return the profile version. More... | |
| bool | isIRLevelProfile () const override |
| IndexedInstrProfReader (std::unique_ptr< MemoryBuffer > DataBuffer) | |
| Error | readHeader () override |
| Read the file header. More... | |
| Error | readNextRecord (InstrProfRecord &Record) override |
| Read a single record. More... | |
| Expected< InstrProfRecord > | getInstrProfRecord (StringRef FuncName, uint64_t FuncHash) |
| Return the pointer to InstrProfRecord 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 () |
| Return the maximum of all known function counts. More... | |
| void | setValueProfDataEndianness (support::endianness Endianness) |
| InstrProfSymtab & | getSymtab () override |
| Return the PGO symtab. More... | |
| ProfileSummary & | getSummary () |
Public Member Functions inherited from llvm::InstrProfReader | |
| InstrProfReader () | |
| virtual | ~InstrProfReader () |
| InstrProfIterator | begin () |
| Iterator over profile data. More... | |
| InstrProfIterator | end () |
| 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) |
| Factory method to create an indexed reader. More... | |
| static Expected < std::unique_ptr < IndexedInstrProfReader > > | create (std::unique_ptr< MemoryBuffer > Buffer) |
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 360 of file InstrProfReader.h.
|
inline |
Definition at line 381 of file InstrProfReader.h.
|
static |
Factory method to create an indexed reader.
Definition at line 73 of file InstrProfReader.cpp.
References E, and setupMemoryBuffer().
Referenced by annotateAllFunctions(), and llvm::coverage::CoverageMapping::load().
|
static |
Definition at line 83 of file InstrProfReader.cpp.
References llvm::bad_magic, E, hasFormat(), initializeReader(), 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 697 of file InstrProfReader.cpp.
References E, error(), llvm::Expected< T >::get(), llvm::success, and llvm::Expected< T >::takeError().
| Expected< InstrProfRecord > IndexedInstrProfReader::getInstrProfRecord | ( | StringRef | FuncName, |
| uint64_t | FuncHash | ||
| ) |
Return the pointer to InstrProfRecord associated with FuncName and FuncHash.
Definition at line 681 of file InstrProfReader.cpp.
References E, error(), fuzzer::Hash(), llvm::hash_mismatch, I, and llvm::ArrayRef< T >::size().
|
inline |
Return the maximum of all known function counts.
Definition at line 402 of file InstrProfReader.h.
|
inline |
Definition at line 420 of file InstrProfReader.h.
|
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 669 of file InstrProfReader.cpp.
|
inline |
Return the profile version.
Definition at line 379 of file InstrProfReader.h.
|
static |
Return true if the given buffer is in an indexed instrprof format.
Definition at line 569 of file InstrProfReader.cpp.
References llvm::MemoryBuffer::getBufferSize(), llvm::MemoryBuffer::getBufferStart(), and llvm::IndexedInstrProf::Magic.
Referenced by llvm::InstrProfReader::create(), and create().
|
inlineoverridevirtual |
Implements llvm::InstrProfReader.
Definition at line 380 of file InstrProfReader.h.
|
overridevirtual |
Read the file header.
Implements llvm::InstrProfReader.
Definition at line 628 of file InstrProfReader.cpp.
References llvm::bad_magic, llvm::coverage::CurrentVersion, error(), llvm::IndexedInstrProf::Last, llvm::IndexedInstrProf::Magic, llvm::success, llvm::truncated, llvm::unsupported_hash_type, and llvm::unsupported_version.
|
overridevirtual |
Read a single record.
Implements llvm::InstrProfReader.
Definition at line 708 of file InstrProfReader.cpp.
References E, error(), llvm::ArrayRef< T >::size(), and llvm::success.
|
inline |
Definition at line 412 of file InstrProfReader.h.
1.8.6