xref: /freebsd/contrib/llvm-project/llvm/include/llvm/CodeGen/MachineSizeOpts.h (revision 700637cbb5e582861067a11aaca4d053546871d2)
1 //===- MachineSizeOpts.h - machine size optimization ------------*- 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 // This file contains some shared machine IR code size optimization related
10 // code.
11 //
12 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_CODEGEN_MACHINESIZEOPTS_H
14 #define LLVM_CODEGEN_MACHINESIZEOPTS_H
15 
16 #include "llvm/Support/Compiler.h"
17 #include "llvm/Transforms/Utils/SizeOpts.h"
18 
19 namespace llvm {
20 
21 class ProfileSummaryInfo;
22 class MachineBasicBlock;
23 class MachineBlockFrequencyInfo;
24 class MachineFunction;
25 class MBFIWrapper;
26 
27 /// Returns true if machine function \p MF is suggested to be size-optimized
28 /// based on the profile.
29 LLVM_ABI bool
30 shouldOptimizeForSize(const MachineFunction *MF, ProfileSummaryInfo *PSI,
31                       const MachineBlockFrequencyInfo *BFI,
32                       PGSOQueryType QueryType = PGSOQueryType::Other);
33 /// Returns true if machine basic block \p MBB is suggested to be size-optimized
34 /// based on the profile.
35 LLVM_ABI bool
36 shouldOptimizeForSize(const MachineBasicBlock *MBB, ProfileSummaryInfo *PSI,
37                       const MachineBlockFrequencyInfo *MBFI,
38                       PGSOQueryType QueryType = PGSOQueryType::Other);
39 /// Returns true if machine basic block \p MBB is suggested to be size-optimized
40 /// based on the profile.
41 LLVM_ABI bool
42 shouldOptimizeForSize(const MachineBasicBlock *MBB, ProfileSummaryInfo *PSI,
43                       MBFIWrapper *MBFIWrapper,
44                       PGSOQueryType QueryType = PGSOQueryType::Other);
45 
46 } // end namespace llvm
47 
48 #endif // LLVM_CODEGEN_MACHINESIZEOPTS_H
49