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
- public InstrProfSymtab()
- public llvm::Error addFuncName(llvm::StringRef FuncName)
- public template <typename NameIterRange>llvm::Error create(const NameIterRange & IterRange)
- public llvm::Error create(object::SectionRef & Section)
- public inline llvm::Error create(llvm::StringRef D, uint64_t BaseAddr)
- public inline llvm::Error create(llvm::StringRef NameStrings)
- public llvm::Error create(llvm::Module & M, bool InLTO = false)
- public void dumpNames(llvm::raw_ostream & OS) const
- private inline void finalizeSymtab()
- private static llvm::StringRef getExternalSymbol()
- public llvm::StringRef getFuncName(uint64_t FuncNameAddress, size_t NameSize)
- public inline llvm::StringRef getFuncName(uint64_t FuncMD5Hash)
- public inline llvm::StringRef getFuncNameOrExternalSymbol(uint64_t FuncMD5Hash)
- public inline llvm::Function * getFunction(uint64_t FuncMD5Hash)
- public uint64_t getFunctionHashFromAddress(uint64_t Address)
- public inline llvm::StringRef getNameData() const
- public inline llvm::StringRef getOrigFuncName(uint64_t FuncMD5Hash)
- public static bool isExternalSymbol(const llvm::StringRef & Symbol)
- public void mapAddress(uint64_t Addr, uint64_t MD5Val)
Methods
¶InstrProfSymtab()
InstrProfSymtab()
Declared at: llvm/include/llvm/ProfileData/InstrProf.h:471
¶llvm::Error addFuncName(llvm::StringRef FuncName)
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)
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)
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)
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)
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)
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
void dumpNames(llvm::raw_ostream& OS) const
Description
Dump the symbols in this table.
Declared at: llvm/include/llvm/ProfileData/InstrProf.h:555
Parameters
¶inline void finalizeSymtab()
inline void finalizeSymtab()
Declared at: llvm/include/llvm/ProfileData/InstrProf.h:468
¶static llvm::StringRef getExternalSymbol()
static llvm::StringRef getExternalSymbol()
Declared at: llvm/include/llvm/ProfileData/InstrProf.h:460
¶llvm::StringRef getFuncName(
uint64_t FuncNameAddress,
size_t NameSize)
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)
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)
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)
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)
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
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)
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)
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)
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