1 //===- SampleProfile.h - SamplePGO pass ---------- --------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 /// \file
10 /// This file provides the interface for the sampled PGO loader pass.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_TRANSFORMS_IPO_SAMPLEPROFILE_H
15 #define LLVM_TRANSFORMS_IPO_SAMPLEPROFILE_H
16 
17 #include "llvm/ADT/IntrusiveRefCntPtr.h"
18 #include "llvm/IR/PassManager.h"
19 #include "llvm/Pass.h"
20 #include "llvm/Support/CommandLine.h"
21 #include <string>
22 
23 namespace llvm {
24 
25 class Module;
26 
27 extern cl::opt<int> SampleHotCallSiteThreshold;
28 extern cl::opt<int> SampleColdCallSiteThreshold;
29 extern cl::opt<int> ProfileInlineGrowthLimit;
30 extern cl::opt<int> ProfileInlineLimitMin;
31 extern cl::opt<int> ProfileInlineLimitMax;
32 extern cl::opt<bool> SortProfiledSCC;
33 
34 namespace vfs {
35 class FileSystem;
36 } // namespace vfs
37 
38 /// The sample profiler data loader pass.
39 class SampleProfileLoaderPass : public PassInfoMixin<SampleProfileLoaderPass> {
40 public:
41   SampleProfileLoaderPass(
42       std::string File = "", std::string RemappingFile = "",
43       ThinOrFullLTOPhase LTOPhase = ThinOrFullLTOPhase::None,
44       IntrusiveRefCntPtr<vfs::FileSystem> FS = nullptr);
45 
46   PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
47 
48 private:
49   std::string ProfileFileName;
50   std::string ProfileRemappingFileName;
51   const ThinOrFullLTOPhase LTOPhase;
52   IntrusiveRefCntPtr<vfs::FileSystem> FS;
53 };
54 
55 } // end namespace llvm
56 
57 #endif // LLVM_TRANSFORMS_IPO_SAMPLEPROFILE_H
58