LLVM
8.0.1
|
#include "llvm/ProfileData/SampleProfReader.h"
Public Member Functions | |
SampleProfileReaderGCC (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, SampleProfileFormat Format=SPF_None) | |
virtual | ~SampleProfileReader ()=default |
void | dumpFunctionProfile (StringRef FName, raw_ostream &OS=dbgs()) |
Print the profile for FName on stream OS . More... | |
virtual void | collectFuncsToUse (const Module &M) |
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... | |
virtual FunctionSamples * | getSamplesFor (StringRef Fname) |
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... | |
SampleProfileFormat | getFormat () |
Return the profile format. 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 | |
std::error_code | readNameTable () |
std::error_code | readOneFunctionProfile (const InlineCallStack &InlineStack, bool Update, uint32_t Offset) |
std::error_code | readFunctionProfiles () |
std::error_code | skipNextWord () |
template<typename T > | |
ErrorOr< T > | readNumber () |
ErrorOr< StringRef > | readString () |
std::error_code | readSectionTag (uint32_t Expected) |
Read the section tag and check that it's the same as Expected . More... | |
Protected Member Functions inherited from llvm::sampleprof::SampleProfileReader | |
void | computeSummary () |
Compute summary for this profile. More... | |
Protected Attributes | |
GCOVBuffer | GcovBuffer |
GCOV buffer containing the profile. More... | |
std::vector< std::string > | Names |
Function names in this profile. 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... | |
SampleProfileFormat | Format = SPF_None |
The format of sample. More... | |
Static Protected Attributes | |
static const uint32_t | GCOVTagAFDOFileNames = 0xaa000000 |
GCOV tags used to separate sections in the profile file. More... | |
static const uint32_t | GCOVTagAFDOFunction = 0xac000000 |
Additional Inherited Members | |
Static Protected Member Functions inherited from llvm::sampleprof::SampleProfileReader | |
static std::unique_ptr< ProfileSummary > | takeSummary (SampleProfileReader &Reader) |
Take ownership of the summary of this reader. More... | |
Definition at line 502 of file SampleProfReader.h.
|
inline |
Definition at line 504 of file SampleProfReader.h.
References llvm::sampleprof::SampleProfileReader::Buffer, llvm::sampleprof::SampleProfileReader::read(), llvm::sampleprof::SampleProfileReader::readHeader(), and readString().
|
static |
Return true if Buffer
is in the format supported by this class.
Definition at line 910 of file SampleProfReader.cpp.
References llvm::MemoryBuffer::getBufferStart(), and Magic.
Referenced by llvm::sampleprof::SampleProfileReader::create().
|
overridevirtual |
Read sample profiles from the associated file.
Read a GCC AutoFDO profile.
This format is generated by the Linux Perf conversion tool at https://github.com/google/autofdo.
Implements llvm::sampleprof::SampleProfileReader.
Definition at line 898 of file SampleProfReader.cpp.
References llvm::success.
|
protected |
Definition at line 755 of file SampleProfReader.cpp.
References llvm::sampleprof::SampleProfileReader::computeSummary(), I, llvm::success, and llvm::truncated.
|
overridevirtual |
Read and validate the file header.
Implements llvm::sampleprof::SampleProfileReader.
Definition at line 702 of file SampleProfReader.cpp.
References llvm::success, llvm::unrecognized_format, llvm::unsupported_version, and llvm::GCOV::V704.
|
protected |
Definition at line 737 of file SampleProfReader.cpp.
References I, Size, llvm::success, and llvm::truncated.
Definition at line 679 of file SampleProfReader.cpp.
References llvm::malformed, llvm::max(), and llvm::sampleprof::SampleProfileReader::reportError().
|
protected |
Definition at line 772 of file SampleProfReader.cpp.
References llvm::sampleprof::FunctionSamples::addBodySamples(), llvm::sampleprof::FunctionSamples::addCalledTargetSamples(), llvm::sampleprof::FunctionSamples::addHeadSamples(), llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::SmallVectorTemplateCommon< T, typename >::end(), llvm::SmallVectorTemplateCommon< T, typename >::front(), llvm::sampleprof::FunctionSamples::functionSamplesAt(), llvm::sampleprof::FunctionSamples::getTotalSamples(), llvm::sampleprof::HIST_TYPE_INDIR_CALL_TOPN, I, llvm::SmallVectorImpl< T >::insert(), llvm::malformed, Name, llvm::sampleprof::SampleProfileReader::Profiles, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::sampleprof::FunctionSamples::setName(), llvm::SmallVectorBase::size(), llvm::success, and llvm::truncated.
|
protected |
Read the section tag and check that it's the same as Expected
.
Definition at line 723 of file SampleProfReader.cpp.
References llvm::malformed, llvm::success, and llvm::truncated.
Definition at line 695 of file SampleProfReader.cpp.
References llvm::truncated.
|
protected |
Definition at line 672 of file SampleProfReader.cpp.
References llvm::success, and llvm::truncated.
|
protected |
GCOV buffer containing the profile.
Definition at line 530 of file SampleProfReader.h.
|
staticprotected |
GCOV tags used to separate sections in the profile file.
Definition at line 536 of file SampleProfReader.h.
|
staticprotected |
Definition at line 537 of file SampleProfReader.h.
|
protected |
Function names in this profile.
Definition at line 533 of file SampleProfReader.h.