1 //===- Transforms/Instrumentation/PGOInstrumentation.h ----------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
11 /// This file provides the interface for IR based instrumentation passes (
12 /// (profile-gen, and profile-use).
14 //===----------------------------------------------------------------------===//
16 #ifndef LLVM_TRANSFORMS_PGOINSTRUMENTATION_H
17 #define LLVM_TRANSFORMS_PGOINSTRUMENTATION_H
19 #include "llvm/ADT/ArrayRef.h"
20 #include "llvm/IR/PassManager.h"
30 /// The instrumentation (profile-instr-gen) pass for IR based PGO.
31 class PGOInstrumentationGen : public PassInfoMixin<PGOInstrumentationGen> {
33 PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
36 /// The profile annotation (profile-instr-use) pass for IR based PGO.
37 class PGOInstrumentationUse : public PassInfoMixin<PGOInstrumentationUse> {
39 PGOInstrumentationUse(std::string Filename = "");
41 PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
44 std::string ProfileFileName;
47 /// The indirect function call promotion pass.
48 class PGOIndirectCallPromotion : public PassInfoMixin<PGOIndirectCallPromotion> {
50 PGOIndirectCallPromotion(bool IsInLTO = false, bool SamplePGO = false)
51 : InLTO(IsInLTO), SamplePGO(SamplePGO) {}
53 PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
60 /// The profile size based optimization pass for memory intrinsics.
61 class PGOMemOPSizeOpt : public PassInfoMixin<PGOMemOPSizeOpt> {
63 PGOMemOPSizeOpt() = default;
65 PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
68 void setProfMetadata(Module *M, Instruction *TI, ArrayRef<uint64_t> EdgeCounts,
71 void setIrrLoopHeaderMetadata(Module *M, Instruction *TI, uint64_t Count);
73 } // end namespace llvm
75 #endif // LLVM_TRANSFORMS_PGOINSTRUMENTATION_H