LLVM  6.0.0svn
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 "llvm/ProfileData/SampleProfReader.h"

Inheritance diagram for llvm::sampleprof::SampleProfileReaderGCC:
Inheritance graph
[legend]
Collaboration diagram for llvm::sampleprof::SampleProfileReaderGCC:
Collaboration graph
[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 ()=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...
 
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 421 of file SampleProfReader.h.

Constructor & Destructor Documentation

◆ SampleProfileReaderGCC()

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

Member Function Documentation

◆ hasFormat()

bool SampleProfileReaderGCC::hasFormat ( const MemoryBuffer Buffer)
static

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

Definition at line 736 of file SampleProfReader.cpp.

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

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

◆ read()

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 724 of file SampleProfReader.cpp.

References llvm::success.

◆ readFunctionProfiles()

std::error_code SampleProfileReaderGCC::readFunctionProfiles ( )
protected

◆ readHeader()

std::error_code SampleProfileReaderGCC::readHeader ( )
overridevirtual

Read and validate the file header.

Implements llvm::sampleprof::SampleProfileReader.

Definition at line 528 of file SampleProfReader.cpp.

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

◆ readNameTable()

std::error_code SampleProfileReaderGCC::readNameTable ( )
protected

◆ readNumber()

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

◆ readOneFunctionProfile()

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

◆ readSectionTag()

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 549 of file SampleProfReader.cpp.

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

◆ readString()

ErrorOr< StringRef > SampleProfileReaderGCC::readString ( )
protected

Definition at line 521 of file SampleProfReader.cpp.

References llvm::truncated.

◆ skipNextWord()

std::error_code SampleProfileReaderGCC::skipNextWord ( )
protected

Definition at line 498 of file SampleProfReader.cpp.

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

Member Data Documentation

◆ GcovBuffer

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

GCOV buffer containing the profile.

Definition at line 448 of file SampleProfReader.h.

◆ GCOVTagAFDOFileNames

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

GCOV tags used to separate sections in the profile file.

Definition at line 454 of file SampleProfReader.h.

◆ GCOVTagAFDOFunction

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

Definition at line 455 of file SampleProfReader.h.

◆ Names

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

Function names in this profile.

Definition at line 451 of file SampleProfReader.h.


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