LLVM
8.0.1
|
Base class and interface for reading profiling data of any known instrprof format. More...
#include "llvm/ProfileData/InstrProfReader.h"
Public Member Functions | |
InstrProfReader ()=default | |
virtual | ~InstrProfReader ()=default |
virtual Error | readHeader ()=0 |
Read the header. Required before reading first record. More... | |
virtual Error | readNextRecord (NamedInstrProfRecord &Record)=0 |
Read a single record. More... | |
InstrProfIterator | begin () |
Iterator over profile data. More... | |
InstrProfIterator | end () |
virtual bool | isIRLevelProfile () const =0 |
virtual InstrProfSymtab & | getSymtab ()=0 |
Return the PGO symtab. 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 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) |
Protected Member Functions | |
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 | |
std::unique_ptr< InstrProfSymtab > | Symtab |
Base class and interface for reading profiling data of any known instrprof format.
Provides an iterator over NamedInstrProfRecords.
Definition at line 62 of file InstrProfReader.h.
|
default |
|
virtualdefault |
|
inline |
Iterator over profile data.
Definition at line 76 of file InstrProfReader.h.
References llvm::InstrProfIterator::InstrProfIterator().
|
static |
Factory method to create an appropriately typed reader for the given instrprof file.
Definition at line 55 of file InstrProfReader.cpp.
References E, and setupMemoryBuffer().
|
static |
Definition at line 64 of file InstrProfReader.cpp.
References E, llvm::empty_raw_profile, llvm::TextInstrProfReader::hasFormat(), llvm::RawInstrProfReader< IntPtrT >::hasFormat(), llvm::IndexedInstrProfReader::hasFormat(), initializeReader(), llvm::max(), llvm::too_large, and llvm::unrecognized_format.
|
inline |
Definition at line 77 of file InstrProfReader.h.
References llvm::InstrProfIterator::InstrProfIterator().
|
inlineprotected |
Set the current error and return same.
Definition at line 97 of file InstrProfReader.h.
Referenced by llvm::IndexedInstrProfReader::getFunctionCounts(), llvm::IndexedInstrProfReader::getSymtab(), llvm::TextInstrProfReader::readHeader(), llvm::RawInstrProfReader< IntPtrT >::readHeader(), llvm::TextInstrProfReader::readNextRecord(), llvm::RawInstrProfReader< IntPtrT >::readNextRecord(), and llvm::IndexedInstrProfReader::readNextRecord().
Definition at line 104 of file InstrProfReader.h.
References E, error(), and llvm::InstrProfError::take().
Referenced by error().
|
inline |
Get the current error.
Definition at line 117 of file InstrProfReader.h.
References llvm::Error::success().
|
pure virtual |
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.
Implemented in llvm::IndexedInstrProfReader, llvm::RawInstrProfReader< IntPtrT >, and llvm::TextInstrProfReader.
|
inline |
Return true if the reader encountered an error reading profiling data.
Definition at line 114 of file InstrProfReader.h.
References llvm::success.
|
inline |
Return true if the reader has finished reading the profile data.
Definition at line 111 of file InstrProfReader.h.
References llvm::eof.
|
pure virtual |
Implemented in llvm::IndexedInstrProfReader, llvm::RawInstrProfReader< IntPtrT >, and llvm::TextInstrProfReader.
|
pure virtual |
Read the header. Required before reading first record.
Implemented in llvm::IndexedInstrProfReader, llvm::RawInstrProfReader< IntPtrT >, and llvm::TextInstrProfReader.
Referenced by initializeReader(), and llvm::RawInstrProfReader< IntPtrT >::readHeader().
|
pure virtual |
Read a single record.
Implemented in llvm::IndexedInstrProfReader, llvm::RawInstrProfReader< IntPtrT >, and llvm::TextInstrProfReader.
|
inlineprotected |
Clear the current error and return a successful one.
Definition at line 107 of file InstrProfReader.h.
References error, and llvm::success.
Referenced by llvm::IndexedInstrProfReader::getFunctionCounts(), llvm::TextInstrProfReader::readHeader(), llvm::TextInstrProfReader::readNextRecord(), llvm::RawInstrProfReader< IntPtrT >::readNextRecord(), and llvm::IndexedInstrProfReader::readNextRecord().
|
protected |
Definition at line 94 of file InstrProfReader.h.
Referenced by llvm::TextInstrProfReader::readHeader(), and llvm::TextInstrProfReader::readNextRecord().