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 "lld/Common/BPSectionOrdererBase.h"
18#include "llvm/ADT/ArrayRef.h"
19#include "llvm/ADT/DenseMap.h"
20#include "llvm/ADT/StringRef.h"
21
22namespace lld::macho {
23class InputSection;
24
25/// Run Balanced Partitioning to find the optimal function and data order to
26/// improve startup time and compressed size.
27///
28/// It is important that .subsections_via_symbols is used to ensure functions
29/// and data are in their own sections and thus can be reordered.
30llvm::DenseMap<const InputSection *, int> runBalancedPartitioning(
31 llvm::StringRef profilePath,
32 llvm::ArrayRef<BPCompressionSortSpec> compressionSortSpecs,
33 bool forFunctionCompression, bool forDataCompression,
34 bool compressionSortStartupFunctions, bool verbose);
35
36} // namespace lld::macho
37
38#endif
39