xref: /freebsd/contrib/llvm-project/llvm/include/llvm/Support/PGOOptions.h (revision 700637cbb5e582861067a11aaca4d053546871d2)
1 //===------ PGOOptions.h -- PGO option tunables ----------------*- 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 /// \file
9 ///
10 /// Define option tunables for PGO.
11 ///
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_SUPPORT_PGOOPTIONS_H
15 #define LLVM_SUPPORT_PGOOPTIONS_H
16 
17 #include "llvm/ADT/IntrusiveRefCntPtr.h"
18 #include "llvm/Support/Compiler.h"
19 #include "llvm/Support/Error.h"
20 
21 namespace llvm {
22 
23 namespace vfs {
24 class FileSystem;
25 } // namespace vfs
26 
27 /// A struct capturing PGO tunables.
28 struct PGOOptions {
29   enum PGOAction { NoAction, IRInstr, IRUse, SampleUse };
30   enum CSPGOAction { NoCSAction, CSIRInstr, CSIRUse };
31   enum class ColdFuncOpt { Default, OptSize, MinSize, OptNone };
32   LLVM_ABI PGOOptions(std::string ProfileFile, std::string CSProfileGenFile,
33                       std::string ProfileRemappingFile,
34                       std::string MemoryProfile,
35                       IntrusiveRefCntPtr<vfs::FileSystem> FS,
36                       PGOAction Action = NoAction,
37                       CSPGOAction CSAction = NoCSAction,
38                       ColdFuncOpt ColdType = ColdFuncOpt::Default,
39                       bool DebugInfoForProfiling = false,
40                       bool PseudoProbeForProfiling = false,
41                       bool AtomicCounterUpdate = false);
42   LLVM_ABI PGOOptions(const PGOOptions &);
43   LLVM_ABI ~PGOOptions();
44   LLVM_ABI PGOOptions &operator=(const PGOOptions &);
45 
46   std::string ProfileFile;
47   std::string CSProfileGenFile;
48   std::string ProfileRemappingFile;
49   std::string MemoryProfile;
50   PGOAction Action;
51   CSPGOAction CSAction;
52   ColdFuncOpt ColdOptType;
53   bool DebugInfoForProfiling;
54   bool PseudoProbeForProfiling;
55   bool AtomicCounterUpdate;
56   IntrusiveRefCntPtr<vfs::FileSystem> FS;
57 };
58 } // namespace llvm
59 
60 #endif
61