[lld] [lld][ELF] Extend profile guided function ordering to ELF binaries (PR #117514)
Ellis Hoag via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 10 11:12:13 PST 2024
================
@@ -0,0 +1,76 @@
+//===- BPSectionOrdererBase.h ---------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines the common interfaces which may be used by
+// BPSectionOrderer.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLD_COMMON_BP_SECTION_ORDERER_BASE_H
+#define LLD_COMMON_BP_SECTION_ORDERER_BASE_H
+
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/Twine.h"
+#include "llvm/Support/xxhash.h"
+
+namespace lld {
+
+class BPSymbol {
+
+public:
+ virtual ~BPSymbol() = default;
+ virtual llvm::StringRef getName() const = 0;
+ virtual BPSymbol *asDefinedSymbol() = 0;
+ virtual std::optional<uint64_t> getValue() const = 0;
+ virtual std::optional<uint64_t> getSize() const = 0;
+};
+
+class BPSectionBase {
+public:
+ virtual ~BPSectionBase() = default;
+ virtual llvm::StringRef getName() const = 0;
+ virtual uint64_t getSize() const = 0;
+ virtual bool hasValidData() const = 0;
+ virtual bool isCodeSection() const = 0;
+ virtual llvm::ArrayRef<uint8_t> getSectionData() const = 0;
+ virtual llvm::ArrayRef<std::unique_ptr<BPSymbol>> getSymbols() const = 0;
+ virtual void
+ getSectionHash(llvm::SmallVectorImpl<uint64_t> &hashes) const = 0;
----------------
ellishg wrote:
```suggestion
getSectionHashes(llvm::SmallVectorImpl<uint64_t> &hashes) const = 0;
```
https://github.com/llvm/llvm-project/pull/117514
More information about the llvm-commits
mailing list