|
LLVM
10.0.0
|
#include "llvm/ProfileData/SampleProfReader.h"
Public Member Functions | |
| SampleProfileReaderBinary (std::unique_ptr< MemoryBuffer > B, LLVMContext &C, SampleProfileFormat Format=SPF_None) | |
| virtual std::error_code | readHeader () override |
| Read and validate the file header. More... | |
| std::error_code | readImpl () override |
| Read sample profiles from the associated file. More... | |
| virtual std::vector< StringRef > * | getNameTable () override |
| It includes all the names that have samples either in outline instance or inline instance. More... | |
Public Member Functions inherited from llvm::sampleprof::SampleProfileReader | |
| SampleProfileReader (std::unique_ptr< MemoryBuffer > B, LLVMContext &C, SampleProfileFormat Format=SPF_None) | |
| virtual | ~SampleProfileReader ()=default |
| std::error_code | read () |
| The interface to read sample profiles from the associated file. More... | |
| void | dumpFunctionProfile (StringRef FName, raw_ostream &OS=dbgs()) |
Print the profile for FName on stream OS. More... | |
| virtual void | collectFuncsFrom (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... | |
| FunctionSamples * | getOrCreateSamplesFor (const Function &F) |
Return the samples collected for function F, create empty FunctionSamples if it doesn't exist. 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 () const |
| Return the profile summary. More... | |
| MemoryBuffer * | getBuffer () const |
| SampleProfileFormat | getFormat () const |
| Return the profile format. More... | |
| virtual std::unique_ptr< ProfileSymbolList > | getProfileSymbolList () |
| virtual bool | dumpSectionInfo (raw_ostream &OS=dbgs()) |
Protected Member Functions | |
| 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 (const uint8_t *Start) |
| Read the next function profile instance. More... | |
| std::error_code | readProfile (FunctionSamples &FProfile) |
| Read the contents of the given profile instance. More... | |
| std::error_code | readMagicIdent () |
| Read the contents of Magic number and Version number. More... | |
| std::error_code | readSummary () |
| Read profile summary. More... | |
| virtual std::error_code | readNameTable () |
| Read the whole name table. More... | |
| virtual ErrorOr< StringRef > | readStringFromTable () |
| Read a string indirectly via the name table. 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... | |
| std::unique_ptr< SampleProfileReaderItaniumRemapper > | Remapper |
| SampleProfileFormat | Format = SPF_None |
| The format of sample. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from llvm::sampleprof::SampleProfileReader | |
| static ErrorOr< std::unique_ptr< SampleProfileReader > > | create (const std::string Filename, LLVMContext &C, const std::string RemapFilename="") |
| 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, const std::string RemapFilename="") |
| Create a sample profile reader from the supplied memory buffer. 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... | |
Definition at line 469 of file SampleProfReader.h.
|
inline |
Definition at line 471 of file SampleProfReader.h.
|
inlineprotected |
Return true if we've reached the end of file.
Definition at line 510 of file SampleProfReader.h.
References llvm::Data.
|
inlineoverridevirtual |
It includes all the names that have samples either in outline instance or inline instance.
Reimplemented from llvm::sampleprof::SampleProfileReader.
Definition at line 483 of file SampleProfReader.h.
References readString().
|
protected |
Read the next function profile instance.
Definition at line 443 of file SampleProfReader.cpp.
|
overridevirtual |
Read and validate the file header.
Implements llvm::sampleprof::SampleProfileReader.
Reimplemented in llvm::sampleprof::SampleProfileReaderExtBinaryBase.
Definition at line 831 of file SampleProfReader.cpp.
References llvm::sampleprof::SampleProfileReader::Buffer, and llvm::Data.
|
overridevirtual |
Read sample profiles from the associated file.
Implements llvm::sampleprof::SampleProfileReader.
Reimplemented in llvm::sampleprof::SampleProfileReaderCompactBinary, and llvm::sampleprof::SampleProfileReaderExtBinaryBase.
Definition at line 464 of file SampleProfReader.cpp.
References llvm::Data, and llvm::success.
|
protected |
Read the contents of Magic number and Version number.
Definition at line 813 of file SampleProfReader.cpp.
References Magic, llvm::sampleprof::SPVersion(), llvm::success, llvm::unsupported_version, and llvm::IndexedInstrProf::Version.
|
protectedvirtual |
Read the whole name table.
Definition at line 693 of file SampleProfReader.cpp.
References I, Name, readString(), Size, llvm::success, and llvm::to_string().
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 289 of file SampleProfReader.cpp.
References llvm::Data, llvm::decodeULEB128(), llvm::malformed, and llvm::max().
|
protected |
Read the contents of the given profile instance.
Definition at line 366 of file SampleProfReader.cpp.
References llvm::sampleprof::FunctionSamples::addBodySamples(), llvm::sampleprof::FunctionSamples::addCalledTargetSamples(), llvm::sampleprof::FunctionSamples::addTotalSamples(), llvm::sampleprof::FunctionSamples::functionSamplesAt(), I, isOffsetLegal(), llvm::sampleprof::FunctionSamples::setName(), and llvm::success.
Read a string from the profile.
If an error occurs during decoding, a diagnostic message is emitted and EC is set.
Definition at line 310 of file SampleProfReader.cpp.
References llvm::Data, and llvm::StringRef::size().
Read a string indirectly via the name table.
Definition at line 349 of file SampleProfReader.cpp.
|
inlineprotected |
Read the string index and check whether it overflows the table.
Definition at line 339 of file SampleProfReader.cpp.
References llvm::truncated_name_table.
|
protected |
Read profile summary.
Definition at line 910 of file SampleProfReader.cpp.
References llvm::ProfileSummary::PSK_Sample, llvm::success, and llvm::sampleprof::SampleProfileReader::Summary.
Read a numeric value of type T from the profile.
The value is saved without encoded.
Definition at line 324 of file SampleProfReader.cpp.
References llvm::Data.
|
protected |
Points to the current location in the buffer.
Definition at line 528 of file SampleProfReader.h.
|
protected |
Points to the end of the buffer.
Definition at line 531 of file SampleProfReader.h.
|
protected |
Function name table.
Definition at line 534 of file SampleProfReader.h.
1.8.13