10b57cec5SDimitry Andric //===- SampleProfile.h - SamplePGO pass ---------- --------------*- C++ -*-===//
20b57cec5SDimitry Andric //
30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric //
70b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric //
90b57cec5SDimitry Andric /// \file
100b57cec5SDimitry Andric /// This file provides the interface for the sampled PGO loader pass.
110b57cec5SDimitry Andric //
120b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
130b57cec5SDimitry Andric 
140b57cec5SDimitry Andric #ifndef LLVM_TRANSFORMS_IPO_SAMPLEPROFILE_H
150b57cec5SDimitry Andric #define LLVM_TRANSFORMS_IPO_SAMPLEPROFILE_H
160b57cec5SDimitry Andric 
1706c3fb27SDimitry Andric #include "llvm/ADT/IntrusiveRefCntPtr.h"
180b57cec5SDimitry Andric #include "llvm/IR/PassManager.h"
191fd87a68SDimitry Andric #include "llvm/Pass.h"
205f757f3fSDimitry Andric #include "llvm/Support/CommandLine.h"
210b57cec5SDimitry Andric #include <string>
220b57cec5SDimitry Andric 
230b57cec5SDimitry Andric namespace llvm {
240b57cec5SDimitry Andric 
250b57cec5SDimitry Andric class Module;
260b57cec5SDimitry Andric 
275f757f3fSDimitry Andric extern cl::opt<int> SampleHotCallSiteThreshold;
285f757f3fSDimitry Andric extern cl::opt<int> SampleColdCallSiteThreshold;
295f757f3fSDimitry Andric extern cl::opt<int> ProfileInlineGrowthLimit;
305f757f3fSDimitry Andric extern cl::opt<int> ProfileInlineLimitMin;
315f757f3fSDimitry Andric extern cl::opt<int> ProfileInlineLimitMax;
325f757f3fSDimitry Andric extern cl::opt<bool> SortProfiledSCC;
335f757f3fSDimitry Andric 
3406c3fb27SDimitry Andric namespace vfs {
3506c3fb27SDimitry Andric class FileSystem;
3606c3fb27SDimitry Andric } // namespace vfs
3706c3fb27SDimitry Andric 
380b57cec5SDimitry Andric /// The sample profiler data loader pass.
390b57cec5SDimitry Andric class SampleProfileLoaderPass : public PassInfoMixin<SampleProfileLoaderPass> {
400b57cec5SDimitry Andric public:
41e8d8bef9SDimitry Andric   SampleProfileLoaderPass(
42e8d8bef9SDimitry Andric       std::string File = "", std::string RemappingFile = "",
4306c3fb27SDimitry Andric       ThinOrFullLTOPhase LTOPhase = ThinOrFullLTOPhase::None,
4406c3fb27SDimitry Andric       IntrusiveRefCntPtr<vfs::FileSystem> FS = nullptr);
450b57cec5SDimitry Andric 
460b57cec5SDimitry Andric   PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
470b57cec5SDimitry Andric 
480b57cec5SDimitry Andric private:
490b57cec5SDimitry Andric   std::string ProfileFileName;
500b57cec5SDimitry Andric   std::string ProfileRemappingFileName;
5181ad6265SDimitry Andric   const ThinOrFullLTOPhase LTOPhase;
5206c3fb27SDimitry Andric   IntrusiveRefCntPtr<vfs::FileSystem> FS;
530b57cec5SDimitry Andric };
540b57cec5SDimitry Andric 
550b57cec5SDimitry Andric } // end namespace llvm
560b57cec5SDimitry Andric 
57fe6060f1SDimitry Andric #endif // LLVM_TRANSFORMS_IPO_SAMPLEPROFILE_H
58