13 #ifndef LLVM_TRANSFORMS_INSTRUMENTATION_INSTRPROFILING_H
14 #define LLVM_TRANSFORMS_INSTRUMENTATION_INSTRPROFILING_H
28 class 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);
99 void lowerIncrement(InstrProfIncrementInst *Inc);
102 void lowerCoverageData(GlobalVariable *CoverageNamesVar);
106 Value *getCounterAddress(InstrProfInstBase *
I);
112 GlobalVariable *getOrCreateRegionCounters(InstrProfInstBase *Inc);
115 GlobalVariable *createRegionCounters(InstrProfInstBase *Inc, StringRef
Name,
125 void emitRegistration();
129 bool emitRuntimeHook();
136 void emitInitialization();
141 #endif // LLVM_TRANSFORMS_INSTRUMENTATION_INSTRPROFILING_H