xref: /freebsd/contrib/llvm-project/llvm/include/llvm/CodeGen/MachineSizeOpts.h (revision fe6060f10f634930ff71b7c50291ddc610da2475)
1480093f4SDimitry Andric //===- MachineSizeOpts.h - machine size optimization ------------*- C++ -*-===//
2480093f4SDimitry Andric //
3480093f4SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4480093f4SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5480093f4SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6480093f4SDimitry Andric //
7480093f4SDimitry Andric //===----------------------------------------------------------------------===//
8480093f4SDimitry Andric //
9480093f4SDimitry Andric // This file contains some shared machine IR code size optimization related
10480093f4SDimitry Andric // code.
11480093f4SDimitry Andric //
12480093f4SDimitry Andric //===----------------------------------------------------------------------===//
13*fe6060f1SDimitry Andric #ifndef LLVM_CODEGEN_MACHINESIZEOPTS_H
14*fe6060f1SDimitry Andric #define LLVM_CODEGEN_MACHINESIZEOPTS_H
15480093f4SDimitry Andric 
16480093f4SDimitry Andric #include "llvm/Transforms/Utils/SizeOpts.h"
17480093f4SDimitry Andric 
18480093f4SDimitry Andric namespace llvm {
19480093f4SDimitry Andric 
20480093f4SDimitry Andric class ProfileSummaryInfo;
21480093f4SDimitry Andric class MachineBasicBlock;
22480093f4SDimitry Andric class MachineBlockFrequencyInfo;
23480093f4SDimitry Andric class MachineFunction;
245ffd83dbSDimitry Andric class MBFIWrapper;
25480093f4SDimitry Andric 
26480093f4SDimitry Andric /// Returns true if machine function \p MF is suggested to be size-optimized
27480093f4SDimitry Andric /// based on the profile.
28480093f4SDimitry Andric bool shouldOptimizeForSize(const MachineFunction *MF, ProfileSummaryInfo *PSI,
29480093f4SDimitry Andric                            const MachineBlockFrequencyInfo *BFI,
30480093f4SDimitry Andric                            PGSOQueryType QueryType = PGSOQueryType::Other);
31480093f4SDimitry Andric /// Returns true if machine basic block \p MBB is suggested to be size-optimized
32480093f4SDimitry Andric /// based on the profile.
33480093f4SDimitry Andric bool shouldOptimizeForSize(const MachineBasicBlock *MBB,
34480093f4SDimitry Andric                            ProfileSummaryInfo *PSI,
35480093f4SDimitry Andric                            const MachineBlockFrequencyInfo *MBFI,
36480093f4SDimitry Andric                            PGSOQueryType QueryType = PGSOQueryType::Other);
375ffd83dbSDimitry Andric /// Returns true if machine basic block \p MBB is suggested to be size-optimized
385ffd83dbSDimitry Andric /// based on the profile.
395ffd83dbSDimitry Andric bool shouldOptimizeForSize(const MachineBasicBlock *MBB,
405ffd83dbSDimitry Andric                            ProfileSummaryInfo *PSI,
415ffd83dbSDimitry Andric                            MBFIWrapper *MBFIWrapper,
425ffd83dbSDimitry Andric                            PGSOQueryType QueryType = PGSOQueryType::Other);
43480093f4SDimitry Andric 
44480093f4SDimitry Andric } // end namespace llvm
45480093f4SDimitry Andric 
46*fe6060f1SDimitry Andric #endif // LLVM_CODEGEN_MACHINESIZEOPTS_H
47