[llvm] cc20dd2 - [ORC][ELF] Remove the ExecutionSession& argument to ELFNixPlatform::Create.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 10 16:23:39 PDT 2024
Author: Lang Hames
Date: 2024-10-11T10:23:33+11:00
New Revision: cc20dd285ab72292a1d383d0779aecbe5e1ccf81
URL: https://github.com/llvm/llvm-project/commit/cc20dd285ab72292a1d383d0779aecbe5e1ccf81
DIFF: https://github.com/llvm/llvm-project/commit/cc20dd285ab72292a1d383d0779aecbe5e1ccf81.diff
LOG: [ORC][ELF] Remove the ExecutionSession& argument to ELFNixPlatform::Create.
We can get a reference to the ExecutionSession from the ObjectLinkingLayer
argument, so there's no need to pass it in separately.
Added:
Modified:
llvm/include/llvm/ExecutionEngine/Orc/ELFNixPlatform.h
llvm/lib/ExecutionEngine/Orc/ELFNixPlatform.cpp
llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
llvm/tools/llvm-jitlink/llvm-jitlink.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/ELFNixPlatform.h b/llvm/include/llvm/ExecutionEngine/Orc/ELFNixPlatform.h
index 40b85e32720108..54442c91096b39 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/ELFNixPlatform.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/ELFNixPlatform.h
@@ -106,14 +106,14 @@ class ELFNixPlatform : public Platform {
/// RuntimeAliases function, in which case the client is responsible for
/// setting up all aliases (including the required ones).
static Expected<std::unique_ptr<ELFNixPlatform>>
- Create(ExecutionSession &ES, ObjectLinkingLayer &ObjLinkingLayer,
- JITDylib &PlatformJD, std::unique_ptr<DefinitionGenerator> OrcRuntime,
+ Create(ObjectLinkingLayer &ObjLinkingLayer, JITDylib &PlatformJD,
+ std::unique_ptr<DefinitionGenerator> OrcRuntime,
std::optional<SymbolAliasMap> RuntimeAliases = std::nullopt);
/// Construct using a path to the ORC runtime.
static Expected<std::unique_ptr<ELFNixPlatform>>
- Create(ExecutionSession &ES, ObjectLinkingLayer &ObjLinkingLayer,
- JITDylib &PlatformJD, const char *OrcRuntimePath,
+ Create(ObjectLinkingLayer &ObjLinkingLayer, JITDylib &PlatformJD,
+ const char *OrcRuntimePath,
std::optional<SymbolAliasMap> RuntimeAliases = std::nullopt);
ExecutionSession &getExecutionSession() const { return ES; }
@@ -211,8 +211,7 @@ class ELFNixPlatform : public Platform {
static bool supportedTarget(const Triple &TT);
- ELFNixPlatform(ExecutionSession &ES, ObjectLinkingLayer &ObjLinkingLayer,
- JITDylib &PlatformJD,
+ ELFNixPlatform(ObjectLinkingLayer &ObjLinkingLayer, JITDylib &PlatformJD,
std::unique_ptr<DefinitionGenerator> OrcRuntimeGenerator,
Error &Err);
@@ -308,4 +307,4 @@ using SPSELFNixJITDylibDepInfoMap =
} // end namespace orc
} // end namespace llvm
-#endif // LLVM_EXECUTIONENGINE_ORC_ELFNIXPLATFORM_H
\ No newline at end of file
+#endif // LLVM_EXECUTIONENGINE_ORC_ELFNIXPLATFORM_H
diff --git a/llvm/lib/ExecutionEngine/Orc/ELFNixPlatform.cpp b/llvm/lib/ExecutionEngine/Orc/ELFNixPlatform.cpp
index d92077dbcbd034..610ecbff5c5c4d 100644
--- a/llvm/lib/ExecutionEngine/Orc/ELFNixPlatform.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/ELFNixPlatform.cpp
@@ -233,10 +233,13 @@ class DSOHandleMaterializationUnit : public MaterializationUnit {
namespace llvm {
namespace orc {
-Expected<std::unique_ptr<ELFNixPlatform>> ELFNixPlatform::Create(
- ExecutionSession &ES, ObjectLinkingLayer &ObjLinkingLayer,
- JITDylib &PlatformJD, std::unique_ptr<DefinitionGenerator> OrcRuntime,
- std::optional<SymbolAliasMap> RuntimeAliases) {
+Expected<std::unique_ptr<ELFNixPlatform>>
+ELFNixPlatform::Create(ObjectLinkingLayer &ObjLinkingLayer,
+ JITDylib &PlatformJD,
+ std::unique_ptr<DefinitionGenerator> OrcRuntime,
+ std::optional<SymbolAliasMap> RuntimeAliases) {
+
+ auto &ES = ObjLinkingLayer.getExecutionSession();
// If the target is not supported then bail out immediately.
if (!supportedTarget(ES.getTargetTriple()))
@@ -271,15 +274,14 @@ Expected<std::unique_ptr<ELFNixPlatform>> ELFNixPlatform::Create(
// Create the instance.
Error Err = Error::success();
auto P = std::unique_ptr<ELFNixPlatform>(new ELFNixPlatform(
- ES, ObjLinkingLayer, PlatformJD, std::move(OrcRuntime), Err));
+ ObjLinkingLayer, PlatformJD, std::move(OrcRuntime), Err));
if (Err)
return std::move(Err);
return std::move(P);
}
Expected<std::unique_ptr<ELFNixPlatform>>
-ELFNixPlatform::Create(ExecutionSession &ES,
- ObjectLinkingLayer &ObjLinkingLayer,
+ELFNixPlatform::Create(ObjectLinkingLayer &ObjLinkingLayer,
JITDylib &PlatformJD, const char *OrcRuntimePath,
std::optional<SymbolAliasMap> RuntimeAliases) {
@@ -289,7 +291,7 @@ ELFNixPlatform::Create(ExecutionSession &ES,
if (!OrcRuntimeArchiveGenerator)
return OrcRuntimeArchiveGenerator.takeError();
- return Create(ES, ObjLinkingLayer, PlatformJD,
+ return Create(ObjLinkingLayer, PlatformJD,
std::move(*OrcRuntimeArchiveGenerator),
std::move(RuntimeAliases));
}
@@ -392,10 +394,10 @@ bool ELFNixPlatform::supportedTarget(const Triple &TT) {
}
ELFNixPlatform::ELFNixPlatform(
- ExecutionSession &ES, ObjectLinkingLayer &ObjLinkingLayer,
- JITDylib &PlatformJD,
+ ObjectLinkingLayer &ObjLinkingLayer, JITDylib &PlatformJD,
std::unique_ptr<DefinitionGenerator> OrcRuntimeGenerator, Error &Err)
- : ES(ES), PlatformJD(PlatformJD), ObjLinkingLayer(ObjLinkingLayer),
+ : ES(ObjLinkingLayer.getExecutionSession()), PlatformJD(PlatformJD),
+ ObjLinkingLayer(ObjLinkingLayer),
DSOHandleSymbol(ES.intern("__dso_handle")) {
ErrorAsOutParameter _(&Err);
ObjLinkingLayer.addPlugin(std::make_unique<ELFNixPlatformPlugin>(*this));
diff --git a/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp b/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
index a13443ce57ea5c..d3dd3b6bedfb65 100644
--- a/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
@@ -1185,8 +1185,8 @@ Expected<JITDylibSP> ExecutorNativePlatform::operator()(LLJIT &J) {
if (!G)
return G.takeError();
- if (auto P = ELFNixPlatform::Create(ES, *ObjLinkingLayer, PlatformJD,
- std::move(*G)))
+ if (auto P =
+ ELFNixPlatform::Create(*ObjLinkingLayer, PlatformJD, std::move(*G)))
J.getExecutionSession().setPlatform(std::move(*P));
else
return P.takeError();
diff --git a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
index a2c05deefa6bfc..108cadd2e0169c 100644
--- a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
+++ b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
@@ -1041,8 +1041,8 @@ Session::Session(std::unique_ptr<ExecutorProcessControl> EPC, Error &Err)
return;
}
} else if (TT.isOSBinFormatELF()) {
- if (auto P = ELFNixPlatform::Create(ES, ObjLayer, *PlatformJD,
- OrcRuntime.c_str()))
+ if (auto P =
+ ELFNixPlatform::Create(ObjLayer, *PlatformJD, OrcRuntime.c_str()))
ES.setPlatform(std::move(*P));
else {
Err = P.takeError();
More information about the llvm-commits
mailing list