]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/include/llvm/Transforms/PGOInstrumentation.h
Merge llvm, clang, lld, lldb, compiler-rt and libc++ r304222, and update
[FreeBSD/FreeBSD.git] / contrib / llvm / include / llvm / Transforms / PGOInstrumentation.h
1 //===- Transforms/PGOInstrumentation.h - PGO gen/use passes  ---*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 /// \file
10 /// This file provides the interface for IR based instrumentation passes (
11 /// (profile-gen, and profile-use).
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_TRANSFORMS_PGOINSTRUMENTATION_H
15 #define LLVM_TRANSFORMS_PGOINSTRUMENTATION_H
16
17 #include "llvm/IR/PassManager.h"
18 #include "llvm/Transforms/Instrumentation.h"
19
20 namespace llvm {
21
22 /// The instrumentation (profile-instr-gen) pass for IR based PGO.
23 class PGOInstrumentationGen : public PassInfoMixin<PGOInstrumentationGen> {
24 public:
25   PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
26 };
27
28 /// The profile annotation (profile-instr-use) pass for IR based PGO.
29 class PGOInstrumentationUse : public PassInfoMixin<PGOInstrumentationUse> {
30 public:
31   PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
32   PGOInstrumentationUse(std::string Filename = "");
33
34 private:
35   std::string ProfileFileName;
36 };
37
38 /// The indirect function call promotion pass.
39 class PGOIndirectCallPromotion : public PassInfoMixin<PGOIndirectCallPromotion> {
40 public:
41   PGOIndirectCallPromotion(bool IsInLTO = false, bool SamplePGO = false)
42       : InLTO(IsInLTO), SamplePGO(SamplePGO) {}
43   PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
44
45 private:
46   bool InLTO;
47   bool SamplePGO;
48 };
49
50 /// The profile size based optimization pass for memory intrinsics.
51 class PGOMemOPSizeOpt : public PassInfoMixin<PGOMemOPSizeOpt> {
52 public:
53   PGOMemOPSizeOpt() {}
54   PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
55 };
56
57 void setProfMetadata(Module *M, Instruction *TI, ArrayRef<uint64_t> EdgeCounts,
58                      uint64_t MaxCount);
59
60 } // End llvm namespace
61 #endif