1 //===- BPSectionOrderer.h ---------------------------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 /// This file uses Balanced Partitioning to order sections to improve startup
10 /// time and compressed size.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLD_MACHO_BPSECTION_ORDERER_H
15 #define LLD_MACHO_BPSECTION_ORDERER_H
17 #include "llvm/ADT/DenseMap.h"
18 #include "llvm/ADT/StringRef.h"
20 namespace lld::macho
{
24 /// Run Balanced Partitioning to find the optimal function and data order to
25 /// improve startup time and compressed size.
27 /// It is important that .subsections_via_symbols is used to ensure functions
28 /// and data are in their own sections and thus can be reordered.
29 llvm::DenseMap
<const lld::macho::InputSection
*, size_t>
30 runBalancedPartitioning(size_t &highestAvailablePriority
,
31 llvm::StringRef profilePath
,
32 bool forFunctionCompression
, bool forDataCompression
,
33 bool compressionSortStartupFunctions
, bool verbose
);
35 } // namespace lld::macho