LLVM  5.0.0
Public Types | Public Member Functions | Static Public Member Functions | List of all members
llvm::InstrProfWriter Class Reference

#include "llvm/ProfileData/InstrProfWriter.h"

Public Types

enum  ProfKind { PF_Unknown = 0, PF_FE, PF_IRLevel }
 
using ProfilingData = SmallDenseMap< uint64_t, InstrProfRecord >
 

Public Member Functions

 InstrProfWriter (bool Sparse=false)
 
 ~InstrProfWriter ()
 
void addRecord (NamedInstrProfRecord &&I, uint64_t Weight, function_ref< void(Error)> Warn)
 Add function counts for the given function. More...
 
void addRecord (NamedInstrProfRecord &&I, function_ref< void(Error)> Warn)
 
void mergeRecordsFromWriter (InstrProfWriter &&IPW, function_ref< void(Error)> Warn)
 Merge existing function counts from the given writer. More...
 
void write (raw_fd_ostream &OS)
 Write the profile to OS. More...
 
Error writeText (raw_fd_ostream &OS)
 Write the profile in text format to OS. More...
 
std::unique_ptr< MemoryBuffer > writeBuffer ()
 Write the profile, returning the raw data. For testing. More...
 
Error setIsIRLevelProfile (bool IsIRLevel)
 Set the ProfileKind. Report error if mixing FE and IR level profiles. More...
 
void setValueProfDataEndianness (support::endianness Endianness)
 
void setOutputSparse (bool Sparse)
 

Static Public Member Functions

static void writeRecordInText (StringRef Name, uint64_t Hash, const InstrProfRecord &Counters, InstrProfSymtab &Symtab, raw_fd_ostream &OS)
 Write Record in text format to OS. More...
 

Detailed Description

Definition at line 34 of file InstrProfWriter.h.

Member Typedef Documentation

Definition at line 36 of file InstrProfWriter.h.

Member Enumeration Documentation

Enumerator
PF_Unknown 
PF_FE 
PF_IRLevel 

Definition at line 37 of file InstrProfWriter.h.

Constructor & Destructor Documentation

InstrProfWriter::InstrProfWriter ( bool  Sparse = false)

Definition at line 164 of file InstrProfWriter.cpp.

InstrProfWriter::~InstrProfWriter ( )

Definition at line 167 of file InstrProfWriter.cpp.

Member Function Documentation

void InstrProfWriter::addRecord ( NamedInstrProfRecord &&  I,
uint64_t  Weight,
function_ref< void(Error)>  Warn 
)

Add function counts for the given function.

If there are already counts for this function and the hash and number of counts match, each counter is summed. Optionally scale counts by Weight.

Definition at line 179 of file InstrProfWriter.cpp.

References fuzzer::Hash(), I, and Name.

Referenced by addRecord(), and mergeRecordsFromWriter().

void llvm::InstrProfWriter::addRecord ( NamedInstrProfRecord &&  I,
function_ref< void(Error)>  Warn 
)
inline

Definition at line 55 of file InstrProfWriter.h.

References addRecord(), and I.

void InstrProfWriter::mergeRecordsFromWriter ( InstrProfWriter &&  IPW,
function_ref< void(Error)>  Warn 
)

Merge existing function counts from the given writer.

Definition at line 214 of file InstrProfWriter.cpp.

References addRecord(), and I.

Error llvm::InstrProfWriter::setIsIRLevelProfile ( bool  IsIRLevel)
inline

Set the ProfileKind. Report error if mixing FE and IR level profiles.

Definition at line 78 of file InstrProfWriter.h.

References PF_FE, PF_IRLevel, PF_Unknown, llvm::Error::success(), and llvm::unsupported_version.

void InstrProfWriter::setOutputSparse ( bool  Sparse)

Definition at line 175 of file InstrProfWriter.cpp.

void InstrProfWriter::setValueProfDataEndianness ( support::endianness  Endianness)
void InstrProfWriter::write ( raw_fd_ostream &  OS)

Write the profile to OS.

Definition at line 313 of file InstrProfWriter.cpp.

std::unique_ptr< MemoryBuffer > InstrProfWriter::writeBuffer ( )

Write the profile, returning the raw data. For testing.

Definition at line 319 of file InstrProfWriter.cpp.

References llvm::Data, and llvm::MemoryBuffer::getMemBufferCopy().

void InstrProfWriter::writeRecordInText ( StringRef  Name,
uint64_t  Hash,
const InstrProfRecord &  Counters,
InstrProfSymtab &  Symtab,
raw_fd_ostream &  OS 
)
static
Error InstrProfWriter::writeText ( raw_fd_ostream &  OS)

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