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

Methods

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()

Declared at: llvm/include/llvm/Transforms/Instrumentation/InstrProfiling.h:36

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::InstrProfValueProfileInst* Ins

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()

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()

Description

Emit the section with compressed function names.

Declared at: llvm/include/llvm/Transforms/Instrumentation/InstrProfiling.h:119

void emitRegistration()

Description

Emit runtime registration functions for each profile data variable.

Declared at: llvm/include/llvm/Transforms/Instrumentation/InstrProfiling.h:125

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()

Description

Add uses of our data variables and runtime hook.

Declared at: llvm/include/llvm/Transforms/Instrumentation/InstrProfiling.h:132

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)

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::InstrProfInstBase* I

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

llvm::InstrProfInstBase* Inc

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

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)

Description

Replace instrprof.cover with a store instruction to the coverage byte.

Declared at: llvm/include/llvm/Transforms/Instrumentation/InstrProfiling.h:96

Parameters

llvm::InstrProfCoverInst* Inc

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)

Description

Replace instrprof.increment with an increment of the appropriate value.

Declared at: llvm/include/llvm/Transforms/Instrumentation/InstrProfiling.h:99

Parameters

llvm::InstrProfIncrementInst* Inc

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

llvm::Function* F

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

llvm::InstrProfValueProfileInst* Ins

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

llvm::Function* F

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)

Declared at: llvm/include/llvm/Transforms/Instrumentation/InstrProfiling.h:40

Parameters

llvm::Module& M
llvm::ModuleAnalysisManager& AM