[llvm] r341872 - [ORC] Simplify LLJIT::Create by removing the ExecutionSession parameter.

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 10 15:08:58 PDT 2018


Author: lhames
Date: Mon Sep 10 15:08:57 2018
New Revision: 341872

URL: http://llvm.org/viewvc/llvm-project?rev=341872&view=rev
Log:
[ORC] Simplify LLJIT::Create by removing the ExecutionSession parameter.

The Create method can just construct the ExecutionSession, rather than having the
client pass it in.

Modified:
    llvm/trunk/include/llvm/ExecutionEngine/Orc/LLJIT.h
    llvm/trunk/lib/ExecutionEngine/Orc/LLJIT.cpp
    llvm/trunk/tools/lli/lli.cpp

Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/LLJIT.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/LLJIT.h?rev=341872&r1=341871&r2=341872&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/LLJIT.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/LLJIT.h Mon Sep 10 15:08:57 2018
@@ -31,8 +31,7 @@ class LLJIT {
 public:
   /// Create an LLJIT instance.
   static Expected<std::unique_ptr<LLJIT>>
-  Create(std::unique_ptr<ExecutionSession> ES,
-         std::unique_ptr<TargetMachine> TM, DataLayout DL);
+  Create(std::unique_ptr<TargetMachine> TM, DataLayout DL);
 
   /// Returns a reference to the ExecutionSession for this JIT instance.
   ExecutionSession &getExecutionSession() { return *ES; }
@@ -117,8 +116,7 @@ class LLLazyJIT : public LLJIT {
 public:
   /// Create an LLLazyJIT instance.
   static Expected<std::unique_ptr<LLLazyJIT>>
-  Create(std::unique_ptr<ExecutionSession> ES,
-         std::unique_ptr<TargetMachine> TM, DataLayout DL, LLVMContext &Ctx);
+  Create(std::unique_ptr<TargetMachine> TM, DataLayout DL, LLVMContext &Ctx);
 
   /// Set an IR transform (e.g. pass manager pipeline) to run on each function
   /// when it is compiled.

Modified: llvm/trunk/lib/ExecutionEngine/Orc/LLJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/LLJIT.cpp?rev=341872&r1=341871&r2=341872&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/Orc/LLJIT.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/Orc/LLJIT.cpp Mon Sep 10 15:08:57 2018
@@ -16,10 +16,9 @@ namespace llvm {
 namespace orc {
 
 Expected<std::unique_ptr<LLJIT>>
-LLJIT::Create(std::unique_ptr<ExecutionSession> ES,
-              std::unique_ptr<TargetMachine> TM, DataLayout DL) {
-  return std::unique_ptr<LLJIT>(
-      new LLJIT(std::move(ES), std::move(TM), std::move(DL)));
+LLJIT::Create(std::unique_ptr<TargetMachine> TM, DataLayout DL) {
+  return std::unique_ptr<LLJIT>(new LLJIT(llvm::make_unique<ExecutionSession>(),
+                                          std::move(TM), std::move(DL)));
 }
 
 Error LLJIT::defineAbsolute(StringRef Name, JITEvaluatedSymbol Sym) {
@@ -91,9 +90,10 @@ void LLJIT::recordCtorDtors(Module &M) {
 }
 
 Expected<std::unique_ptr<LLLazyJIT>>
-LLLazyJIT::Create(std::unique_ptr<ExecutionSession> ES,
-                  std::unique_ptr<TargetMachine> TM, DataLayout DL,
+LLLazyJIT::Create(std::unique_ptr<TargetMachine> TM, DataLayout DL,
                   LLVMContext &Ctx) {
+  auto ES = llvm::make_unique<ExecutionSession>();
+
   const Triple &TT = TM->getTargetTriple();
 
   auto CCMgr = createLocalCompileCallbackManager(TT, *ES, 0);

Modified: llvm/trunk/tools/lli/lli.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lli/lli.cpp?rev=341872&r1=341871&r2=341872&view=diff
==============================================================================
--- llvm/trunk/tools/lli/lli.cpp (original)
+++ llvm/trunk/tools/lli/lli.cpp Mon Sep 10 15:08:57 2018
@@ -758,9 +758,7 @@ int runOrcLazyJIT(const char *ProgName)
                         : None);
   auto TM = ExitOnErr(TMD.createTargetMachine());
   auto DL = TM->createDataLayout();
-  auto ES = llvm::make_unique<orc::ExecutionSession>();
-  auto J =
-      ExitOnErr(orc::LLLazyJIT::Create(std::move(ES), std::move(TM), DL, Ctx));
+  auto J = ExitOnErr(orc::LLLazyJIT::Create(std::move(TM), DL, Ctx));
 
   auto Dump = createDebugDumper();
 




More information about the llvm-commits mailing list