LLVM
15.0.0git
|
Reader for the simple text based instrprof format. More...
#include "llvm/ProfileData/InstrProfReader.h"
Public Member Functions | |
TextInstrProfReader (std::unique_ptr< MemoryBuffer > DataBuffer_) | |
TextInstrProfReader (const TextInstrProfReader &)=delete | |
TextInstrProfReader & | operator= (const TextInstrProfReader &)=delete |
bool | isIRLevelProfile () const override |
bool | hasCSIRLevelProfile () const override |
bool | instrEntryBBEnabled () const override |
bool | hasSingleByteCoverage () const override |
Return true if the profile has single byte counters representing coverage. More... | |
bool | functionEntryOnly () const override |
Return true if the profile only instruments function entries. More... | |
InstrProfKind | getProfileKind () const override |
Returns a BitsetEnum describing the attributes of the profile. More... | |
Error | readHeader () override |
Read the header. More... | |
Error | readNextRecord (NamedInstrProfRecord &Record) override |
Read a single record. More... | |
InstrProfSymtab & | getSymtab () override |
Return the PGO symtab. More... | |
![]() | |
InstrProfReader ()=default | |
virtual | ~InstrProfReader ()=default |
virtual Error | printBinaryIds (raw_ostream &OS) |
Print binary ids on stream OS. More... | |
InstrProfIterator | begin () |
Iterator over profile data. More... | |
InstrProfIterator | end () |
virtual bool | useDebugInfoCorrelate () const |
Return true if we must provide debug info to create PGO profiles. More... | |
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 &Buffer) |
Return true if the given buffer is in text instrprof format. More... | |
![]() | |
static Expected< std::unique_ptr< InstrProfReader > > | create (const Twine &Path, const InstrProfCorrelator *Correlator=nullptr) |
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, const InstrProfCorrelator *Correlator=nullptr) |
Additional Inherited Members | |
![]() | |
Error | error (instrprof_error Err, const std::string &ErrMsg="") |
Set the current error and return same. More... | |
Error | error (Error &&E) |
Error | success () |
Clear the current error and return a successful one. More... | |
![]() | |
std::unique_ptr< InstrProfSymtab > | Symtab |
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 195 of file InstrProfReader.h.
|
inline |
Definition at line 207 of file InstrProfReader.h.
|
delete |
|
inlineoverridevirtual |
Return true if the profile only instruments function entries.
Implements llvm::InstrProfReader.
Definition at line 232 of file InstrProfReader.h.
References llvm::FunctionEntryOnly.
|
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 236 of file InstrProfReader.h.
|
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 244 of file InstrProfReader.h.
References assert(), and llvm::InstrProfReader::Symtab.
|
inlineoverridevirtual |
Implements llvm::InstrProfReader.
Definition at line 219 of file InstrProfReader.h.
References llvm::ContextSensitive.
|
static |
Return true if the given buffer is in text instrprof format.
Definition at line 158 of file InstrProfReader.cpp.
References llvm::all_of(), llvm::StringRef::begin(), c, llvm::count(), llvm::MemoryBuffer::getBufferSize(), llvm::MemoryBuffer::getBufferStart(), and llvm::min().
Referenced by llvm::InstrProfReader::create().
|
inlineoverridevirtual |
Return true if the profile has single byte counters representing coverage.
Implements llvm::InstrProfReader.
Definition at line 228 of file InstrProfReader.h.
References llvm::SingleByteCoverage.
|
inlineoverridevirtual |
Implements llvm::InstrProfReader.
Definition at line 223 of file InstrProfReader.h.
References llvm::FunctionEntryInstrumentation.
|
inlineoverridevirtual |
Implements llvm::InstrProfReader.
Definition at line 215 of file InstrProfReader.h.
References llvm::IRInstrumentation.
|
delete |
|
overridevirtual |
Read the header.
Implements llvm::InstrProfReader.
Definition at line 171 of file InstrProfReader.cpp.
References llvm::bad_header, llvm::ContextSensitive, llvm::InstrProfReader::error(), llvm::FrontendInstrumentation, llvm::FunctionEntryInstrumentation, llvm::IRInstrumentation, llvm::StringRef::startswith(), llvm::StringRef::substr(), llvm::InstrProfReader::success(), and llvm::InstrProfReader::Symtab.
|
overridevirtual |
Read a single record.
Implements llvm::InstrProfReader.
Definition at line 266 of file InstrProfReader.cpp.
References E, llvm::StringRef::empty(), llvm::eof, llvm::InstrProfReader::error(), I, llvm::line_iterator::is_at_end(), llvm::malformed, move, llvm::StringRef::startswith(), llvm::InstrProfReader::success(), llvm::InstrProfReader::Symtab, and llvm::truncated.