LLVM  14.0.0git
Public Member Functions | Static Public Member Functions | List of all members
llvm::sampleprof::SampleProfileReaderExtBinary Class Reference

#include "llvm/ProfileData/SampleProfReader.h"

Inheritance diagram for llvm::sampleprof::SampleProfileReaderExtBinary:
Inheritance graph
[legend]
Collaboration diagram for llvm::sampleprof::SampleProfileReaderExtBinary:
Collaboration graph
[legend]

Public Member Functions

 SampleProfileReaderExtBinary (std::unique_ptr< MemoryBuffer > B, LLVMContext &C, SampleProfileFormat Format=SPF_Ext_Binary)
 
- Public Member Functions inherited from llvm::sampleprof::SampleProfileReaderExtBinaryBase
 SampleProfileReaderExtBinaryBase (std::unique_ptr< MemoryBuffer > B, LLVMContext &C, SampleProfileFormat Format)
 
std::error_code readImpl () override
 Read sample profiles in extensible format from the associated file. More...
 
uint64_t getSectionSize (SecType Type)
 Get the total size of all Type sections. More...
 
uint64_t getFileSize ()
 Get the total size of header and all sections. More...
 
virtual bool dumpSectionInfo (raw_ostream &OS=dbgs()) override
 
bool collectFuncsFromModule () override
 Collect functions with definitions in Module M. More...
 
virtual bool useMD5 () override
 Return whether names in the profile are all MD5 numbers. More...
 
virtual std::unique_ptr< ProfileSymbolListgetProfileSymbolList () override
 
virtual void setSkipFlatProf (bool Skip) override
 Don't read profile without context if the flag is set. More...
 
- Public Member Functions inherited from llvm::sampleprof::SampleProfileReaderBinary
 SampleProfileReaderBinary (std::unique_ptr< MemoryBuffer > B, LLVMContext &C, SampleProfileFormat Format=SPF_None)
 
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
 
void setDiscriminatorMaskedBitFrom (FSDiscriminatorPass P)
 Set the bits for FS discriminators. More...
 
uint32_t getDiscriminatorMask () const
 Get the bitmask the discriminators: For FS profiles, return the bit mask for this pass. More...
 
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...
 
void dump (raw_ostream &OS=dbgs())
 Print all the profiles on stream OS. More...
 
FunctionSamplesgetSamplesFor (const Function &F)
 Return the samples collected for function F. More...
 
FunctionSamplesgetOrCreateSamplesFor (const Function &F)
 Return the samples collected for function F, create empty FunctionSamples if it doesn't exist. More...
 
virtual FunctionSamplesgetSamplesFor (StringRef Fname)
 Return the samples collected for function F. More...
 
StringMap< FunctionSamples > & getProfiles ()
 Return all the profiles. More...
 
void reportError (int64_t LineNumber, const Twine &Msg) const
 Report a parse error message. More...
 
ProfileSummarygetSummary () const
 Return the profile summary. More...
 
MemoryBuffergetBuffer () const
 
SampleProfileFormat getFormat () const
 Return the profile format. More...
 
bool profileIsProbeBased () const
 Whether input profile is based on pseudo probes. More...
 
bool profileIsCS () const
 Whether input profile is fully context-sensitive. More...
 
virtual bool hasUniqSuffix ()
 Return whether any name in the profile contains ".__uniq." suffix. More...
 
SampleProfileReaderItaniumRemappergetRemapper ()
 
void setModule (const Module *Mod)
 

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 std::string Filename, LLVMContext &C, FSDiscriminatorPass P=FSDiscriminatorPass::Base, 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, FSDiscriminatorPass P=FSDiscriminatorPass::Base, const std::string RemapFilename="")
 Create a sample profile reader from the supplied memory buffer. More...
 

Additional Inherited Members

- Protected Member Functions inherited from llvm::sampleprof::SampleProfileReaderExtBinaryBase
std::error_code readSecHdrTableEntry (uint32_t Idx)
 
