|
LLVM
5.0.0
|
#include "llvm/ProfileData/SampleProfReader.h"
Public Member Functions | |
| SampleProfileReaderBinary (std::unique_ptr< MemoryBuffer > B, LLVMContext &C) | |
| std::error_code | readHeader () override |
| Read and validate the file header. More... | |
| std::error_code | read () override |
| Read sample profiles from the associated file. More... | |
Public Member Functions inherited from llvm::sampleprof::SampleProfileReader | |
| SampleProfileReader (std::unique_ptr< MemoryBuffer > B, LLVMContext &C) | |
| virtual | ~SampleProfileReader ()=default |
| void | dumpFunctionProfile (StringRef FName, raw_ostream &OS=dbgs()) |
Print the profile for FName on stream OS. More... | |
| void | dump (raw_ostream &OS=dbgs()) |
Print all the profiles on stream OS. More... | |
| FunctionSamples * | getSamplesFor (const Function &F) |
Return the samples collected for function F. More... | |
| StringMap< FunctionSamples > & | getProfiles () |
| Return all the profiles. More... | |
| void | reportError (int64_t LineNumber, Twine Msg) const |
| Report a parse error message. More... | |
| ProfileSummary & | getSummary () |
| Return the profile summary. More... | |
Static Public Member Functions | |
| static bool | hasFormat (const MemoryBuffer &Buffer) |
Return true if Buffer is in the format supported by this class. More... | |
Static Public Member Functions inherited from llvm::sampleprof::SampleProfileReader | |
| static ErrorOr < std::unique_ptr < SampleProfileReader > > | create (const Twine &Filename, LLVMContext &C) |
| Create a sample profile reader appropriate to the file format. More... | |
| static ErrorOr < std::unique_ptr < SampleProfileReader > > | create (std::unique_ptr< MemoryBuffer > &B, LLVMContext &C) |
| Create a sample profile reader from the supplied memory buffer. More... | |
Protected Member Functions | |
| template<typename T > | |
| ErrorOr< T > | readNumber () |
| Read a numeric value of type T from the profile. More... | |
| ErrorOr< StringRef > | readString () |
| Read a string from the profile. More... | |
| ErrorOr< StringRef > | readStringFromTable () |
| Read a string indirectly via the name table. More... | |
| bool | at_eof () const |
| Return true if we've reached the end of file. More... | |
| std::error_code | readProfile (FunctionSamples &FProfile) |
| Read the contents of the given profile instance. More... | |
Protected Member Functions inherited from llvm::sampleprof::SampleProfileReader | |
| void | computeSummary () |
| Compute summary for this profile. More... | |
Protected Attributes | |
| const uint8_t * | Data = nullptr |
| Points to the current location in the buffer. More... | |
| const uint8_t * | End = nullptr |
| Points to the end of the buffer. More... | |
| std::vector< StringRef > | NameTable |
| Function name table. More... | |
Protected Attributes inherited from llvm::sampleprof::SampleProfileReader | |
| StringMap< FunctionSamples > | Profiles |
| Map every function to its associated profile. More... | |
| LLVMContext & | Ctx |
| LLVM context used to emit diagnostics. More... | |
| std::unique_ptr< MemoryBuffer > | Buffer |
| Memory buffer holding the profile file. More... | |
| std::unique_ptr< ProfileSummary > | Summary |
| Profile summary information. More... | |
Definition at line 350 of file SampleProfReader.h.
|
inline |
Definition at line 352 of file SampleProfReader.h.
|
inlineprotected |
Return true if we've reached the end of file.
Definition at line 385 of file SampleProfReader.h.
Referenced by read().
|
static |
Return true if Buffer is in the format supported by this class.
Definition at line 491 of file SampleProfReader.cpp.
References Data, llvm::decodeULEB128(), llvm::MemoryBuffer::getBufferStart(), Magic, and llvm::sampleprof::SPMagic().
Referenced by llvm::sampleprof::SampleProfileReader::create().
|
overridevirtual |
Read sample profiles from the associated file.
Implements llvm::sampleprof::SampleProfileReader.
Definition at line 376 of file SampleProfReader.cpp.
References llvm::sampleprof::FunctionSamples::addHeadSamples(), at_eof(), llvm::sampleprof::SampleProfileReader::Profiles, readProfile(), readStringFromTable(), llvm::sampleprof::FunctionSamples::setName(), and llvm::success.
|
overridevirtual |
Read and validate the file header.
Implements llvm::sampleprof::SampleProfileReader.
Definition at line 399 of file SampleProfReader.cpp.
References llvm::bad_magic, llvm::sampleprof::SampleProfileReader::Buffer, Data, End, I, Magic, Name, NameTable, readString(), llvm::AMDGPU::CodeObject::Kernel::Arg::Key::Size, llvm::sampleprof::SPMagic(), llvm::sampleprof::SPVersion(), llvm::success, llvm::unsupported_version, and llvm::IndexedInstrProf::Version.
Read a numeric value of type T from the profile.
If an error occurs during decoding, a diagnostic message is emitted and EC is set.
Definition at line 255 of file SampleProfReader.cpp.
References Data, llvm::decodeULEB128(), End, llvm::malformed, llvm::max(), llvm::sampleprof::SampleProfileReader::reportError(), llvm::success, and llvm::truncated.
|
protected |
Read the contents of the given profile instance.
Definition at line 300 of file SampleProfReader.cpp.
References llvm::sampleprof::FunctionSamples::addBodySamples(), llvm::sampleprof::FunctionSamples::addCalledTargetSamples(), llvm::sampleprof::FunctionSamples::addTotalSamples(), llvm::sampleprof::FunctionSamples::functionSamplesAt(), I, isOffsetLegal(), readStringFromTable(), llvm::sampleprof::FunctionSamples::setName(), and llvm::success.
Referenced by read().
Read a string from the profile.
If an error occurs during decoding, a diagnostic message is emitted and EC is set.
Definition at line 276 of file SampleProfReader.cpp.
References Data, End, llvm::sampleprof::SampleProfileReader::reportError(), llvm::StringRef::size(), and llvm::truncated.
Referenced by readHeader().
Read a string indirectly via the name table.
Definition at line 289 of file SampleProfReader.cpp.
References NameTable, and llvm::truncated_name_table.
Referenced by read(), and readProfile().
|
protected |
Points to the current location in the buffer.
Definition at line 391 of file SampleProfReader.h.
Referenced by at_eof(), hasFormat(), readHeader(), readNumber(), and readString().
|
protected |
Points to the end of the buffer.
Definition at line 394 of file SampleProfReader.h.
Referenced by at_eof(), readHeader(), readNumber(), and readString().
|
protected |
Function name table.
Definition at line 397 of file SampleProfReader.h.
Referenced by readHeader(), and readStringFromTable().
1.8.6