LLVM 17.0.0git
PGOOptions.cpp
Go to the documentation of this file.
1//===------ PGOOptions.cpp -- 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
11
12using namespace llvm;
13
14PGOOptions::PGOOptions(std::string ProfileFile, std::string CSProfileGenFile,
15 std::string ProfileRemappingFile,
17 CSPGOAction CSAction, bool DebugInfoForProfiling,
18 bool PseudoProbeForProfiling)
19 : ProfileFile(ProfileFile), CSProfileGenFile(CSProfileGenFile),
20 ProfileRemappingFile(ProfileRemappingFile), Action(Action),
21 CSAction(CSAction),
22 DebugInfoForProfiling(DebugInfoForProfiling ||
23 (Action == SampleUse && !PseudoProbeForProfiling)),
24 PseudoProbeForProfiling(PseudoProbeForProfiling), FS(std::move(FS)) {
25 // Note, we do allow ProfileFile.empty() for Action=IRUse LTO can
26 // callback with IRUse action without ProfileFile.
27
28 // If there is a CSAction, PGOAction cannot be IRInstr or SampleUse.
29 assert(this->CSAction == NoCSAction ||
30 (this->Action != IRInstr && this->Action != SampleUse));
31
32 // For CSIRInstr, CSProfileGenFile also needs to be nonempty.
33 assert(this->CSAction != CSIRInstr || !this->CSProfileGenFile.empty());
34
35 // If CSAction is CSIRUse, PGOAction needs to be IRUse as they share
36 // a profile.
37 assert(this->CSAction != CSIRUse || this->Action == IRUse);
38
39 // If neither Action nor CSAction, DebugInfoForProfiling or
40 // PseudoProbeForProfiling needs to be true.
41 assert(this->Action != NoAction || this->CSAction != NoCSAction ||
42 this->DebugInfoForProfiling || this->PseudoProbeForProfiling);
43
44 // If we need to use the profile, the VFS cannot be nullptr.
45 assert(this->FS || !(this->Action == IRUse || this->CSAction == CSIRUse));
46}
47
48PGOOptions::PGOOptions(const PGOOptions &) = default;
49
51
52PGOOptions::~PGOOptions() = default;
Define option tunables for PGO.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Defines the virtual file system interface vfs::FileSystem.
A smart pointer to a reference-counted object that inherits from RefCountedBase or ThreadSafeRefCount...
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1946
Definition: BitVector.h:858
A struct capturing PGO tunables.
Definition: PGOOptions.h:27
PGOOptions(std::string ProfileFile, std::string CSProfileGenFile, std::string ProfileRemappingFile, IntrusiveRefCntPtr< vfs::FileSystem > FS, PGOAction Action=NoAction, CSPGOAction CSAction=NoCSAction, bool DebugInfoForProfiling=false, bool PseudoProbeForProfiling=false)
Definition: PGOOptions.cpp:14
PGOOptions & operator=(const PGOOptions &)