[llvm] f8a2a50 - [ORC] Pass InitialDests map for redirectable symbols by value.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 4 21:03:40 PST 2024
Author: Lang Hames
Date: 2024-11-05T16:03:33+11:00
New Revision: f8a2a5025ef890408c7201beec67085b830ecdf7
URL: https://github.com/llvm/llvm-project/commit/f8a2a5025ef890408c7201beec67085b830ecdf7
DIFF: https://github.com/llvm/llvm-project/commit/f8a2a5025ef890408c7201beec67085b830ecdf7.diff
LOG: [ORC] Pass InitialDests map for redirectable symbols by value.
RedirectableMaterializationUnit needs its own copy of this map anyway, so
passing by value allows us to potentially omit a copy.
Added:
Modified:
llvm/include/llvm/ExecutionEngine/Orc/JITLinkRedirectableSymbolManager.h
llvm/include/llvm/ExecutionEngine/Orc/RedirectionManager.h
llvm/lib/ExecutionEngine/Orc/JITLinkRedirectableSymbolManager.cpp
llvm/lib/ExecutionEngine/Orc/RedirectionManager.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/JITLinkRedirectableSymbolManager.h b/llvm/include/llvm/ExecutionEngine/Orc/JITLinkRedirectableSymbolManager.h
index 9c6daef9283348..ed37ea1ea1f7a7 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/JITLinkRedirectableSymbolManager.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/JITLinkRedirectableSymbolManager.h
@@ -40,7 +40,7 @@ class JITLinkRedirectableSymbolManager : public RedirectableSymbolManager {
}
void emitRedirectableSymbols(std::unique_ptr<MaterializationResponsibility> R,
- const SymbolAddrMap &InitialDests) override;
+ SymbolAddrMap InitialDests) override;
Error redirect(JITDylib &JD, const SymbolAddrMap &NewDests) override;
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/RedirectionManager.h b/llvm/include/llvm/ExecutionEngine/Orc/RedirectionManager.h
index f2ea1f5b64c533..ae94bb2af2460d 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/RedirectionManager.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/RedirectionManager.h
@@ -47,8 +47,7 @@ class RedirectableSymbolManager : public RedirectionManager {
public:
/// Create redirectable symbols with given symbol names and initial
/// desitnation symbol addresses.
- Error createRedirectableSymbols(ResourceTrackerSP RT,
- const SymbolMap &InitialDests);
+ Error createRedirectableSymbols(ResourceTrackerSP RT, SymbolMap InitialDests);
/// Create a single redirectable symbol with given symbol name and initial
/// desitnation symbol address.
@@ -60,7 +59,7 @@ class RedirectableSymbolManager : public RedirectionManager {
/// Emit redirectable symbol
virtual void
emitRedirectableSymbols(std::unique_ptr<MaterializationResponsibility> MR,
- const SymbolMap &InitialDests) = 0;
+ SymbolMap InitialDests) = 0;
};
/// RedirectableMaterializationUnit materializes redirectable symbol
@@ -68,9 +67,9 @@ class RedirectableSymbolManager : public RedirectionManager {
class RedirectableMaterializationUnit : public MaterializationUnit {
public:
RedirectableMaterializationUnit(RedirectableSymbolManager &RM,
- const SymbolMap &InitialDests)
+ SymbolMap InitialDests)
: MaterializationUnit(convertToFlags(InitialDests)), RM(RM),
- InitialDests(InitialDests) {}
+ InitialDests(std::move(InitialDests)) {}
StringRef getName() const override {
return "RedirectableSymbolMaterializationUnit";
diff --git a/llvm/lib/ExecutionEngine/Orc/JITLinkRedirectableSymbolManager.cpp b/llvm/lib/ExecutionEngine/Orc/JITLinkRedirectableSymbolManager.cpp
index 73136647994f9c..5ac5604a8ece25 100644
--- a/llvm/lib/ExecutionEngine/Orc/JITLinkRedirectableSymbolManager.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/JITLinkRedirectableSymbolManager.cpp
@@ -24,7 +24,7 @@ constexpr StringRef StubSuffix = "$__stub_ptr";
void JITLinkRedirectableSymbolManager::emitRedirectableSymbols(
std::unique_ptr<MaterializationResponsibility> R,
- const SymbolAddrMap &InitialDests) {
+ SymbolAddrMap InitialDests) {
auto &ES = ObjLinkingLayer.getExecutionSession();
Triple TT = ES.getTargetTriple();
diff --git a/llvm/lib/ExecutionEngine/Orc/RedirectionManager.cpp b/llvm/lib/ExecutionEngine/Orc/RedirectionManager.cpp
index cbc77c5034303a..a4b822bdff611a 100644
--- a/llvm/lib/ExecutionEngine/Orc/RedirectionManager.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/RedirectionManager.cpp
@@ -16,9 +16,9 @@ using namespace llvm::orc;
void RedirectionManager::anchor() {}
Error RedirectableSymbolManager::createRedirectableSymbols(
- ResourceTrackerSP RT, const SymbolMap &InitialDests) {
+ ResourceTrackerSP RT, SymbolMap InitialDests) {
auto &JD = RT->getJITDylib();
- return JD.define(
- std::make_unique<RedirectableMaterializationUnit>(*this, InitialDests),
- RT);
+ return JD.define(std::make_unique<RedirectableMaterializationUnit>(
+ *this, std::move(InitialDests)),
+ RT);
}
More information about the llvm-commits
mailing list