LLVM
8.0.1
|
#include "llvm/ProfileData/SampleProfReader.h"
Public Member Functions | |
SampleProfileReaderCompactBinary (std::unique_ptr< MemoryBuffer > B, LLVMContext &C) | |
std::error_code | read () override |
Read samples only for functions to use. More... | |
void | collectFuncsToUse (const Module &M) override |
Collect functions to be used when compiling Module M . More... | |
Public Member Functions inherited from llvm::sampleprof::SampleProfileReaderBinary | |
SampleProfileReaderBinary (std::unique_ptr< MemoryBuffer > B, LLVMContext &C, SampleProfileFormat Format=SPF_None) | |
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... | |
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... | |
Additional Inherited Members | |
Protected Member Functions inherited from llvm::sampleprof::SampleProfileReaderBinary | |
template<typename T > | |
ErrorOr< T > | readNumber () |
Read a numeric value of type T from the profile. More... | |
template<typename T > | |
ErrorOr< T > | readUnencodedNumber () |
Read a numeric value of type T from the profile. More... | |
ErrorOr< StringRef > | readString () |
Read a string from the profile. More... | |
template<typename T > | |
ErrorOr< uint32_t > | readStringIndex (T &Table) |
Read the string index and check whether it overflows the table. More... | |
bool | at_eof () const |
Return true if we've reached the end of file. More... | |
std::error_code | readFuncProfile () |
Read the next function profile instance. 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... | |
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... | |
Protected Attributes inherited from llvm::sampleprof::SampleProfileReaderBinary | |
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... | |
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... | |
Definition at line 456 of file SampleProfReader.h.
|
inline |
Definition at line 473 of file SampleProfReader.h.
References llvm::sampleprof::SampleProfileReader::Buffer, llvm::sampleprof::SampleProfileReader::collectFuncsToUse(), and llvm::sampleprof::SampleProfileReader::read().
Collect functions to be used when compiling Module M
.
Reimplemented from llvm::sampleprof::SampleProfileReader.
Definition at line 594 of file SampleProfReader.cpp.
References F(), llvm::ProfileSummary::PSK_Sample, llvm::success, and llvm::sampleprof::SampleProfileReader::Summary.
|
static |
Return true if Buffer
is in the format supported by this class.
Definition at line 665 of file SampleProfReader.cpp.
References llvm::Data, llvm::decodeULEB128(), llvm::MemoryBuffer::getBufferStart(), Magic, llvm::sampleprof::SPF_Compact_Binary, and llvm::sampleprof::SPMagic().
Referenced by llvm::sampleprof::SampleProfileReader::create().
|
overridevirtual |
Read samples only for functions to use.
Reimplemented from llvm::sampleprof::SampleProfileReaderBinary.
Definition at line 471 of file SampleProfReader.cpp.
References llvm::bad_magic, llvm::sampleprof::SampleProfileReader::Buffer, llvm::Data, I, if(), Magic, llvm::MD5Hash(), Name, readString(), Size, llvm::sampleprof::SPF_Compact_Binary, llvm::sampleprof::SPMagic(), llvm::success, and llvm::to_string().