LLVM  8.0.1
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  std::string RemappingFilename = "");
41 
43 
44 private:
45  std::string ProfileFileName;
46  std::string ProfileRemappingFileName;
47 };
48 
49 /// The indirect function call promotion pass.
50 class PGOIndirectCallPromotion : public PassInfoMixin<PGOIndirectCallPromotion> {
51 public:
52  PGOIndirectCallPromotion(bool IsInLTO = false, bool SamplePGO = false)
53  : InLTO(IsInLTO), SamplePGO(SamplePGO) {}
54 
56 
57 private:
58  bool InLTO;
59  bool SamplePGO;
60 };
61 
62 /// The profile size based optimization pass for memory intrinsics.
63 class PGOMemOPSizeOpt : public PassInfoMixin<PGOMemOPSizeOpt> {
64 public:
65  PGOMemOPSizeOpt() = default;
66 
68 };
69 
70 void setProfMetadata(Module *M, Instruction *TI, ArrayRef<uint64_t> EdgeCounts,
71  uint64_t MaxCount);
72 
73 void setIrrLoopHeaderMetadata(Module *M, Instruction *TI, uint64_t Count);
74 
75 } // end namespace llvm
76 
77 #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)
This class represents lattice values for constants.
Definition: AllocatorList.h:24
A Module instance is used to store all the information related to an LLVM module. ...
Definition: Module.h:65
F(f)
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:366
A set of analyses that are preserved following a run of a transformation pass.
Definition: PassManager.h:154
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.