LLVM  mainline
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
llvm::InstrProfReader Class Reference

Base class and interface for reading profiling data of any known instrprof format. More...

#include <InstrProfReader.h>

Inheritance diagram for llvm::InstrProfReader:
Inheritance graph
[legend]
Collaboration diagram for llvm::InstrProfReader:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 InstrProfReader ()
virtual ~InstrProfReader ()
virtual std::error_code readHeader ()=0
 Read the header. Required before reading first record.
virtual std::error_code readNextRecord (InstrProfRecord &Record)=0
 Read a single record.
InstrProfIterator begin ()
 Iterator over profile data.
InstrProfIterator end ()
virtual InstrProfSymtabgetSymtab ()=0
 Return the PGO symtab.
bool isEOF ()
 Return true if the reader has finished reading the profile data.
bool hasError ()
 Return true if the reader encountered an error reading profiling data.
std::error_code getError ()
 Get the current error code.

Static Public Member Functions

static ErrorOr
< std::unique_ptr
< InstrProfReader > > 
create (std::string Path)
 Factory method to create an appropriately typed reader for the given instrprof file.
static ErrorOr
< std::unique_ptr
< InstrProfReader > > 
create (std::unique_ptr< MemoryBuffer > Buffer)

Protected Member Functions

std::error_code error (std::error_code EC)
 Set the current std::error_code and return same.
std::error_code success ()
 Clear the current error code and return a successful one.

Protected Attributes

std::unique_ptr< InstrProfSymtabSymtab

Detailed Description

Base class and interface for reading profiling data of any known instrprof format.

Provides an iterator over InstrProfRecords.

Definition at line 53 of file InstrProfReader.h.


Constructor & Destructor Documentation

Definition at line 57 of file InstrProfReader.h.

virtual llvm::InstrProfReader::~InstrProfReader ( ) [inline, virtual]

Definition at line 58 of file InstrProfReader.h.


Member Function Documentation

Iterator over profile data.

Definition at line 65 of file InstrProfReader.h.

ErrorOr< std::unique_ptr< InstrProfReader > > InstrProfReader::create ( std::string  Path) [static]

Factory method to create an appropriately typed reader for the given instrprof file.

Reimplemented in llvm::IndexedInstrProfReader.

Definition at line 35 of file InstrProfReader.cpp.

References setupMemoryBuffer().

ErrorOr< std::unique_ptr< InstrProfReader > > InstrProfReader::create ( std::unique_ptr< MemoryBuffer Buffer) [static]

Definition at line 66 of file InstrProfReader.h.

std::error_code llvm::InstrProfReader::error ( std::error_code  EC) [inline, protected]

Set the current std::error_code and return same.

Definition at line 83 of file InstrProfReader.h.

Referenced by llvm::TextInstrProfReader::readNextRecord(), and success().

std::error_code llvm::InstrProfReader::getError ( ) [inline]

Get the current error code.

Definition at line 97 of file InstrProfReader.h.

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.

Implemented in llvm::IndexedInstrProfReader, llvm::RawInstrProfReader< IntPtrT >, and llvm::TextInstrProfReader.

Return true if the reader encountered an error reading profiling data.

Definition at line 95 of file InstrProfReader.h.

References isEOF().

Return true if the reader has finished reading the profile data.

Definition at line 93 of file InstrProfReader.h.

References llvm::eof.

Referenced by hasError().

virtual std::error_code llvm::InstrProfReader::readHeader ( ) [pure virtual]

Read the header. Required before reading first record.

Implemented in llvm::IndexedInstrProfReader, llvm::RawInstrProfReader< IntPtrT >, and llvm::TextInstrProfReader.

Referenced by initializeReader().

virtual std::error_code llvm::InstrProfReader::readNextRecord ( InstrProfRecord Record) [pure virtual]
std::error_code llvm::InstrProfReader::success ( ) [inline, protected]

Clear the current error code and return a successful one.

Definition at line 89 of file InstrProfReader.h.

References error(), and llvm::success.

Referenced by llvm::TextInstrProfReader::readHeader(), and llvm::TextInstrProfReader::readNextRecord().


Member Data Documentation

std::unique_ptr<InstrProfSymtab> llvm::InstrProfReader::Symtab [protected]

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