38 lines · c
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-exception6//7//===----------------------------------------------------------------------===//8///9/// This file uses Balanced Partitioning to order sections to improve startup10/// time and compressed size.11///12//===----------------------------------------------------------------------===//13 14#ifndef LLD_ELF_BPSECTION_ORDERER_H15#define LLD_ELF_BPSECTION_ORDERER_H16 17#include "llvm/ADT/DenseMap.h"18#include "llvm/ADT/StringRef.h"19 20namespace lld::elf {21struct Ctx;22class InputSectionBase;23 24/// Run Balanced Partitioning to find the optimal function and data order to25/// improve startup time and compressed size.26///27/// It is important that -ffunction-sections and -fdata-sections compiler flags28/// are used to ensure functions and data are in their own sections and thus29/// can be reordered.30llvm::DenseMap<const InputSectionBase *, int>31runBalancedPartitioning(Ctx &ctx, llvm::StringRef profilePath,32 bool forFunctionCompression, bool forDataCompression,33 bool compressionSortStartupFunctions, bool verbose);34 35} // namespace lld::elf36 37#endif38