1*700637cbSDimitry Andric //===- BPSectionOrderer.h -------------------------------------------------===// 2*700637cbSDimitry Andric // 3*700637cbSDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*700637cbSDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 5*700637cbSDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*700637cbSDimitry Andric // 7*700637cbSDimitry Andric //===----------------------------------------------------------------------===// 8*700637cbSDimitry Andric /// 9*700637cbSDimitry Andric /// This file uses Balanced Partitioning to order sections to improve startup 10*700637cbSDimitry Andric /// time and compressed size. 11*700637cbSDimitry Andric /// 12*700637cbSDimitry Andric //===----------------------------------------------------------------------===// 13*700637cbSDimitry Andric 14*700637cbSDimitry Andric #ifndef LLD_MACHO_BPSECTION_ORDERER_H 15*700637cbSDimitry Andric #define LLD_MACHO_BPSECTION_ORDERER_H 16*700637cbSDimitry Andric 17*700637cbSDimitry Andric #include "llvm/ADT/DenseMap.h" 18*700637cbSDimitry Andric #include "llvm/ADT/StringRef.h" 19*700637cbSDimitry Andric 20*700637cbSDimitry Andric namespace lld::macho { 21*700637cbSDimitry Andric class InputSection; 22*700637cbSDimitry Andric 23*700637cbSDimitry Andric /// Run Balanced Partitioning to find the optimal function and data order to 24*700637cbSDimitry Andric /// improve startup time and compressed size. 25*700637cbSDimitry Andric /// 26*700637cbSDimitry Andric /// It is important that .subsections_via_symbols is used to ensure functions 27*700637cbSDimitry Andric /// and data are in their own sections and thus can be reordered. 28*700637cbSDimitry Andric llvm::DenseMap<const InputSection *, int> 29*700637cbSDimitry Andric runBalancedPartitioning(llvm::StringRef profilePath, 30*700637cbSDimitry Andric bool forFunctionCompression, bool forDataCompression, 31*700637cbSDimitry Andric bool compressionSortStartupFunctions, bool verbose); 32*700637cbSDimitry Andric 33*700637cbSDimitry Andric } // namespace lld::macho 34*700637cbSDimitry Andric 35*700637cbSDimitry Andric #endif 36