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

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

#include <InstrProfReader.h>

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

Public Member Functions

 IndexedInstrProfReader (std::unique_ptr< MemoryBuffer > DataBuffer)
 
std::error_code readHeader () override
 Read the file header. More...
 
std::error_code readNextRecord (InstrProfRecord &Record) override
 Read a single record. More...
 
std::error_code 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...
 
- Public Member Functions inherited from llvm::InstrProfReader
 InstrProfReader ()
 
virtual ~InstrProfReader ()
 
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...
 
std::error_code getError ()
 Get the current error code. 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 ErrorOr
< std::unique_ptr
< IndexedInstrProfReader > > 
create (std::string Path)
 Factory method to create an indexed reader. More...
 
static ErrorOr
< std::unique_ptr
< IndexedInstrProfReader > > 
create (std::unique_ptr< MemoryBuffer > Buffer)
 
- Static Public Member Functions inherited from llvm::InstrProfReader
static ErrorOr
< std::unique_ptr
< InstrProfReader > > 
create (std::string Path)
 Factory method to create an appropriately typed reader for the given instrprof file. More...
 
static ErrorOr
< std::unique_ptr
< InstrProfReader > > 
create (std::unique_ptr< MemoryBuffer > Buffer)
 

Additional Inherited Members

- Protected Member Functions inherited from llvm::InstrProfReader
std::error_code error (std::error_code EC)
 Set the current std::error_code and return same. More...
 
std::error_code success ()
 Clear the current error code and return a successful one. More...
 

Detailed Description

Reader for the indexed binary instrprof format.

Definition at line 234 of file InstrProfReader.h.

Constructor & Destructor Documentation

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

Definition at line 250 of file InstrProfReader.h.

Member Function Documentation

ErrorOr< std::unique_ptr< IndexedInstrProfReader > > IndexedInstrProfReader::create ( std::string  Path)
static

Factory method to create an indexed reader.

Definition at line 69 of file InstrProfReader.cpp.

References setupMemoryBuffer().

Referenced by llvm::coverage::CoverageMapping::load().

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

Definition at line 79 of file InstrProfReader.cpp.

References llvm::bad_magic, hasFormat(), initializeReader(), and llvm::too_large.

std::error_code 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 393 of file InstrProfReader.cpp.

References llvm::Data, llvm::ArrayRef< T >::empty(), error(), fuzzer::Hash(), llvm::hash_mismatch, I, llvm::malformed, llvm::ArrayRef< T >::size(), llvm::success, and llvm::unknown_function.

Referenced by llvm::coverage::CoverageMapping::load().

uint64_t llvm::IndexedInstrProfReader::getMaximumFunctionCount ( )
inline

Return the maximum of all known function counts.

Definition at line 265 of file InstrProfReader.h.

bool IndexedInstrProfReader::hasFormat ( const MemoryBuffer DataBuffer)
static

Return true if the given buffer is in an indexed instrprof format.

Definition at line 345 of file InstrProfReader.cpp.

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

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

std::error_code IndexedInstrProfReader::readHeader ( )
overridevirtual
std::error_code IndexedInstrProfReader::readNextRecord ( InstrProfRecord Record)
overridevirtual

Read a single record.

Implements llvm::InstrProfReader.

Definition at line 415 of file InstrProfReader.cpp.

References llvm::Data, llvm::eof, error(), llvm::malformed, llvm::ArrayRef< T >::size(), and llvm::success.


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