LLVM 24.0.0git
SampleProfile.h
Go to the documentation of this file.
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
18#include "llvm/IR/PassManager.h"
19#include "llvm/Pass.h"
22#include <string>
23
24namespace llvm {
25
26class LLVMContext;
27class Module;
28namespace cl {
30}
31
32/// The thresholds of the priority-based sample profile loader inliner. The
33/// member initializers are the loader's defaults; llvm-profgen's preinliner
34/// passes its own to getInlineOptions.
38 unsigned GrowthLimit = 12;
39 unsigned LimitMin = 100;
40 unsigned LimitMax = 10000;
41 bool SortProfiledSCC = true;
42};
43
44/// The sample profiler data loader pass.
46 : public OptionalPassInfoMixin<SampleProfileLoaderPass> {
47public:
49 std::string File = "", std::string RemappingFile = "",
52 bool DisableSampleProfileInlining = false,
53 bool UseFlattenedProfile = false);
54
56
57 /// Return -sample-profile-file.
59
60 /// Return \p Defaults overridden by the inliner options given in \p C.
64
65private:
66 std::string ProfileFileName;
67 std::string ProfileRemappingFileName;
68 const ThinOrFullLTOPhase LTOPhase;
70 bool DisableSampleProfileInlining;
71 bool UseFlattenedProfile;
72};
73
74} // end namespace llvm
75
76#endif // LLVM_TRANSFORMS_IPO_SAMPLEPROFILE_H
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
#define LLVM_ABI
Definition Compiler.h:211
This header defines various interfaces for pass management in LLVM.
This file defines the RefCountedBase, ThreadSafeRefCountedBase, and IntrusiveRefCntPtr classes.
Contains the forward declaration for vfs::FileSystem, as well as the IntrusiveRefCntPtrInfo specializ...
A smart pointer to a reference-counted object that inherits from RefCountedBase or ThreadSafeRefCount...
This is an important class for using LLVM in a threaded context.
Definition LLVMContext.h:76
A Module instance is used to store all the information related to an LLVM module.
Definition Module.h:68
A set of analyses that are preserved following a run of a transformation pass.
Definition Analysis.h:112
static LLVM_ABI SampleProfileInlineOptions getInlineOptions(const cl::LibraryOptionsContext &C, SampleProfileInlineOptions Defaults)
Return Defaults overridden by the inliner options given in C.
static LLVM_ABI StringRef getSampleProfileFile(const LLVMContext &C)
Return -sample-profile-file.
LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
LLVM_ABI SampleProfileLoaderPass(std::string File="", std::string RemappingFile="", ThinOrFullLTOPhase LTOPhase=ThinOrFullLTOPhase::None, IntrusiveRefCntPtr< vfs::FileSystem > FS=nullptr, bool DisableSampleProfileInlining=false, bool UseFlattenedProfile=false)
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
This namespace contains all of the command line option processing machinery.
This is an optimization pass for GlobalISel generic memory operations.
ThinOrFullLTOPhase
This enumerates the LLVM full LTO or ThinLTO optimization phases.
Definition Pass.h:75
@ None
No LTO/ThinLTO behavior needed.
Definition Pass.h:77
AnalysisManager< Module > ModuleAnalysisManager
Convenience typedef for the Module analysis manager.
Definition MIRParser.h:39
A CRTP mix-in for passes that can be skipped.
The thresholds of the priority-based sample profile loader inliner.