[llvm] c6d6da4 - [ORC][MachO] Remove the ExecutionSession& argument to MachOPlatform::Create.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 8 14:46:51 PDT 2024
Author: Lang Hames
Date: 2024-10-09T08:46:44+11:00
New Revision: c6d6da4659599507b44c167f335639082f28fae6
URL: https://github.com/llvm/llvm-project/commit/c6d6da4659599507b44c167f335639082f28fae6
DIFF: https://github.com/llvm/llvm-project/commit/c6d6da4659599507b44c167f335639082f28fae6.diff
LOG: [ORC][MachO] Remove the ExecutionSession& argument to MachOPlatform::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/MachOPlatform.h
llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp
llvm/tools/llvm-jitlink/llvm-jitlink.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/MachOPlatform.h b/llvm/include/llvm/ExecutionEngine/Orc/MachOPlatform.h
index 8c7d94a3b1f3bc..565f5aef0f4924 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/MachOPlatform.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/MachOPlatform.h
@@ -133,17 +133,16 @@ class MachOPlatform : 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<MachOPlatform>>
- Create(ExecutionSession &ES, ObjectLinkingLayer &ObjLinkingLayer,
- JITDylib &PlatformJD, std::unique_ptr<DefinitionGenerator> OrcRuntime,
+ Create(ObjectLinkingLayer &ObjLinkingLayer, JITDylib &PlatformJD,
+ std::unique_ptr<DefinitionGenerator> OrcRuntime,
HeaderOptions PlatformJDOpts = {},
MachOHeaderMUBuilder BuildMachOHeaderMU = buildSimpleMachOHeaderMU,
std::optional<SymbolAliasMap> RuntimeAliases = std::nullopt);
/// Construct using a path to the ORC runtime.
static Expected<std::unique_ptr<MachOPlatform>>
- Create(ExecutionSession &ES, ObjectLinkingLayer &ObjLinkingLayer,
- JITDylib &PlatformJD, const char *OrcRuntimePath,
- HeaderOptions PlatformJDOpts = {},
+ Create(ObjectLinkingLayer &ObjLinkingLayer, JITDylib &PlatformJD,
+ const char *OrcRuntimePath, HeaderOptions PlatformJDOpts = {},
MachOHeaderMUBuilder BuildMachOHeaderMU = buildSimpleMachOHeaderMU,
std::optional<SymbolAliasMap> RuntimeAliases = std::nullopt);
diff --git a/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp b/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
index 19b3f3d6ea0380..a13443ce57ea5c 100644
--- a/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp
@@ -1198,8 +1198,8 @@ Expected<JITDylibSP> ExecutorNativePlatform::operator()(LLJIT &J) {
if (!G)
return G.takeError();
- if (auto P = MachOPlatform::Create(ES, *ObjLinkingLayer, PlatformJD,
- std::move(*G)))
+ if (auto P =
+ MachOPlatform::Create(*ObjLinkingLayer, PlatformJD, std::move(*G)))
ES.setPlatform(std::move(*P));
else
return P.takeError();
diff --git a/llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp b/llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp
index 0248043493c23f..f728323d460eb9 100644
--- a/llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp
@@ -291,11 +291,14 @@ MachOPlatform::HeaderOptions::BuildVersionOpts::fromTriple(const Triple &TT,
return MachOPlatform::HeaderOptions::BuildVersionOpts{Platform, MinOS, SDK};
}
-Expected<std::unique_ptr<MachOPlatform>> MachOPlatform::Create(
- ExecutionSession &ES, ObjectLinkingLayer &ObjLinkingLayer,
- JITDylib &PlatformJD, std::unique_ptr<DefinitionGenerator> OrcRuntime,
- HeaderOptions PlatformJDOpts, MachOHeaderMUBuilder BuildMachOHeaderMU,
- std::optional<SymbolAliasMap> RuntimeAliases) {
+Expected<std::unique_ptr<MachOPlatform>>
+MachOPlatform::Create(ObjectLinkingLayer &ObjLinkingLayer, JITDylib &PlatformJD,
+ std::unique_ptr<DefinitionGenerator> OrcRuntime,
+ HeaderOptions PlatformJDOpts,
+ MachOHeaderMUBuilder BuildMachOHeaderMU,
+ std::optional<SymbolAliasMap> RuntimeAliases) {
+
+ auto &ES = ObjLinkingLayer.getExecutionSession();
// If the target is not supported then bail out immediately.
if (!supportedTarget(ES.getTargetTriple()))
@@ -334,9 +337,8 @@ Expected<std::unique_ptr<MachOPlatform>> MachOPlatform::Create(
}
Expected<std::unique_ptr<MachOPlatform>>
-MachOPlatform::Create(ExecutionSession &ES, ObjectLinkingLayer &ObjLinkingLayer,
- JITDylib &PlatformJD, const char *OrcRuntimePath,
- HeaderOptions PlatformJDOpts,
+MachOPlatform::Create(ObjectLinkingLayer &ObjLinkingLayer, JITDylib &PlatformJD,
+ const char *OrcRuntimePath, HeaderOptions PlatformJDOpts,
MachOHeaderMUBuilder BuildMachOHeaderMU,
std::optional<SymbolAliasMap> RuntimeAliases) {
@@ -346,7 +348,7 @@ MachOPlatform::Create(ExecutionSession &ES, ObjectLinkingLayer &ObjLinkingLayer,
if (!OrcRuntimeArchiveGenerator)
return OrcRuntimeArchiveGenerator.takeError();
- return Create(ES, ObjLinkingLayer, PlatformJD,
+ return Create(ObjLinkingLayer, PlatformJD,
std::move(*OrcRuntimeArchiveGenerator),
std::move(PlatformJDOpts), std::move(BuildMachOHeaderMU),
std::move(RuntimeAliases));
diff --git a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
index ee06f596bacb59..a2c05deefa6bfc 100644
--- a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
+++ b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
@@ -1033,8 +1033,8 @@ Session::Session(std::unique_ptr<ExecutorProcessControl> EPC, Error &Err)
PlatformJD->addToLinkOrder(*ProcessSymsJD);
if (TT.isOSBinFormatMachO()) {
- if (auto P = MachOPlatform::Create(ES, ObjLayer, *PlatformJD,
- OrcRuntime.c_str()))
+ if (auto P =
+ MachOPlatform::Create(ObjLayer, *PlatformJD, OrcRuntime.c_str()))
ES.setPlatform(std::move(*P));
else {
Err = P.takeError();
More information about the llvm-commits
mailing list