LLVM  4.0.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
llvm::sampleprof::SampleProfileReaderGCC Class Reference

#include <SampleProfReader.h>

Inheritance diagram for llvm::sampleprof::SampleProfileReaderGCC:
[legend]
Collaboration diagram for llvm::sampleprof::SampleProfileReaderGCC:
[legend]

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)
 
virtual ~SampleProfileReader ()
 
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...
 
StringMap< FunctionSamples > & getProfiles ()
 Return all the profiles. More...
 
void reportError (int64_t LineNumber, Twine Msg) const
 Report a parse error message. More...
 
ProfileSummarygetSummary ()
 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

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< TreadNumber ()
 
ErrorOr< StringRefreadString ()
 
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< 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...
 

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
 

Detailed Description

Definition at line 408 of file SampleProfReader.h.

Constructor & Destructor Documentation

llvm::sampleprof::SampleProfileReaderGCC::SampleProfileReaderGCC ( std::unique_ptr< MemoryBuffer B,
LLVMContext C 
)
inline

Definition at line 410 of file SampleProfReader.h.

Member Function Documentation

bool SampleProfileReaderGCC::hasFormat ( const MemoryBuffer Buffer)
static

Return true if Buffer is in the format supported by this class.

Definition at line 727 of file SampleProfReader.cpp.

References llvm::MemoryBuffer::getBufferStart(), and Magic.

Referenced by llvm::sampleprof::SampleProfileReader::create().

std::error_code SampleProfileReaderGCC::read ( )
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 715 of file SampleProfReader.cpp.

References llvm::success.

std::error_code SampleProfileReaderGCC::readFunctionProfiles ( )
protected

Definition at line 570 of file SampleProfReader.cpp.

References I, llvm::success, and llvm::truncated.

std::error_code SampleProfileReaderGCC::readHeader ( )
overridevirtual

Read and validate the file header.

Implements llvm::sampleprof::SampleProfileReader.

Definition at line 517 of file SampleProfReader.cpp.

References llvm::success, llvm::unrecognized_format, llvm::unsupported_version, and llvm::GCOV::V704.

std::error_code SampleProfileReaderGCC::readNameTable ( )
protected

Definition at line 552 of file SampleProfReader.cpp.

References I, llvm::success, and llvm::truncated.

template<typename T >
ErrorOr< T > SampleProfileReaderGCC::readNumber ( )
protected

Definition at line 494 of file SampleProfReader.cpp.

References llvm::malformed, and reportError().

std::error_code SampleProfileReaderGCC::readOneFunctionProfile ( const InlineCallStack InlineStack,
bool  Update,
uint32_t  Offset 
)
protected
std::error_code SampleProfileReaderGCC::readSectionTag ( uint32_t  Expected)
protected

Read the section tag and check that it's the same as Expected.

Definition at line 538 of file SampleProfReader.cpp.

References llvm::malformed, llvm::success, and llvm::truncated.

ErrorOr< StringRef > SampleProfileReaderGCC::readString ( )
protected

Definition at line 510 of file SampleProfReader.cpp.

References llvm::truncated.

std::error_code SampleProfileReaderGCC::skipNextWord ( )
protected

Definition at line 487 of file SampleProfReader.cpp.

References llvm::success, and llvm::truncated.

Member Data Documentation

GCOVBuffer llvm::sampleprof::SampleProfileReaderGCC::GcovBuffer
protected

GCOV buffer containing the profile.

Definition at line 435 of file SampleProfReader.h.

const uint32_t llvm::sampleprof::SampleProfileReaderGCC::GCOVTagAFDOFileNames = 0xaa000000
staticprotected

GCOV tags used to separate sections in the profile file.

Definition at line 441 of file SampleProfReader.h.

const uint32_t llvm::sampleprof::SampleProfileReaderGCC::GCOVTagAFDOFunction = 0xac000000
staticprotected

Definition at line 442 of file SampleProfReader.h.

std::vector<std::string> llvm::sampleprof::SampleProfileReaderGCC::Names
protected

Function names in this profile.

Definition at line 438 of file SampleProfReader.h.


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