class InstrProfWriter

Declaration

class InstrProfWriter { /* full declaration omitted */ };

Declared at: llvm/include/llvm/ProfileData/InstrProfWriter.h:36

Member Variables

private bool Sparse
private StringMap<llvm::InstrProfWriter::ProfilingData> FunctionData
private llvm::MapVector<GlobalValue::GUID, memprof::IndexedMemProfRecord> MemProfRecordData
private llvm::MapVector<memprof::FrameId, memprof::Frame> MemProfFrameData
private llvm::InstrProfKind ProfileKind = InstrProfKind::Unknown
private llvm::InstrProfRecordWriterTrait* InfoObj

Method Overview

  • public InstrProfWriter(bool Sparse = false)
  • public bool addMemProfFrame(const memprof::FrameId, const memprof::Frame & F, function_ref<void (llvm::Error)> Warn)
  • public void addMemProfRecord(const GlobalValue::GUID Id, const memprof::IndexedMemProfRecord & Record)
  • public void addRecord(llvm::NamedInstrProfRecord && I, uint64_t Weight, function_ref<void (llvm::Error)> Warn)
  • public void addRecord(llvm::NamedInstrProfRecord && I, function_ref<void (llvm::Error)> Warn)
  • private void addRecord(llvm::StringRef Name, uint64_t Hash, llvm::InstrProfRecord && I, uint64_t Weight, function_ref<void (llvm::Error)> Warn)
  • public StringMap<llvm::InstrProfWriter::ProfilingData> & getProfileData()
  • public llvm::InstrProfKind getProfileKind() const
  • public llvm::Error mergeProfileKind(const llvm::InstrProfKind Other)
  • public void mergeRecordsFromWriter(llvm::InstrProfWriter && IPW, function_ref<void (llvm::Error)> Warn)
  • public void overlapRecord(llvm::NamedInstrProfRecord && Other, llvm::OverlapStats & Overlap, llvm::OverlapStats & FuncLevelOverlap, const llvm::OverlapFuncFilters & FuncFilter)
  • public void setOutputSparse(bool Sparse)
  • public void setValueProfDataEndianness(support::endianness Endianness)
  • private bool shouldEncodeData(const llvm::InstrProfWriter::ProfilingData & PD)
  • public llvm::Error validateRecord(const llvm::InstrProfRecord & Func)
  • public llvm::Error write(llvm::raw_fd_ostream & OS)
  • public std::unique_ptr<MemoryBuffer> writeBuffer()
  • private llvm::Error writeImpl(llvm::ProfOStream & OS)
  • public static void writeRecordInText(llvm::StringRef Name, uint64_t Hash, const llvm::InstrProfRecord & Counters, llvm::InstrProfSymtab & Symtab, llvm::raw_fd_ostream & OS)
  • public llvm::Error writeText(llvm::raw_fd_ostream & OS)
  • public ~InstrProfWriter()

Methods

InstrProfWriter(bool Sparse = false)

Declared at: llvm/include/llvm/ProfileData/InstrProfWriter.h:59

Parameters

bool Sparse = false

bool addMemProfFrame(
    const memprof::FrameId,
    const memprof::Frame& F,
    function_ref<void(llvm::Error)> Warn)

Description

Add a memprof frame identified by the hash of the contents of the frame in\p FrameId.

Declared at: llvm/include/llvm/ProfileData/InstrProfWriter.h:79

Parameters

const memprof::FrameId
const memprof::Frame& F
function_ref<void(llvm::Error)> Warn

void addMemProfRecord(
    const GlobalValue::GUID Id,
    const memprof::IndexedMemProfRecord& Record)

Description

Add a memprof record for a function identified by its \p Id.

Declared at: llvm/include/llvm/ProfileData/InstrProfWriter.h:74

Parameters

const GlobalValue::GUID Id
const memprof::IndexedMemProfRecord& Record

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

Description

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 \p Weight.

Declared at: llvm/include/llvm/ProfileData/InstrProfWriter.h:67

Parameters

llvm::NamedInstrProfRecord&& I
uint64_t Weight
function_ref<void(llvm::Error)> Warn

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

