LLVM  6.0.0svn
Public Member Functions | Static Public Member Functions | List of all members
llvm::TextInstrProfReader Class Reference

Reader for the simple text based instrprof format. More...

#include "llvm/ProfileData/InstrProfReader.h"

Inheritance diagram for llvm::TextInstrProfReader:
Inheritance graph
Collaboration diagram for llvm::TextInstrProfReader:
Collaboration graph

Public Member Functions

 TextInstrProfReader (std::unique_ptr< MemoryBuffer > DataBuffer_)
 TextInstrProfReader (const TextInstrProfReader &)=delete
TextInstrProfReaderoperator= (const TextInstrProfReader &)=delete
bool isIRLevelProfile () const override
Error readHeader () override
 Read the header. More...
Error readNextRecord (NamedInstrProfRecord &Record) override
 Read a single record. More...
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 &Buffer)
 Return true if the given buffer is in text instrprof format. More...
- 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

Reader for the simple text based instrprof format.

This format is a simple text format that's suitable for test data. Records are separated by one or more blank lines, and record fields are separated by new lines.

Each record consists of a function name, a function hash, a number of counters, and then each counter value, in that order.

Definition at line 139 of file InstrProfReader.h.

Constructor & Destructor Documentation

◆ TextInstrProfReader() [1/2]

llvm::TextInstrProfReader::TextInstrProfReader ( std::unique_ptr< MemoryBuffer DataBuffer_)

Definition at line 150 of file InstrProfReader.h.

◆ TextInstrProfReader() [2/2]

llvm::TextInstrProfReader::TextInstrProfReader ( const TextInstrProfReader )

Member Function Documentation

◆ getSymtab()

InstrProfSymtab& llvm::TextInstrProfReader::getSymtab ( )

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 166 of file InstrProfReader.h.

References assert().

◆ hasFormat()

bool TextInstrProfReader::hasFormat ( const MemoryBuffer Buffer)

Return true if the given buffer is in text instrprof format.

Definition at line 125 of file InstrProfReader.cpp.

References llvm::all_of(), llvm::StringRef::begin(), llvm::count(), llvm::MemoryBuffer::getBufferSize(), and llvm::MemoryBuffer::getBufferStart().

Referenced by llvm::InstrProfReader::create().

◆ isIRLevelProfile()

bool llvm::TextInstrProfReader::isIRLevelProfile ( ) const

Implements llvm::InstrProfReader.

Definition at line 158 of file InstrProfReader.h.

◆ operator=()

TextInstrProfReader& llvm::TextInstrProfReader::operator= ( const TextInstrProfReader )

◆ readHeader()

Error TextInstrProfReader::readHeader ( )

◆ readNextRecord()

Error TextInstrProfReader::readNextRecord ( NamedInstrProfRecord Record)

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