class InstrProfSymtab

Declaration

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

Description

A symbol table used for function PGO name look-up with keys (such as pointers, md5hash values) to the function. A function's PGO name or name's md5hash are used in retrieving the profile data of the function. See \c getPGOFuncName() method for details on how PGO name is formed.

Declared at: llvm/include/llvm/ProfileData/InstrProf.h:441

Member Variables

private llvm::StringRef Data
private uint64_t Address = 0
private StringSet<> NameTab
private std::vector<std::pair<uint64_t, StringRef>> MD5NameMap
private std::vector<std::pair<uint64_t, Function*>> MD5FuncMap
private llvm::InstrProfSymtab::AddrHashMap AddrToMD5Map
private bool Sorted = false

Method Overview

Methods

InstrProfSymtab()

Declared at: llvm/include/llvm/ProfileData/InstrProf.h:471

llvm::Error addFuncName(llvm::StringRef FuncName)

Description

Update the symtab by adding \p FuncName to the table. This interface is used by the raw and text profile readers.

Declared at: llvm/include/llvm/ProfileData/InstrProf.h:502

Parameters

llvm::StringRef FuncName

template <typename NameIterRange>
llvm::Error create(const NameIterRange& IterRange)

Description

Create InstrProfSymtab from a set of names iteratable from\p IterRange. This interface is used by IndexedProfReader.

Declared at: llvm/include/llvm/ProfileData/InstrProf.h:498

Templates

NameIterRange

Parameters

const NameIterRange& IterRange

llvm::Error create(object::SectionRef& Section)

Description

Create InstrProfSymtab from an object file section which contains function PGO names. When section may contain raw string data or string data in compressed form. This method only initialize the symtab with reference to the data and the section base address. The decompression will be delayed until before it is used. See also \c create(StringRef) method.

Declared at: llvm/include/llvm/ProfileData/InstrProf.h:479

Parameters

object::SectionRef& Section

inline llvm::Error create(llvm::StringRef D,
                          uint64_t BaseAddr)

Description

This interface is used by reader of CoverageMapping test format.

Declared at: llvm/include/llvm/ProfileData/InstrProf.h:483

Parameters

llvm::StringRef D
uint64_t BaseAddr

inline llvm::Error create(
    llvm::StringRef NameStrings)

Description

\c NameStrings is a string composed of one of more sub-strings encoded in the format described in \c collectPGOFuncNameStrings. This method is a wrapper to \c readPGOFuncNameStrings method.

Declared at: llvm/include/llvm/ProfileData/InstrProf.h:488

Parameters

llvm::StringRef NameStrings

llvm::Error create(llvm::Module& M,
                   bool InLTO = false)

Description

A wrapper interface to populate the PGO symtab with functions decls from module \c M. This interface is used by transformation passes such as indirect function call promotion. Variable \c InLTO indicates if this is called from LTO optimization passes.

Declared at: llvm/include/llvm/ProfileData/InstrProf.h:494

Parameters

llvm::Module& M
bool InLTO = false

void dumpNames(llvm::raw_ostream& OS) const

Description

Dump the symbols in this table.

Declared at: llvm/include/llvm/ProfileData/InstrProf.h:555

Parameters

llvm::raw_ostream& OS

inline void finalizeSymtab()

Declared at: llvm/include/llvm/ProfileData/InstrProf.h:468

static llvm::StringRef getExternalSymbol()

Declared at: llvm/include/llvm/ProfileData/InstrProf.h:460

llvm::StringRef getFuncName(
    uint64_t FuncNameAddress,
    size_t NameSize)

Description

Return function's PGO name from the function name's symbol address in the object file. If an error occurs, return an empty string.

Declared at: llvm/include/llvm/ProfileData/InstrProf.h:527

Parameters

uint64_t FuncNameAddress
size_t NameSize

inline llvm::StringRef getFuncName(
    uint64_t FuncMD5Hash)

Description

Return function's PGO name from the name's md5 hash value. If not found, return an empty string.

Declared at: llvm/include/llvm/ProfileData/InstrProf.h:531

Parameters

uint64_t FuncMD5Hash

inline llvm::StringRef
getFuncNameOrExternalSymbol(uint64_t FuncMD5Hash)

Description

Just like getFuncName, except that it will return a non-empty StringRef if the function is external to this symbol table. All such cases will be represented using the same StringRef value.

Declared at: llvm/include/llvm/ProfileData/InstrProf.h:536

Parameters

uint64_t FuncMD5Hash

inline llvm::Function* getFunction(
    uint64_t FuncMD5Hash)

Description

Return function from the name's md5 hash. Return nullptr if not found.

Declared at: llvm/include/llvm/ProfileData/InstrProf.h:544

Parameters

uint64_t FuncMD5Hash

uint64_t getFunctionHashFromAddress(
    uint64_t Address)

Description

Return a function's hash, or 0, if the function isn't in this SymTab.

Declared at: llvm/include/llvm/ProfileData/InstrProf.h:522

Parameters

uint64_t Address

inline llvm::StringRef getNameData() const

Description

Return the name section data.

Declared at: llvm/include/llvm/ProfileData/InstrProf.h:552

inline llvm::StringRef getOrigFuncName(
    uint64_t FuncMD5Hash)

Description

Return the function's original assembly name by stripping off the prefix attached (to symbols with priviate linkage). For global functions, it returns the same string as getFuncName.

Declared at: llvm/include/llvm/ProfileData/InstrProf.h:549

Parameters

uint64_t FuncMD5Hash

static bool isExternalSymbol(
    const llvm::StringRef& Symbol)

Description

True if Symbol is the value used to represent external symbols.

Declared at: llvm/include/llvm/ProfileData/InstrProf.h:539

Parameters

const llvm::StringRef& Symbol

void mapAddress(uint64_t Addr, uint64_t MD5Val)

Description

Map a function address to its name's MD5 hash. This interface is only used by the raw profiler reader.

Declared at: llvm/include/llvm/ProfileData/InstrProf.h:517

Parameters

uint64_t Addr
uint64_t MD5Val