LLVM 20.0.0git
Classes | Namespaces | Macros | Enumerations | Functions | Variables
InstrProf.h File Reference
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/BitmaskEnum.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/IntervalMap.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/ProfileSummary.h"
#include "llvm/ProfileData/InstrProfData.inc"
#include "llvm/Support/BalancedPartitioning.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MD5.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/TargetParser/Host.h"
#include "llvm/TargetParser/Triple.h"
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <cstring>
#include <list>
#include <memory>
#include <string>
#include <system_error>
#include <utility>
#include <vector>

Go to the source code of this file.

Classes

struct  llvm::TemporalProfTraceTy
 An ordered list of functions identified by their NameRef found in INSTR_PROF_DATA. More...
 
class  llvm::InstrProfError
 
class  llvm::InstrProfSymtab
 A symbol table used for function [IR]PGO name look-up with keys (such as pointers, md5hash values) to the function. More...
 
struct  llvm::CountSumOrPercent
 
struct  llvm::OverlapStats
 
struct  llvm::OverlapFuncFilters
 
struct  llvm::InstrProfValueSiteRecord
 
struct  llvm::InstrProfRecord
 Profiling information for a single function. More...
 
struct  llvm::NamedInstrProfRecord
 
struct  llvm::IndexedInstrProf::Header
 
struct  llvm::IndexedInstrProf::Summary
 
struct  llvm::IndexedInstrProf::Summary::Entry
 
struct  llvm::RawInstrProf::ProfileData< IntPtrT >
 
struct  llvm::RawInstrProf::VTableProfileData< IntPtrT >
 
struct  llvm::RawInstrProf::Header
 

Namespaces

namespace  llvm
 This is an optimization pass for GlobalISel generic memory operations.
 
namespace  llvm::object
 
namespace  llvm::IndexedInstrProf
 
namespace  llvm::RawInstrProf
 

Macros

#define INSTR_PROF_SECT_ENTRY(Kind, SectNameCommon, SectNameCoff, Prefix)   Kind,
 
#define VALUE_PROF_KIND(Enumerator, Value, Descr)   Enumerator = Value,
 
#define INSTR_PROF_VALUE_PROF_DATA
 
#define INSTR_PROF_DATA(Type, LLVMType, Name, Init)   Type Name;
 
#define INSTR_PROF_VTABLE_DATA(Type, LLVMType, Name, Init)   Type Name;
 
#define INSTR_PROF_RAW_HEADER(Type, Name, Init)   const Type Name;
 

Enumerations

enum  llvm::InstrProfSectKind
 
enum  llvm::InstrProfValueKind : uint32_t
 
enum class  llvm::InstrProfKind {
  llvm::Unknown = 0x0 , llvm::FrontendInstrumentation = 0x1 , llvm::IRInstrumentation = 0x2 , llvm::FunctionEntryInstrumentation = 0x4 ,
  llvm::ContextSensitive = 0x8 , llvm::SingleByteCoverage = 0x10 , llvm::FunctionEntryOnly = 0x20 , llvm::MemProf = 0x40 ,
  llvm::TemporalProfile = 0x80
}
 An enum describing the attributes of an instrumented profile. More...
 
enum class  llvm::instrprof_error {
  llvm::success = 0 , llvm::eof , llvm::unrecognized_format , llvm::bad_magic ,
  llvm::bad_header , llvm::unsupported_version , llvm::unsupported_hash_type , llvm::too_large ,
  llvm::truncated , llvm::malformed , llvm::missing_correlation_info , llvm::unexpected_correlation_info ,
  llvm::unable_to_correlate_profile , llvm::unknown_function , llvm::invalid_prof , llvm::hash_mismatch ,
  llvm::count_mismatch , llvm::bitmap_mismatch , llvm::counter_overflow , llvm::value_site_count_mismatch ,
  llvm::compress_failed , llvm::uncompress_failed , llvm::empty_raw_profile , llvm::zlib_unavailable ,
  llvm::raw_profile_version_mismatch , llvm::counter_value_too_large
}
 
enum class  llvm::IndexedInstrProf::HashT : uint32_t { llvm::IndexedInstrProf::MD5 , llvm::IndexedInstrProf::Last = MD5 }
 
enum  llvm::IndexedInstrProf::ProfVersion {
  llvm::IndexedInstrProf::Version1 = 1 , llvm::IndexedInstrProf::Version2 = 2 , llvm::IndexedInstrProf::Version3 = 3 , llvm::IndexedInstrProf::Version4 = 4 ,
  llvm::IndexedInstrProf::Version5 = 5 , llvm::IndexedInstrProf::Version6 = 6 , llvm::IndexedInstrProf::Version7 = 7 , llvm::IndexedInstrProf::Version8 = 8 ,
  llvm::IndexedInstrProf::Version9 = 9 , llvm::IndexedInstrProf::Version10 = 10 , llvm::IndexedInstrProf::Version11 = 11 , llvm::IndexedInstrProf::Version12 = 12 ,
  llvm::IndexedInstrProf::CurrentVersion = INSTR_PROF_INDEX_VERSION
}
 

