-Wdeprecated-clean: Fix cases of violating the rule of 5 in ways that are deprecated...
[oota-llvm.git] / include / llvm / ExecutionEngine / Orc / IRCompileLayer.h
index 6a7ae15c6aa37363169d5663d604a448a784327c..637902200786e914b22d2013be40431e290bef83 100644 (file)
 #ifndef LLVM_EXECUTIONENGINE_ORC_IRCOMPILELAYER_H
 #define LLVM_EXECUTIONENGINE_ORC_IRCOMPILELAYER_H
 
+#include "JITSymbol.h"
 #include "llvm/ExecutionEngine/ObjectCache.h"
+#include "llvm/ExecutionEngine/RTDyldMemoryManager.h"
 #include "llvm/Object/ObjectFile.h"
 #include <memory>
 
 namespace llvm {
+namespace orc {
 
 /// @brief Eager IR compiling layer.
 ///
@@ -49,14 +52,16 @@ public:
   /// @brief Set an ObjectCache to query before compiling.
   void setObjectCache(ObjectCache *NewCache) { ObjCache = NewCache; }
 
-  /// @brief Compile each module in the given module set, then then add the
-  ///        resulting set of objects to the base layer, along with the memory
-  //         manager MM.
+  /// @brief Compile each module in the given module set, then add the resulting
+  ///        set of objects to the base layer along with the memory manager and
+  ///        symbol resolver.
   ///
   /// @return A handle for the added modules.
-  template <typename ModuleSetT>
+  template <typename ModuleSetT, typename MemoryManagerPtrT,
+            typename SymbolResolverPtrT>
   ModuleSetHandleT addModuleSet(ModuleSetT Ms,
-                                std::unique_ptr<RTDyldMemoryManager> MM) {
+                                MemoryManagerPtrT MemMgr,
+                                SymbolResolverPtrT Resolver) {
     OwningObjectVec Objects;
     OwningBufferVec Buffers;
 
@@ -78,7 +83,7 @@ public:
     }
 
     ModuleSetHandleT H =
-      BaseLayer.addObjectSet(Objects, std::move(MM));
+      BaseLayer.addObjectSet(Objects, std::move(MemMgr), std::move(Resolver));
 
     BaseLayer.takeOwnershipOfBuffers(H, std::move(Buffers));
 
@@ -88,18 +93,32 @@ public:
   /// @brief Remove the module set associated with the handle H.
   void removeModuleSet(ModuleSetHandleT H) { BaseLayer.removeObjectSet(H); }
 
-  /// @brief Get the address of a loaded symbol. This call is forwarded to the
-  ///        base layer's getSymbolAddress implementation.
-  uint64_t getSymbolAddress(const std::string &Name, bool ExportedSymbolsOnly) {
-    return BaseLayer.getSymbolAddress(Name, ExportedSymbolsOnly);
+  /// @brief Search for the given named symbol.
+  /// @param Name The name of the symbol to search for.
+  /// @param ExportedSymbolsOnly If true, search only for exported symbols.
+  /// @return A handle for the given named symbol, if it exists.
+  JITSymbol findSymbol(const std::string &Name, bool ExportedSymbolsOnly) {
+    return BaseLayer.findSymbol(Name, ExportedSymbolsOnly);
   }
 
   /// @brief Get the address of the given symbol in the context of the set of
   ///        compiled modules represented by the handle H. This call is
   ///        forwarded to the base layer's implementation.
-  uint64_t lookupSymbolAddressIn(ModuleSetHandleT H, const std::string &Name,
-                                 bool ExportedSymbolsOnly) {
-    return BaseLayer.lookupSymbolAddressIn(H, Name, ExportedSymbolsOnly);
+  /// @param H The handle for the module set to search in.
+  /// @param Name The name of the symbol to search for.
+  /// @param ExportedSymbolsOnly If true, search only for exported symbols.
+  /// @return A handle for the given named symbol, if it is found in the
+  ///         given module set.
+  JITSymbol findSymbolIn(ModuleSetHandleT H, const std::string &Name,
+                         bool ExportedSymbolsOnly) {
+    return BaseLayer.findSymbolIn(H, Name, ExportedSymbolsOnly);
+  }
+
+  /// @brief Immediately emit and finalize the moduleOB set represented by the
+  ///        given handle.
+  /// @param H Handle for module set to emit/finalize.
+  void emitAndFinalize(ModuleSetHandleT H) {
+    BaseLayer.emitAndFinalize(H);
   }
 
 private:
@@ -122,6 +141,8 @@ private:
   CompileFtor Compile;
   ObjectCache *ObjCache;
 };
-}
+
+} // End namespace orc.
+} // End namespace llvm.
 
 #endif // LLVM_EXECUTIONENGINE_ORC_IRCOMPILINGLAYER_H