LLVM  7.0.0
PGOInstrumentation.h
Go to the documentation of this file.
1 //===- Transforms/Instrumentation/PGOInstrumentation.h ----------*- 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 //
10 /// \file
11 /// This file provides the interface for IR based instrumentation passes (
12 /// (profile-gen, and profile-use).
13 //
14 //===----------------------------------------------------------------------===//
15 
16 #ifndef LLVM_TRANSFORMS_PGOINSTRUMENTATION_H
17 #define LLVM_TRANSFORMS_PGOINSTRUMENTATION_H
18 
19 #include "llvm/ADT/ArrayRef.h"
20 #include "llvm/IR/PassManager.h"
21 #include <cstdint>
22 #include <string>
23 
24 namespace llvm {
25 
26 class Function;
27 class Instruction;
28 class Module;
29 
30 /// The instrumentation (profile-instr-gen) pass for IR based PGO.
31 class PGOInstrumentationGen : public PassInfoMixin<PGOInstrumentationGen> {
32 public:
34 };
35 
36 /// The profile annotation (profile-instr-use) pass for IR based PGO.
37 class PGOInstrumentationUse : public PassInfoMixin<PGOInstrumentationUse> {
38 public:
39  PGOInstrumentationUse(std::string Filename = "");
40 
42 
43 private:
44  std::string ProfileFileName;
45 };
46 
47 /// The indirect function call promotion pass.
48 class PGOIndirectCallPromotion : public PassInfoMixin<PGOIndirectCallPromotion> {
49 public:
50  PGOIndirectCallPromotion(bool IsInLTO = false, bool SamplePGO = false)
51  : InLTO(IsInLTO), SamplePGO(SamplePGO) {}
52 
54 
55 private:
56  bool InLTO;
57  bool SamplePGO;
58 };
59 
60 /// The profile size based optimization pass for memory intrinsics.
61 class PGOMemOPSizeOpt : public PassInfoMixin<PGOMemOPSizeOpt> {
62 public:
63  PGOMemOPSizeOpt() = default;
64 
66 };
67 
68 void setProfMetadata(Module *M, Instruction *TI, ArrayRef<uint64_t> EdgeCounts,
69  uint64_t MaxCount);
70 
71 void setIrrLoopHeaderMetadata(Module *M, Instruction *TI, uint64_t Count);
72 
73 } // end namespace llvm
74 
75 #endif // LLVM_TRANSFORMS_PGOINSTRUMENTATION_H
The profile annotation (profile-instr-use) pass for IR based PGO.
void setProfMetadata(Module *M, Instruction *TI, ArrayRef< uint64_t > EdgeCounts, uint64_t MaxCount)
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
A Module instance is used to store all the information related to an LLVM module. ...
Definition: Module.h:63
F(f)
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:365
A set of analyses that are preserved following a run of a transformation pass.
Definition: PassManager.h:153
void setIrrLoopHeaderMetadata(Module *M, Instruction *TI, uint64_t Count)
PGOIndirectCallPromotion(bool IsInLTO=false, bool SamplePGO=false)
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
The instrumentation (profile-instr-gen) pass for IR based PGO.
The indirect function call promotion pass.
The profile size based optimization pass for memory intrinsics.
A container for analyses that lazily runs them and caches their results.
This header defines various interfaces for pass management in LLVM.