Functions

uint64_t llvm::getInstrMaxCountValue ()
 Return the max count value. We reserver a few large values for special use.
 
std::string llvm::getInstrProfSectionName (InstrProfSectKind IPSK, Triple::ObjectFormatType OF, bool AddSegmentInfo=true)
 Return the name of the profile section corresponding to IPSK.
 
StringRef llvm::getInstrProfValueProfFuncName ()
 Return the name profile runtime entry point to do value profiling for a given site.
 
StringRef llvm::getInstrProfValueProfMemOpFuncName ()
 Return the name profile runtime entry point to do memop size value profiling.
 
StringRef llvm::getInstrProfNameVarPrefix ()
 Return the name prefix of variables containing instrumented function names.
 
StringRef llvm::getInstrProfVTableVarPrefix ()
 Return the name prefix of variables containing virtual table profile data.
 
StringRef llvm::getInstrProfDataVarPrefix ()
 Return the name prefix of variables containing per-function control data.
 
StringRef llvm::getInstrProfCountersVarPrefix ()
 Return the name prefix of profile counter variables.
 
StringRef llvm::getInstrProfBitmapVarPrefix ()
 Return the name prefix of profile bitmap variables.
 
StringRef llvm::getInstrProfValuesVarPrefix ()
 Return the name prefix of value profile variables.
 
StringRef llvm::getInstrProfVNodesVarName ()
 Return the name of value profile node array variables:
 
StringRef llvm::getInstrProfNamesVarName ()
 Return the name of the variable holding the strings (possibly compressed) of all function's PGO names.
 
StringRef llvm::getInstrProfVTableNamesVarName ()
 
StringRef llvm::getCoverageMappingVarName ()
 Return the name of a covarage mapping variable (internal linkage) for each instrumented source module.
 
StringRef llvm::getCoverageUnusedNamesVarName ()
 Return the name of the internal variable recording the array of PGO name vars referenced by the coverage mapping.
 
StringRef llvm::getInstrProfRegFuncsName ()
 Return the name of function that registers all the per-function control data at program startup time by calling __llvm_register_function.
 
StringRef llvm::getInstrProfRegFuncName ()
 Return the name of the runtime interface that registers per-function control data for one instrumented function.
 
StringRef llvm::getInstrProfNamesRegFuncName ()
 Return the name of the runtime interface that registers the PGO name strings.
 
StringRef llvm::getInstrProfInitFuncName ()
 Return the name of the runtime initialization method that is generated by the compiler.
 
StringRef llvm::getInstrProfRuntimeHookVarName ()
 Return the name of the hook variable defined in profile runtime library.
 
StringRef llvm::getInstrProfRuntimeHookVarUseFuncName ()
 Return the name of the compiler generated function that references the runtime hook variable.
 
StringRef llvm::getInstrProfCounterBiasVarName ()
 
StringRef llvm::getInstrProfBitmapBiasVarName ()
 
StringRef llvm::getInstrProfNameSeparator ()
 Return the marker used to separate PGO names during serialization.
 
std::string llvm::getPGOFuncName (const Function &F, bool InLTO=false, uint64_t Version=INSTR_PROF_INDEX_VERSION)
 Please use getIRPGOFuncName for LLVM IR instrumentation.
 
std::string llvm::getPGOFuncName (StringRef RawFuncName, GlobalValue::LinkageTypes Linkage, StringRef FileName, uint64_t Version=INSTR_PROF_INDEX_VERSION)
 Return the modified name for a function suitable to be used the key for profile lookup.
 
std::string llvm::getIRPGOFuncName (const Function &F, bool InLTO=false)
 
std::pair< StringRef, StringRefllvm::getParsedIRPGOName (StringRef IRPGOName)
 
std::string llvm::getPGOFuncNameVarName (StringRef FuncName, GlobalValue::LinkageTypes Linkage)
 Return the name of the global variable used to store a function name in PGO instrumentation.
 
GlobalVariablellvm::createPGOFuncNameVar (Function &F, StringRef PGOFuncName)
 Create and return the global variable for function name used in PGO instrumentation.
 
GlobalVariablellvm::createPGOFuncNameVar (Module &M, GlobalValue::LinkageTypes Linkage, StringRef PGOFuncName)
 Create and return the global variable for function name used in PGO instrumentation.
 
StringRef llvm::getPGOFuncNameVarInitializer (GlobalVariable *NameVar)
 Return the initializer in string of the PGO name var NameVar.
 
StringRef llvm::getFuncNameWithoutPrefix (StringRef PGOFuncName, StringRef FileName="<unknown>")
 Given a PGO function name, remove the filename prefix and return the original (static) function name.
 
Error llvm::collectGlobalObjectNameStrings (ArrayRef< std::string > NameStrs, bool doCompression, std::string &Result)
 Given a vector of strings (names of global objects like functions or, virtual tables) NameStrs, the method generates a combined string Result that is ready to be serialized.
 
