Skip to content

Commit c6d6da4

Browse files
committed
[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.
1 parent 6fbbe15 commit c6d6da4

File tree

4 files changed

+19
-18
lines changed

4 files changed

+19
-18
lines changed

llvm/include/llvm/ExecutionEngine/Orc/MachOPlatform.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,17 +133,16 @@ class MachOPlatform : public Platform {
133133
/// RuntimeAliases function, in which case the client is responsible for
134134
/// setting up all aliases (including the required ones).
135135
static Expected<std::unique_ptr<MachOPlatform>>
136-
Create(ExecutionSession &ES, ObjectLinkingLayer &ObjLinkingLayer,
137-
JITDylib &PlatformJD, std::unique_ptr<DefinitionGenerator> OrcRuntime,
136+
Create(ObjectLinkingLayer &ObjLinkingLayer, JITDylib &PlatformJD,
137+
std::unique_ptr<DefinitionGenerator> OrcRuntime,
138138
HeaderOptions PlatformJDOpts = {},
139139
MachOHeaderMUBuilder BuildMachOHeaderMU = buildSimpleMachOHeaderMU,
140140
std::optional<SymbolAliasMap> RuntimeAliases = std::nullopt);
141141

142142
/// Construct using a path to the ORC runtime.
143143
static Expected<std::unique_ptr<MachOPlatform>>
144-
Create(ExecutionSession &ES, ObjectLinkingLayer &ObjLinkingLayer,
145-
JITDylib &PlatformJD, const char *OrcRuntimePath,
146-
HeaderOptions PlatformJDOpts = {},
144+
Create(ObjectLinkingLayer &ObjLinkingLayer, JITDylib &PlatformJD,
145+
const char *OrcRuntimePath, HeaderOptions PlatformJDOpts = {},
147146
MachOHeaderMUBuilder BuildMachOHeaderMU = buildSimpleMachOHeaderMU,
148147
std::optional<SymbolAliasMap> RuntimeAliases = std::nullopt);
149148

llvm/lib/ExecutionEngine/Orc/LLJIT.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,8 +1198,8 @@ Expected<JITDylibSP> ExecutorNativePlatform::operator()(LLJIT &J) {
11981198
if (!G)
11991199
return G.takeError();
12001200

1201-
if (auto P = MachOPlatform::Create(ES, *ObjLinkingLayer, PlatformJD,
1202-
std::move(*G)))
1201+
if (auto P =
1202+
MachOPlatform::Create(*ObjLinkingLayer, PlatformJD, std::move(*G)))
12031203
ES.setPlatform(std::move(*P));
12041204
else
12051205
return P.takeError();

llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -291,11 +291,14 @@ MachOPlatform::HeaderOptions::BuildVersionOpts::fromTriple(const Triple &TT,
291291
return MachOPlatform::HeaderOptions::BuildVersionOpts{Platform, MinOS, SDK};
292292
}
293293

294-
Expected<std::unique_ptr<MachOPlatform>> MachOPlatform::Create(
295-
ExecutionSession &ES, ObjectLinkingLayer &ObjLinkingLayer,
296-
JITDylib &PlatformJD, std::unique_ptr<DefinitionGenerator> OrcRuntime,
297-
HeaderOptions PlatformJDOpts, MachOHeaderMUBuilder BuildMachOHeaderMU,
298-
std::optional<SymbolAliasMap> RuntimeAliases) {
294+
Expected<std::unique_ptr<MachOPlatform>>
295+
MachOPlatform::Create(ObjectLinkingLayer &ObjLinkingLayer, JITDylib &PlatformJD,
296+
std::unique_ptr<DefinitionGenerator> OrcRuntime,
297+
HeaderOptions PlatformJDOpts,
298+
MachOHeaderMUBuilder BuildMachOHeaderMU,
299+
std::optional<SymbolAliasMap> RuntimeAliases) {
300+
301+
auto &ES = ObjLinkingLayer.getExecutionSession();
299302

300303
// If the target is not supported then bail out immediately.
301304
if (!supportedTarget(ES.getTargetTriple()))
@@ -334,9 +337,8 @@ Expected<std::unique_ptr<MachOPlatform>> MachOPlatform::Create(
334337
}
335338

336339
Expected<std::unique_ptr<MachOPlatform>>
337-
MachOPlatform::Create(ExecutionSession &ES, ObjectLinkingLayer &ObjLinkingLayer,
338-
JITDylib &PlatformJD, const char *OrcRuntimePath,
339-
HeaderOptions PlatformJDOpts,
340+
MachOPlatform::Create(ObjectLinkingLayer &ObjLinkingLayer, JITDylib &PlatformJD,
341+
const char *OrcRuntimePath, HeaderOptions PlatformJDOpts,
340342
MachOHeaderMUBuilder BuildMachOHeaderMU,
341343
std::optional<SymbolAliasMap> RuntimeAliases) {
342344

@@ -346,7 +348,7 @@ MachOPlatform::Create(ExecutionSession &ES, ObjectLinkingLayer &ObjLinkingLayer,
346348
if (!OrcRuntimeArchiveGenerator)
347349
return OrcRuntimeArchiveGenerator.takeError();
348350

349-
return Create(ES, ObjLinkingLayer, PlatformJD,
351+
return Create(ObjLinkingLayer, PlatformJD,
350352
std::move(*OrcRuntimeArchiveGenerator),
351353
std::move(PlatformJDOpts), std::move(BuildMachOHeaderMU),
352354
std::move(RuntimeAliases));

llvm/tools/llvm-jitlink/llvm-jitlink.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,8 +1033,8 @@ Session::Session(std::unique_ptr<ExecutorProcessControl> EPC, Error &Err)
10331033
PlatformJD->addToLinkOrder(*ProcessSymsJD);
10341034

10351035
if (TT.isOSBinFormatMachO()) {
1036-
if (auto P = MachOPlatform::Create(ES, ObjLayer, *PlatformJD,
1037-
OrcRuntime.c_str()))
1036+
if (auto P =
1037+
MachOPlatform::Create(ObjLayer, *PlatformJD, OrcRuntime.c_str()))
10381038
ES.setPlatform(std::move(*P));
10391039
else {
10401040
Err = P.takeError();

0 commit comments

Comments
 (0)