LLVM
15.0.0git
|
#include "llvm/ProfileData/InstrProfWriter.h"
Public Types | |
using | ProfilingData = SmallDenseMap< uint64_t, InstrProfRecord > |
Public Member Functions | |
InstrProfWriter (bool Sparse=false) | |
~InstrProfWriter () | |
StringMap< ProfilingData > & | getProfileData () |
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 | addMemProfRecord (const GlobalValue::GUID Id, const memprof::IndexedMemProfRecord &Record) |
Add a memprof record for a function identified by its Id . More... | |
bool | addMemProfFrame (const memprof::FrameId, const memprof::Frame &F, function_ref< void(Error)> Warn) |
Add a memprof frame identified by the hash of the contents of the frame in FrameId . More... | |
void | mergeRecordsFromWriter (InstrProfWriter &&IPW, function_ref< void(Error)> Warn) |
Merge existing function counts from the given writer. More... | |
Error | 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... | |
Error | validateRecord (const InstrProfRecord &Func) |
std::unique_ptr< MemoryBuffer > | writeBuffer () |
Write the profile, returning the raw data. For testing. More... | |
Error | mergeProfileKind (const InstrProfKind Other) |
Update the attributes of the current profile from the attributes specified. More... | |
InstrProfKind | getProfileKind () const |
void | setValueProfDataEndianness (support::endianness Endianness) |
void | setOutputSparse (bool Sparse) |
void | overlapRecord (NamedInstrProfRecord &&Other, OverlapStats &Overlap, OverlapStats &FuncLevelOverlap, const OverlapFuncFilters &FuncFilter) |
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... | |
Definition at line 36 of file InstrProfWriter.h.
Definition at line 38 of file InstrProfWriter.h.
InstrProfWriter::InstrProfWriter | ( | bool | Sparse = false | ) |
Definition at line 173 of file InstrProfWriter.cpp.
InstrProfWriter::~InstrProfWriter | ( | ) |
Definition at line 176 of file InstrProfWriter.cpp.
bool InstrProfWriter::addMemProfFrame | ( | const memprof::FrameId | Id, |
const memprof::Frame & | F, | ||
function_ref< void(Error)> | Warn | ||
) |
Add a memprof frame identified by the hash of the contents of the frame in FrameId
.
Definition at line 267 of file InstrProfWriter.cpp.
References llvm::malformed.
Referenced by mergeRecordsFromWriter().
void InstrProfWriter::addMemProfRecord | ( | const GlobalValue::GUID | Id, |
const memprof::IndexedMemProfRecord & | Record | ||
) |
Add a memprof record for a function identified by its Id
.
Definition at line 256 of file InstrProfWriter.cpp.
References llvm::memprof::IndexedMemProfRecord::merge().
Referenced by mergeRecordsFromWriter().
|
inline |
Definition at line 69 of file InstrProfWriter.h.
References addRecord(), I, and move.
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 188 of file InstrProfWriter.cpp.
Referenced by addRecord(), and mergeRecordsFromWriter().
|
inline |
Definition at line 62 of file InstrProfWriter.h.
|
inline |
Definition at line 139 of file InstrProfWriter.h.
|
inline |
Update the attributes of the current profile from the attributes specified.
An error is returned if IR and FE profiles are mixed.
Definition at line 104 of file InstrProfWriter.h.
References B, llvm::FrontendInstrumentation, llvm::FunctionEntryInstrumentation, llvm::FunctionEntryOnly, Other, llvm::Error::success(), llvm::Unknown, and llvm::unsupported_version.
void InstrProfWriter::mergeRecordsFromWriter | ( | InstrProfWriter && | IPW, |
function_ref< void(Error)> | Warn | ||
) |
Merge existing function counts from the given writer.
Definition at line 283 of file InstrProfWriter.cpp.
References addMemProfFrame(), addMemProfRecord(), addRecord(), I, and move.
void InstrProfWriter::overlapRecord | ( | NamedInstrProfRecord && | Other, |
OverlapStats & | Overlap, | ||
OverlapStats & | FuncLevelOverlap, | ||
const OverlapFuncFilters & | FuncFilter | ||
) |
Definition at line 195 of file InstrProfWriter.cpp.
References llvm::OverlapStats::addOneMismatch(), llvm::OverlapStats::addOneUnique(), llvm::CountSumOrPercent::CountSum, llvm::OverlapFuncFilters::NameFilter, llvm::CountSumOrPercent::NumEntries, Other, llvm::OverlapStats::Overlap, llvm::InstrProfRecord::overlap(), llvm::OverlapStats::Test, and llvm::OverlapFuncFilters::ValueCutoff.
void InstrProfWriter::setOutputSparse | ( | bool | Sparse | ) |
Definition at line 184 of file InstrProfWriter.cpp.
void InstrProfWriter::setValueProfDataEndianness | ( | support::endianness | Endianness | ) |
Definition at line 179 of file InstrProfWriter.cpp.
References llvm::msgpack::Endianness, and llvm::InstrProfRecordWriterTrait::ValueProfDataEndianness.
Error InstrProfWriter::validateRecord | ( | const InstrProfRecord & | Func | ) |
Definition at line 525 of file InstrProfWriter.cpp.
References I, llvm::invalid_prof, S, and llvm::Error::success().
Referenced by writeText().
Error InstrProfWriter::write | ( | raw_fd_ostream & | OS | ) |
Write the profile to OS
.
Definition at line 503 of file InstrProfWriter.cpp.
std::unique_ptr< MemoryBuffer > InstrProfWriter::writeBuffer | ( | ) |
Write the profile, returning the raw data. For testing.
Definition at line 509 of file InstrProfWriter.cpp.
References llvm::Data, E, and llvm::MemoryBuffer::getMemBufferCopy().
|
static |
Write Record
in text format to OS
.
Definition at line 546 of file InstrProfWriter.cpp.
References llvm::InstrProfSymtab::getFuncNameOrExternalSymbol(), I, S, and ValueProfKindStr.
Referenced by writeText().
Error InstrProfWriter::writeText | ( | raw_fd_ostream & | OS | ) |
Write the profile in text format to OS
.
Definition at line 587 of file InstrProfWriter.cpp.
References llvm::InstrProfSymtab::addFuncName(), B, llvm::ContextSensitive, E, llvm::FunctionEntryInstrumentation, I, llvm::IRInstrumentation, llvm::sort(), llvm::Error::success(), validateRecord(), and writeRecordInText().