Error llvm::collectPGOFuncNameStrings (ArrayRef< GlobalVariable * > NameVars, std::string &Result, bool doCompression=true)
 Produce Result string with the same format described above.
 
Error llvm::collectVTableStrings (ArrayRef< GlobalVariable * > VTables, std::string &Result, bool doCompression)
 
bool llvm::isIRPGOFlagSet (const Module *M)
 Check if INSTR_PROF_RAW_VERSION_VAR is defined.
 
bool llvm::canRenameComdatFunc (const Function &F, bool CheckAddressTaken=false)
 Check if we can safely rename this Comdat function.
 
void llvm::annotateValueSite (Module &M, Instruction &Inst, const InstrProfRecord &InstrProfR, InstrProfValueKind ValueKind, uint32_t SiteIndx, uint32_t MaxMDCount=3)
 Get the value profile data for value site SiteIdx from InstrProfR and annotate the instruction Inst with the value profile meta data.
 
void llvm::annotateValueSite (Module &M, Instruction &Inst, ArrayRef< InstrProfValueData > VDs, uint64_t Sum, InstrProfValueKind ValueKind, uint32_t MaxMDCount)
 Same as the above interface but using an ArrayRef, as well as Sum.
 
SmallVector< InstrProfValueData, 4 > llvm::getValueProfDataFromInst (const Instruction &Inst, InstrProfValueKind ValueKind, uint32_t MaxNumValueData, uint64_t &TotalC, bool GetNoICPValue=false)
 Extract the value profile data from Inst and returns them if Inst is annotated with value profile data.
 
StringRef llvm::getPGOFuncNameMetadataName ()
 
StringRef llvm::getPGONameMetadataName ()
 
MDNodellvm::getPGOFuncNameMetadata (const Function &F)
 Return the PGOFuncName meta data associated with a function.
 
std::string llvm::getPGOName (const GlobalVariable &V, bool InLTO=false)
 
void llvm::createPGOFuncNameMetadata (Function &F, StringRef PGOFuncName)
 Create the PGOFuncName meta data if PGOFuncName is different from function's raw name.
 
void llvm::createPGONameMetadata (GlobalObject &GO, StringRef PGOName)
 Create the PGOName metadata if a global object's PGO name is different from its mangled name.
 
bool llvm::needsComdatForCounter (const GlobalObject &GV, const Module &M)
 Check if we can use Comdat for profile variables.
 
const std::error_category & llvm::instrprof_category ()
 
std::error_code llvm::make_error_code (instrprof_error E)
 
uint64_t llvm::IndexedInstrProf::ComputeHash (StringRef K)
 
uint64_t llvm::IndexedInstrProf::ComputeHash (HashT Type, StringRef K)
 
std::unique_ptr< Summary > llvm::IndexedInstrProf::allocSummary (uint32_t TotalSize)
 
template<class IntPtrT >
uint64_t llvm::RawInstrProf::getMagic ()
 
template<>
uint64_t llvm::RawInstrProf::getMagic< uint64_t > ()
 
template<>
uint64_t llvm::RawInstrProf::getMagic< uint32_t > ()
 
void llvm::createProfileFileNameVar (Module &M, StringRef InstrProfileOutput)
 

Variables

const uint64_t llvm::IndexedInstrProf::Magic = 0x8169666f72706cff
 
const uint64_t llvm::IndexedInstrProf::Version = ProfVersion::CurrentVersion
 
const HashT llvm::IndexedInstrProf::HashType = HashT::MD5
 
const uint64_t llvm::RawInstrProf::Version = INSTR_PROF_RAW_VERSION
 
cl::opt< boolllvm::DoInstrProfNameCompression
 

Macro Definition Documentation

◆ INSTR_PROF_DATA

#define INSTR_PROF_DATA (   Type,
  LLVMType,
  Name,
  Init 
)    Type Name;

Definition at line 1274 of file InstrProf.h.

◆ INSTR_PROF_RAW_HEADER

#define INSTR_PROF_RAW_HEADER (   Type,
  Name,
  Init 
)    const Type Name;

Definition at line 1288 of file InstrProf.h.

◆ INSTR_PROF_SECT_ENTRY

#define INSTR_PROF_SECT_ENTRY (   Kind,
  SectNameCommon,
  SectNameCoff,
  Prefix 
)    Kind,

Definition at line 61 of file InstrProf.h.

◆ INSTR_PROF_VALUE_PROF_DATA

#define INSTR_PROF_VALUE_PROF_DATA

Definition at line 1043 of file InstrProf.h.

◆ INSTR_PROF_VTABLE_DATA

#define INSTR_PROF_VTABLE_DATA (   Type,
  LLVMType,
  Name,
  Init 
)    Type Name;

Definition at line 1279 of file InstrProf.h.

◆ VALUE_PROF_KIND

#define VALUE_PROF_KIND (   Enumerator,
  Value,
  Descr 
)    Enumerator = Value,

Definition at line 272 of file InstrProf.h.