xref: /freebsd/contrib/llvm-project/llvm/include/llvm/Support/PGOOptions.h (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
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/Error.h"
19 
20 namespace llvm {
21 
22 namespace vfs {
23 class FileSystem;
24 } // namespace vfs
25 
26 /// A struct capturing PGO tunables.
27 struct PGOOptions {
28   enum PGOAction { NoAction, IRInstr, IRUse, SampleUse };
29   enum CSPGOAction { NoCSAction, CSIRInstr, CSIRUse };
30   enum class ColdFuncOpt { Default, OptSize, MinSize, OptNone };
31   PGOOptions(std::string ProfileFile, std::string CSProfileGenFile,
32              std::string ProfileRemappingFile, std::string MemoryProfile,
33              IntrusiveRefCntPtr<vfs::FileSystem> FS,
34              PGOAction Action = NoAction, CSPGOAction CSAction = NoCSAction,
35              ColdFuncOpt ColdType = ColdFuncOpt::Default,
36              bool DebugInfoForProfiling = false,
37              bool PseudoProbeForProfiling = false,
38              bool AtomicCounterUpdate = false);
39   PGOOptions(const PGOOptions &);
40   ~PGOOptions();
41   PGOOptions &operator=(const PGOOptions &);
42 
43   std::string ProfileFile;
44   std::string CSProfileGenFile;
45   std::string ProfileRemappingFile;
46   std::string MemoryProfile;
47   PGOAction Action;
48   CSPGOAction CSAction;
49   ColdFuncOpt ColdOptType;
50   bool DebugInfoForProfiling;
51   bool PseudoProbeForProfiling;
52   bool AtomicCounterUpdate;
53   IntrusiveRefCntPtr<vfs::FileSystem> FS;
54 };
55 } // namespace llvm
56 
57 #endif
58