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

Reader for the indexed binary instrprof format. More...

#include "llvm/ProfileData/InstrProfReader.h"

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

Public Member Functions

 IndexedInstrProfReader (std::unique_ptr< MemoryBuffer > DataBuffer)
 
 IndexedInstrProfReader (const IndexedInstrProfReader &)=delete
 
IndexedInstrProfReaderoperator= (const IndexedInstrProfReader &)=delete
 
uint64_t getVersion () const
 Return the profile version. More...
 
bool isIRLevelProfile () const override
 
Error readHeader () override
 Read the file header. More...
 
Error readNextRecord (NamedInstrProfRecord &Record) override
 Read a single record. More...
 
Expected< InstrProfRecordgetInstrProfRecord (StringRef FuncName, uint64_t FuncHash)
 Return the NamedInstrProfRecord associated with FuncName and FuncHash. More...
 
Error getFunctionCounts (StringRef FuncName, uint64_t FuncHash, std::vector< uint64_t > &Counts)
 Fill Counts with the profile data for the given function name. More...
 
uint64_t getMaximumFunctionCount ()
 Return the maximum of all known function counts. More...
 
void setValueProfDataEndianness (support::endianness Endianness)
 
InstrProfSymtabgetSymtab () override
 Return the PGO symtab. More...
 
ProfileSummarygetSummary ()
 
- 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)
 Return true if the given buffer is in an indexed instrprof format. More...
 
static Expected< std::unique_ptr< IndexedInstrProfReader > > create (const Twine &Path)
 Factory method to create an indexed reader. More...
 
static Expected< std::unique_ptr< IndexedInstrProfReader > > create (std::unique_ptr< MemoryBuffer > Buffer)
 
- 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 indexed binary instrprof format.

Definition at line 392 of file InstrProfReader.h.

Constructor & Destructor Documentation

◆ IndexedInstrProfReader() [1/2]

llvm::IndexedInstrProfReader::IndexedInstrProfReader ( std::unique_ptr< MemoryBuffer DataBuffer)
inline

Definition at line 409 of file InstrProfReader.h.

◆ IndexedInstrProfReader() [2/2]

llvm::IndexedInstrProfReader::IndexedInstrProfReader ( const IndexedInstrProfReader )
delete

Member Function Documentation

◆ create() [1/2]

Expected< std::unique_ptr< IndexedInstrProfReader > > IndexedInstrProfReader::create ( const Twine Path)
static

Factory method to create an indexed reader.

Definition at line 91 of file InstrProfReader.cpp.

References E, and setupMemoryBuffer().

Referenced by annotateAllFunctions(), and llvm::coverage::CoverageMapping::load().

◆ create() [2/2]

Expected< std::unique_ptr< IndexedInstrProfReader > > IndexedInstrProfReader::create ( std::unique_ptr< MemoryBuffer Buffer)
static

◆ getFunctionCounts()

Error IndexedInstrProfReader::getFunctionCounts ( StringRef  FuncName,
uint64_t  FuncHash,
std::vector< uint64_t > &  Counts 
)

Fill Counts with the profile data for the given function name.

Definition at line 724 of file InstrProfReader.cpp.

References E, llvm::InstrProfReader::error(), llvm::Expected< T >::get(), llvm::InstrProfReader::success(), and llvm::Expected< T >::takeError().

Referenced by llvm::coverage::CounterMappingContext::evaluate().

◆ getInstrProfRecord()

Expected< InstrProfRecord > IndexedInstrProfReader::getInstrProfRecord ( StringRef  FuncName,
uint64_t  FuncHash 
)

Return the NamedInstrProfRecord associated with FuncName and FuncHash.

Definition at line 708 of file InstrProfReader.cpp.

References llvm::Data, E, llvm::InstrProfReader::error(), llvm::hash_mismatch, I, and llvm::ArrayRef< T >::size().

Referenced by sumEdgeCount().

◆ getMaximumFunctionCount()

uint64_t llvm::IndexedInstrProfReader::getMaximumFunctionCount ( )
inline

Return the maximum of all known function counts.

Definition at line 435 of file InstrProfReader.h.

Referenced by sumEdgeCount().

◆ getSummary()

ProfileSummary& llvm::IndexedInstrProfReader::getSummary ( )
inline

Definition at line 453 of file InstrProfReader.h.

◆ getSymtab()

InstrProfSymtab & IndexedInstrProfReader::getSymtab ( )
overridevirtual

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 694 of file InstrProfReader.cpp.

References llvm::consumeError(), E, llvm::InstrProfReader::error(), and llvm::InstrProfError::take().

◆ getVersion()

uint64_t llvm::IndexedInstrProfReader::getVersion ( ) const
inline

Return the profile version.

Definition at line 415 of file InstrProfReader.h.

◆ hasFormat()

bool IndexedInstrProfReader::hasFormat ( const MemoryBuffer DataBuffer)
static

◆ isIRLevelProfile()

bool llvm::IndexedInstrProfReader::isIRLevelProfile ( ) const
inlineoverridevirtual

Implements llvm::InstrProfReader.

Definition at line 416 of file InstrProfReader.h.

◆ operator=()

IndexedInstrProfReader& llvm::IndexedInstrProfReader::operator= ( const IndexedInstrProfReader )
delete

◆ readHeader()

Error IndexedInstrProfReader::readHeader ( )
overridevirtual

◆ readNextRecord()

Error IndexedInstrProfReader::readNextRecord ( NamedInstrProfRecord Record)
overridevirtual

◆ setValueProfDataEndianness()

void llvm::IndexedInstrProfReader::setValueProfDataEndianness ( support::endianness  Endianness)
inline

Definition at line 445 of file InstrProfReader.h.


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