[MCJIT][Orc] Refactor RTDyldMemoryManager, weave RuntimeDyld::SymbolInfo through
[oota-llvm.git] / include / llvm / ExecutionEngine / ExecutionEngine.h
index abdaa0ce54c8e381ad6619fdcebc07b5a0a8342c..6e022afae5fdab7c1b5be41df5a12c3c10ed8f39 100644 (file)
@@ -15,6 +15,7 @@
 #ifndef LLVM_EXECUTIONENGINE_EXECUTIONENGINE_H
 #define LLVM_EXECUTIONENGINE_EXECUTIONENGINE_H
 
+#include "RuntimeDyld.h"
 #include "llvm-c/ExecutionEngine.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
@@ -42,6 +43,7 @@ class GlobalVariable;
 class GlobalValue;
 class JITEventListener;
 class MachineCodeInfo;
+class MCJITMemoryManager;
 class MutexGuard;
 class ObjectCache;
 class RTDyldMemoryManager;
@@ -139,15 +141,17 @@ protected:
   virtual char *getMemoryForGV(const GlobalVariable *GV);
 
   static ExecutionEngine *(*MCJITCtor)(
-                                     std::unique_ptr<Module> M,
-                                     std::string *ErrorStr,
-                                     std::unique_ptr<RTDyldMemoryManager> MCJMM,
-                                     std::unique_ptr<TargetMachine> TM);
+                                std::unique_ptr<Module> M,
+                                std::string *ErrorStr,
+                                std::shared_ptr<MCJITMemoryManager> MM,
+                                std::shared_ptr<RuntimeDyld::SymbolResolver> SR,
+                                std::unique_ptr<TargetMachine> TM);
 
   static ExecutionEngine *(*OrcMCJITReplacementCtor)(
-                                    std::string *ErrorStr,
-                                    std::unique_ptr<RTDyldMemoryManager> OrcJMM,
-                                    std::unique_ptr<TargetMachine> TM);
+                                std::string *ErrorStr,
+                                std::shared_ptr<MCJITMemoryManager> MM,
+                                std::shared_ptr<RuntimeDyld::SymbolResolver> SR,
+                                std::unique_ptr<TargetMachine> TM);
 
   static ExecutionEngine *(*InterpCtor)(std::unique_ptr<Module> M,
                                         std::string *ErrorStr);
@@ -500,7 +504,8 @@ private:
   EngineKind::Kind WhichEngine;
   std::string *ErrorStr;
   CodeGenOpt::Level OptLevel;
-  std::unique_ptr<RTDyldMemoryManager> MCJMM;
+  std::shared_ptr<MCJITMemoryManager> MemMgr;
+  std::shared_ptr<RuntimeDyld::SymbolResolver> Resolver;
   TargetOptions Options;
   Reloc::Model RelocModel;
   CodeModel::Model CMModel;
@@ -535,6 +540,12 @@ public:
   /// memory manager. This option defaults to NULL.
   EngineBuilder &setMCJITMemoryManager(std::unique_ptr<RTDyldMemoryManager> mcjmm);
 
+  EngineBuilder&
+  setMemoryManager(std::unique_ptr<MCJITMemoryManager> MM);
+
+  EngineBuilder&
+  setSymbolResolver(std::unique_ptr<RuntimeDyld::SymbolResolver> SR);
+
   /// setErrorStr - Set the error string to write to on error.  This option
   /// defaults to NULL.
   EngineBuilder &setErrorStr(std::string *e) {