13#ifndef LLVM_TRANSFORMS_INSTRUMENTATION_INSTRPROFILING_H
14#define LLVM_TRANSFORMS_INSTRUMENTATION_INSTRPROFILING_H
28class TargetLibraryInfo;
49 struct PerFunctionProfileData {
50 uint32_t NumValueSites[IPVK_Last + 1];
54 PerFunctionProfileData() {
55 memset(NumValueSites, 0,
sizeof(
uint32_t) * (IPVK_Last + 1));
58 DenseMap<GlobalVariable *, PerFunctionProfileData> ProfileDataMap;
61 DenseMap<const Function *, LoadInst *> FunctionToProfileBiasMap;
62 std::vector<GlobalValue *> CompilerUsedVars;
63 std::vector<GlobalValue *> UsedVars;
64 std::vector<GlobalVariable *> ReferencedNames;
65 GlobalVariable *NamesVar;
72 std::vector<LoadStorePair> PromotionCandidates;
74 int64_t TotalCountersPromoted = 0;
78 bool lowerIntrinsics(Function *
F);
81 void promoteCounterLoadStores(Function *
F);
84 bool isRuntimeCounterRelocationEnabled()
const;
87 bool isCounterPromotionEnabled()
const;
90 void computeNumValueSiteCounts(InstrProfValueProfileInst *Ins);
93 void lowerValueProfileInst(InstrProfValueProfileInst *Ins);
96 void lowerCover(InstrProfCoverInst *Inc);
100 void lowerTimestamp(InstrProfTimestampInst *TimestampInstruction);
103 void lowerIncrement(InstrProfIncrementInst *Inc);
106 void lowerCoverageData(GlobalVariable *CoverageNamesVar);
110 Value *getCounterAddress(InstrProfInstBase *
I);
116 GlobalVariable *getOrCreateRegionCounters(InstrProfInstBase *Inc);
119 GlobalVariable *createRegionCounters(InstrProfInstBase *Inc, StringRef
Name,
129 void emitRegistration();
133 bool emitRuntimeHook();
140 void emitInitialization();
This file defines the DenseMap class.
const char LLVMTargetMachineRef LLVMPassBuilderOptionsRef Options
This header defines various interfaces for pass management in LLVM.
A container for analyses that lazily runs them and caches their results.
LinkageTypes
An enumeration for the kinds of linkage for global values.
Instrumentation based profiling lowering pass.
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
InstrProfiling(const InstrProfOptions &Options, bool IsCS=false)
A Module instance is used to store all the information related to an LLVM module.
A set of analyses that are preserved following a run of a transformation pass.
Provides information about what library functions are available for the current target.
Triple - Helper class for working with autoconf configuration names.
This is an optimization pass for GlobalISel generic memory operations.
std::pair< Instruction *, Instruction * > LoadStorePair
Options for the frontend instrumentation based profiling pass.
A CRTP mix-in to automatically provide informational APIs needed for passes.