xref: /llvm-project/lld/MachO/BPSectionOrderer.h (revision e0c7f081f1582d49f81ec4c6cdbf5d6ef13c58ba)
1 //===- BPSectionOrderer.h -------------------------------------------------===//
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 uses Balanced Partitioning to order sections to improve startup
10 /// time and compressed size.
11 ///
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLD_MACHO_BPSECTION_ORDERER_H
15 #define LLD_MACHO_BPSECTION_ORDERER_H
16 
17 #include "llvm/ADT/DenseMap.h"
18 #include "llvm/ADT/StringRef.h"
19 
20 namespace lld::macho {
21 class InputSection;
22 
23 /// Run Balanced Partitioning to find the optimal function and data order to
24 /// improve startup time and compressed size.
25 ///
26 /// It is important that .subsections_via_symbols is used to ensure functions
27 /// and data are in their own sections and thus can be reordered.
28 llvm::DenseMap<const InputSection *, int>
29 runBalancedPartitioning(llvm::StringRef profilePath,
30                         bool forFunctionCompression, bool forDataCompression,
31                         bool compressionSortStartupFunctions, bool verbose);
32 
33 } // namespace lld::macho
34 
35 #endif
36