std::error_code readSecHdrTable ()
 
std::error_code readFuncMetadata (bool ProfileHasAttribute)
 
std::error_code readFuncOffsetTable ()
 
std::error_code readFuncProfiles ()
 
std::error_code readMD5NameTable ()
 
std::error_code readNameTableSec (bool IsMD5)
 
std::error_code readProfileSymbolList ()
 
virtual std::error_code readHeader () override
 Read and validate the file header. More...
 
virtual std::error_code readOneSection (const uint8_t *Start, uint64_t Size, const SecHdrTableEntry &Entry)
 
virtual ErrorOr< StringRefreadStringFromTable () override
 Read a string indirectly via the name table. More...
 
- 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< StringRefreadString ()
 Read a string from the profile. More...
 
template<typename T >
ErrorOr< uint32_treadStringIndex (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...
 
- 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< ProfileSummarytakeSummary (SampleProfileReader &Reader)
 Take ownership of the summary of this reader. More...
 
- Protected Attributes inherited from llvm::sampleprof::SampleProfileReaderExtBinaryBase
std::vector< SecHdrTableEntrySecHdrTable
 
std::unique_ptr< ProfileSymbolListProfSymList
 
DenseMap< StringRef, uint64_t > FuncOffsetTable
 The table mapping from function name to the offset of its FunctionSample towards file start. More...
 
DenseSet< StringRefFuncsToUse
 The set containing the functions to use when compiling a module. More...
 
bool FixedLengthMD5 = false
 Use fixed length MD5 instead of ULEB128 encoding so NameTable doesn't need to be read in up front and can be directly accessed using index. More...
 
const uint8_t * MD5NameMemStart = nullptr
 The starting address of NameTable containing fixed length MD5. More...
 
std::unique_ptr< std::vector< std::string > > MD5StringBuf
 If MD5 is used in NameTable section, the section saves uint64_t data. More...
 
bool SkipFlatProf = false
 If SkipFlatProf is true, skip the sections with SecFlagFlat flag. 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...
 
std::vector< StringRefNameTable
 Function name table. More...
 
- Protected Attributes inherited from llvm::sampleprof::SampleProfileReader
StringMap< FunctionSamplesProfiles
 Map every function to its associated profile. More...
 
LLVMContextCtx
 LLVM context used to emit diagnostics. More...
 
std::unique_ptr< MemoryBufferBuffer
 Memory buffer holding the profile file. More...
 
std::unique_ptr< ProfileSummarySummary
 Profile summary information. More...
 
std::unique_ptr< SampleProfileReaderItaniumRemapperRemapper
 
bool ProfileIsProbeBased = false
 Whether samples are collected based on pseudo probes. More...
 
bool ProfileIsCS = false
 Whether function profiles are context-sensitive. More...
 
uint32_t CSProfileCount = 0
 Number of context-sensitive profiles. More...
 
bool ProfileIsFS = false
 Whether the function profiles use FS discriminators. More...
 
SampleProfileFormat Format = SPF_None
 The format of sample. More...
 
const ModuleM = nullptr
 The current module being compiled if SampleProfileReader is used by compiler. More...
 
uint32_t MaskedBitFrom = 31
 Zero out the discriminator bits higher than bit MaskedBitFrom (0 based). More...
 

Detailed Description

Definition at line 751 of file SampleProfReader.h.

Constructor & Destructor Documentation

◆ SampleProfileReaderExtBinary()

llvm::sampleprof::SampleProfileReaderExtBinary::SampleProfileReaderExtBinary ( std::unique_ptr< MemoryBuffer B,
LLVMContext C,
SampleProfileFormat  Format = SPF_Ext_Binary 
)
inline

Definition at line 760 of file SampleProfReader.h.

Member Function Documentation

◆ hasFormat()

bool SampleProfileReaderExtBinary::hasFormat ( const MemoryBuffer Buffer)
static

The documentation for this class was generated from the following files: