class InstrProfiling
Declaration
class InstrProfiling : public PassInfoMixin { /* full declaration omitted */ };
Description
Instrumentation based profiling lowering pass. This pass lowers the profile instrumented code generated by FE or the IR based instrumentation pass.
Declared at: llvm/include/llvm/Transforms/Instrumentation/InstrProfiling.h:34
Inherits from: PassInfoMixin
Member Variables
- private llvm::InstrProfOptions Options
- private llvm::Module* M
- private llvm::Triple TT
- private std::function<const TargetLibraryInfo&(Function&)> GetTLI
- private DenseMap< llvm::GlobalVariable*, llvm::InstrProfiling::PerFunctionProfileData> ProfileDataMap
- private DenseMap<const llvm::Function*, llvm::LoadInst*> FunctionToProfileBiasMap
- If runtime relocation is enabled, this maps functions to the load instruction that produces the profile relocation bias.
- private std::vector<GlobalValue*> CompilerUsedVars
- private std::vector<GlobalValue*> UsedVars
- private std::vector<GlobalVariable*> ReferencedNames
- private llvm::GlobalVariable* NamesVar
- private size_t NamesSize
- private bool IsCS
- private std::vector<LoadStorePair> PromotionCandidates
- private int64_t TotalCountersPromoted = 0
Method Overview
- public InstrProfiling(const llvm::InstrProfOptions & Options, bool IsCS = false)
- public InstrProfiling()
- private void computeNumValueSiteCounts(llvm::InstrProfValueProfileInst * Ins)
- private llvm::GlobalVariable * createRegionCounters(llvm::InstrProfInstBase * Inc, llvm::StringRef Name, GlobalValue::LinkageTypes Linkage)
- private void emitInitialization()
- private void emitNameData()
- private void emitRegistration()
- private bool emitRuntimeHook()
- private void emitUses()
- private void emitVNodes()
- private llvm::Value * getCounterAddress(llvm::InstrProfInstBase * I)
- private llvm::GlobalVariable * getOrCreateRegionCounters(llvm::InstrProfInstBase * Inc)
- private bool isCounterPromotionEnabled() const
- private bool isRuntimeCounterRelocationEnabled() const
- private void lowerCover(llvm::InstrProfCoverInst * Inc)
- private void lowerCoverageData(llvm::GlobalVariable * CoverageNamesVar)
- private void lowerIncrement(llvm::InstrProfIncrementInst * Inc)
- private bool lowerIntrinsics(llvm::Function * F)
- private void lowerValueProfileInst(llvm::InstrProfValueProfileInst * Ins)
- private void promoteCounterLoadStores(llvm::Function * F)
- public bool run(llvm::Module & M, std::function<const TargetLibraryInfo &(Function &)> GetTLI)
- public llvm::PreservedAnalyses run(llvm::Module & M, llvm::ModuleAnalysisManager & AM)
Methods
¶InstrProfiling(
const llvm::InstrProfOptions& Options,
bool IsCS = false)
InstrProfiling(
const llvm::InstrProfOptions& Options,
bool IsCS = false)
Declared at: llvm/include/llvm/Transforms/Instrumentation/InstrProfiling.h:37
Parameters
- const llvm::InstrProfOptions& Options
- bool IsCS = false
¶InstrProfiling()
InstrProfiling()
Declared at: llvm/include/llvm/Transforms/Instrumentation/InstrProfiling.h:36
¶void computeNumValueSiteCounts(
llvm::InstrProfValueProfileInst* Ins)
void computeNumValueSiteCounts(
llvm::InstrProfValueProfileInst* Ins)
Description
Count the number of instrumented value sites for the function.
Declared at: llvm/include/llvm/Transforms/Instrumentation/InstrProfiling.h:90
Parameters
¶llvm::GlobalVariable* createRegionCounters(
llvm::InstrProfInstBase* Inc,
llvm::StringRef Name,
GlobalValue::LinkageTypes Linkage)
llvm::GlobalVariable* createRegionCounters(
llvm::InstrProfInstBase* Inc,
llvm::StringRef Name,
GlobalValue::LinkageTypes Linkage)
Description
Create the region counters.
Declared at: llvm/include/llvm/Transforms/Instrumentation/InstrProfiling.h:115
Parameters
- llvm::InstrProfInstBase* Inc
- llvm::StringRef Name
- GlobalValue::LinkageTypes Linkage
¶void emitInitialization()
void emitInitialization()
Description
Create a static initializer for our data, on platforms that need it, and for any profile output file that was specified.
Declared at: llvm/include/llvm/Transforms/Instrumentation/InstrProfiling.h:136
¶void emitNameData()
void emitNameData()
Description
Emit the section with compressed function names.
Declared at: llvm/include/llvm/Transforms/Instrumentation/InstrProfiling.h:119
¶void emitRegistration()
void emitRegistration()
Description
Emit runtime registration functions for each profile data variable.
Declared at: llvm/include/llvm/Transforms/Instrumentation/InstrProfiling.h:125
¶bool emitRuntimeHook()
bool emitRuntimeHook()
Description
Emit the necessary plumbing to pull in the runtime initialization. Returns true if a change was made.
Declared at: llvm/include/llvm/Transforms/Instrumentation/InstrProfiling.h:129
¶void emitUses()
void emitUses()
Description
Add uses of our data variables and runtime hook.
Declared at: llvm/include/llvm/Transforms/Instrumentation/InstrProfiling.h:132
¶void emitVNodes()
void emitVNodes()
Description
Emit value nodes section for value profiling.
Declared at: llvm/include/llvm/Transforms/Instrumentation/InstrProfiling.h:122
¶llvm::Value* getCounterAddress(
llvm::InstrProfInstBase* I)
llvm::Value* getCounterAddress(
llvm::InstrProfInstBase* I)
Description
Compute the address of the counter value that this profiling instruction acts on.
Declared at: llvm/include/llvm/Transforms/Instrumentation/InstrProfiling.h:106
Parameters
¶llvm::GlobalVariable* getOrCreateRegionCounters(
llvm::InstrProfInstBase* Inc)
llvm::GlobalVariable* getOrCreateRegionCounters(
llvm::InstrProfInstBase* Inc)
Description
Get the region counters for an increment, creating them if necessary. If the counter array doesn't yet exist, the profile data variables referring to them will also be created.
Declared at: llvm/include/llvm/Transforms/Instrumentation/InstrProfiling.h:112
Parameters
¶bool isCounterPromotionEnabled() const
bool isCounterPromotionEnabled() const
Description
Returns true if profile counter update register promotion is enabled.
Declared at: llvm/include/llvm/Transforms/Instrumentation/InstrProfiling.h:87
¶bool isRuntimeCounterRelocationEnabled() const
bool isRuntimeCounterRelocationEnabled() const
Description
Returns true if relocating counters at runtime is enabled.
Declared at: llvm/include/llvm/Transforms/Instrumentation/InstrProfiling.h:84
¶void lowerCover(llvm::InstrProfCoverInst* Inc)
void lowerCover(llvm::InstrProfCoverInst* Inc)
Description
Replace instrprof.cover with a store instruction to the coverage byte.
Declared at: llvm/include/llvm/Transforms/Instrumentation/InstrProfiling.h:96
Parameters
¶void lowerCoverageData(
llvm::GlobalVariable* CoverageNamesVar)
void lowerCoverageData(
llvm::GlobalVariable* CoverageNamesVar)
Description
Force emitting of name vars for unused functions.
Declared at: llvm/include/llvm/Transforms/Instrumentation/InstrProfiling.h:102
Parameters
- llvm::GlobalVariable* CoverageNamesVar
¶void lowerIncrement(
llvm::InstrProfIncrementInst* Inc)
void lowerIncrement(
llvm::InstrProfIncrementInst* Inc)
Description
Replace instrprof.increment with an increment of the appropriate value.
Declared at: llvm/include/llvm/Transforms/Instrumentation/InstrProfiling.h:99
Parameters
¶bool lowerIntrinsics(llvm::Function* F)
bool lowerIntrinsics(llvm::Function* F)
Description
Lower instrumentation intrinsics in the function. Returns true if there any lowering.
Declared at: llvm/include/llvm/Transforms/Instrumentation/InstrProfiling.h:78
Parameters
¶void lowerValueProfileInst(
llvm::InstrProfValueProfileInst* Ins)
void lowerValueProfileInst(
llvm::InstrProfValueProfileInst* Ins)
Description
Replace instrprof.value.profile with a call to runtime library.
Declared at: llvm/include/llvm/Transforms/Instrumentation/InstrProfiling.h:93
Parameters
¶void promoteCounterLoadStores(llvm::Function* F)
void promoteCounterLoadStores(llvm::Function* F)
Description
Register-promote counter loads and stores in loops.
Declared at: llvm/include/llvm/Transforms/Instrumentation/InstrProfiling.h:81
Parameters
¶bool run(llvm::Module& M,
std::function<const TargetLibraryInfo&(
Function&)> GetTLI)
bool run(llvm::Module& M,
std::function<const TargetLibraryInfo&(
Function&)> GetTLI)
Declared at: llvm/include/llvm/Transforms/Instrumentation/InstrProfiling.h:41
Parameters
- llvm::Module& M
- std::function<const TargetLibraryInfo&(Function&)> GetTLI
¶llvm::PreservedAnalyses run(
llvm::Module& M,
llvm::ModuleAnalysisManager& AM)
llvm::PreservedAnalyses run(
llvm::Module& M,
llvm::ModuleAnalysisManager& AM)
Declared at: llvm/include/llvm/Transforms/Instrumentation/InstrProfiling.h:40