LLVM  8.0.1
Public Member Functions | Static Public Member Functions | List of all members
llvm::RawInstrProfReader< IntPtrT > Class Template Reference

Reader for the raw instrprof binary format from runtime. More...

#include "llvm/ProfileData/InstrProfReader.h"

Inheritance diagram for llvm::RawInstrProfReader< IntPtrT >:
Inheritance graph
[legend]
Collaboration diagram for llvm::RawInstrProfReader< IntPtrT >:
Collaboration graph
[legend]

Public Member Functions

 RawInstrProfReader (std::unique_ptr< MemoryBuffer > DataBuffer)
 
 RawInstrProfReader (const RawInstrProfReader &)=delete
 
RawInstrProfReaderoperator= (const RawInstrProfReader &)=delete
 
Error readHeader () override
 Read the header. Required before reading first record. More...
 
Error readNextRecord (NamedInstrProfRecord &Record) override
 Read a single record. More...
 
bool isIRLevelProfile () const override
 
InstrProfSymtabgetSymtab () override
 Return the PGO symtab. More...
 
- Public Member Functions inherited from llvm::InstrProfReader
 InstrProfReader ()=default
 
virtual ~InstrProfReader ()=default
 
InstrProfIterator begin ()
 Iterator over profile data. More...
 
InstrProfIterator end ()
 
bool isEOF ()
 Return true if the reader has finished reading the profile data. More...
 
bool hasError ()
 Return true if the reader encountered an error reading profiling data. More...
 
Error getError ()
 Get the current error. More...
 

Static Public Member Functions

static bool hasFormat (const MemoryBuffer &DataBuffer)
 
- Static Public Member Functions inherited from llvm::InstrProfReader
static Expected< std::unique_ptr< InstrProfReader > > create (const Twine &Path)
 Factory method to create an appropriately typed reader for the given instrprof file. More...
 
static Expected< std::unique_ptr< InstrProfReader > > create (std::unique_ptr< MemoryBuffer > Buffer)
 

Additional Inherited Members

- Protected Member Functions inherited from llvm::InstrProfReader
Error error (instrprof_error Err)
 Set the current error and return same. More...
 
Error error (Error &&E)
 
Error success ()
 Clear the current error and return a successful one. More...
 
- Protected Attributes inherited from llvm::InstrProfReader
std::unique_ptr< InstrProfSymtabSymtab
 

Detailed Description

template<class IntPtrT>
class llvm::RawInstrProfReader< IntPtrT >

Reader for the raw instrprof binary format from runtime.

This format is a raw memory dump of the instrumentation-baed profiling data from the runtime. It has no index.

Templated on the unsigned type whose size matches pointers on the platform that wrote the profile.

Definition at line 180 of file InstrProfReader.h.

Constructor & Destructor Documentation

◆ RawInstrProfReader() [1/2]

template<class IntPtrT >
llvm::RawInstrProfReader< IntPtrT >::RawInstrProfReader ( std::unique_ptr< MemoryBuffer DataBuffer)
inline

Definition at line 203 of file InstrProfReader.h.

◆ RawInstrProfReader() [2/2]

template<class IntPtrT >
llvm::RawInstrProfReader< IntPtrT >::RawInstrProfReader ( const RawInstrProfReader< IntPtrT > &  )
delete

Member Function Documentation

◆ getSymtab()

template<class IntPtrT >
InstrProfSymtab& llvm::RawInstrProfReader< IntPtrT >::getSymtab ( )
inlineoverridevirtual

Return the PGO symtab.

There are three different readers: Raw, Text, and Indexed profile readers. The first two types of readers are used only by llvm-profdata tool, while the indexed profile reader is also used by llvm-cov tool and the compiler ( backend or frontend). Since creating PGO symtab can create significant runtime and memory overhead (as it touches data for the whole program), InstrProfSymtab for the indexed profile reader should be created on demand and it is recommended to be only used for dumping purpose with llvm-proftool, not with the compiler.

Implements llvm::InstrProfReader.

Definition at line 216 of file InstrProfReader.h.

References assert(), llvm::support::big, llvm::InstrProfSymtab::getFuncName(), llvm::getHostEndianness(), getName(), llvm::sys::getSwappedBytes(), llvm::support::little, and std::swap().

◆ hasFormat()

template<class IntPtrT >
bool RawInstrProfReader::hasFormat ( const MemoryBuffer DataBuffer)
static

◆ isIRLevelProfile()

template<class IntPtrT >
bool llvm::RawInstrProfReader< IntPtrT >::isIRLevelProfile ( ) const
inlineoverridevirtual

Implements llvm::InstrProfReader.

Definition at line 212 of file InstrProfReader.h.

◆ operator=()

template<class IntPtrT >
RawInstrProfReader& llvm::RawInstrProfReader< IntPtrT >::operator= ( const RawInstrProfReader< IntPtrT > &  )
delete

◆ readHeader()

template<class IntPtrT >
Error RawInstrProfReader::readHeader ( )
overridevirtual

Read the header. Required before reading first record.

Implements llvm::InstrProfReader.

Definition at line 303 of file InstrProfReader.cpp.

References llvm::bad_header, llvm::bad_magic, llvm::InstrProfReader::error(), and llvm::InstrProfReader::readHeader().

◆ readNextRecord()

template<class IntPtrT >
Error RawInstrProfReader::readNextRecord ( NamedInstrProfRecord Record)
overridevirtual

Read a single record.

Implements llvm::InstrProfReader.

Definition at line 463 of file InstrProfReader.cpp.

References E, llvm::InstrProfReader::error(), and llvm::InstrProfReader::success().


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