Declared at: llvm/include/llvm/ProfileData/InstrProfWriter.h:69

Parameters

llvm::NamedInstrProfRecord&& I
function_ref<void(llvm::Error)> Warn

void addRecord(
    llvm::StringRef Name,
    uint64_t Hash,
    llvm::InstrProfRecord&& I,
    uint64_t Weight,
    function_ref<void(llvm::Error)> Warn)

Declared at: llvm/include/llvm/ProfileData/InstrProfWriter.h:151

Parameters

llvm::StringRef Name
uint64_t Hash
llvm::InstrProfRecord&& I
uint64_t Weight
function_ref<void(llvm::Error)> Warn

StringMap<llvm::InstrProfWriter::ProfilingData>&
getProfileData()

Declared at: llvm/include/llvm/ProfileData/InstrProfWriter.h:62

llvm::InstrProfKind getProfileKind() const

Declared at: llvm/include/llvm/ProfileData/InstrProfWriter.h:139

llvm::Error mergeProfileKind(
    const llvm::InstrProfKind Other)

Description

Update the attributes of the current profile from the attributes specified. An error is returned if IR and FE profiles are mixed.

Declared at: llvm/include/llvm/ProfileData/InstrProfWriter.h:104

Parameters

const llvm::InstrProfKind Other

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

Description

Merge existing function counts from the given writer.

Declared at: llvm/include/llvm/ProfileData/InstrProfWriter.h:83

Parameters

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

void overlapRecord(
    llvm::NamedInstrProfRecord&& Other,
    llvm::OverlapStats& Overlap,
    llvm::OverlapStats& FuncLevelOverlap,
    const llvm::OverlapFuncFilters& FuncFilter)

Declared at: llvm/include/llvm/ProfileData/InstrProfWriter.h:146

Parameters

llvm::NamedInstrProfRecord&& Other
llvm::OverlapStats& Overlap
llvm::OverlapStats& FuncLevelOverlap
const llvm::OverlapFuncFilters& FuncFilter

void setOutputSparse(bool Sparse)

Declared at: llvm/include/llvm/ProfileData/InstrProfWriter.h:143

Parameters

bool Sparse

void setValueProfDataEndianness(
    support::endianness Endianness)

Declared at: llvm/include/llvm/ProfileData/InstrProfWriter.h:142

Parameters

support::endianness Endianness

bool shouldEncodeData(
    const llvm::InstrProfWriter::ProfilingData&
        PD)

Declared at: llvm/include/llvm/ProfileData/InstrProfWriter.h:153

Parameters

const llvm::InstrProfWriter::ProfilingData& PD

llvm::Error validateRecord(
    const llvm::InstrProfRecord& Func)

Declared at: llvm/include/llvm/ProfileData/InstrProfWriter.h:92

Parameters

const llvm::InstrProfRecord& Func

llvm::Error write(llvm::raw_fd_ostream& OS)

Description

Write the profile to \c OS

Declared at: llvm/include/llvm/ProfileData/InstrProfWriter.h:87

Parameters

llvm::raw_fd_ostream& OS

std::unique_ptr<MemoryBuffer> writeBuffer()

Description

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

Declared at: llvm/include/llvm/ProfileData/InstrProfWriter.h:100

llvm::Error writeImpl(llvm::ProfOStream& OS)

Declared at: llvm/include/llvm/ProfileData/InstrProfWriter.h:155

Parameters

llvm::ProfOStream& OS

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

Description

Write \c Record in text format to \c OS

Declared at: llvm/include/llvm/ProfileData/InstrProfWriter.h:95

Parameters

llvm::StringRef Name
uint64_t Hash
const llvm::InstrProfRecord& Counters
llvm::InstrProfSymtab& Symtab
llvm::raw_fd_ostream& OS

llvm::Error writeText(llvm::raw_fd_ostream& OS)

Description

Write the profile in text format to \c OS

Declared at: llvm/include/llvm/ProfileData/InstrProfWriter.h:90

Parameters

llvm::raw_fd_ostream& OS

~InstrProfWriter()

Declared at: llvm/include/llvm/ProfileData/InstrProfWriter.h:60