summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2013-12-07 03:05:51 +0000
committerLang Hames <lhames@gmail.com>2013-12-07 03:05:51 +0000
commite7777cdc643d15671c5a7bc7c24753820298c100 (patch)
tree474612a707de090c7ca2651c5d1d391c2c855fff /include
parenteb2934e78230f0a03db4b35b33ba9eda77755967 (diff)
downloadllvm-e7777cdc643d15671c5a7bc7c24753820298c100.tar.gz
llvm-e7777cdc643d15671c5a7bc7c24753820298c100.tar.bz2
llvm-e7777cdc643d15671c5a7bc7c24753820298c100.tar.xz
Add support for archives and object file caching under MCJIT.
Patch by Andy Kaylor, with minor edits to resolve merge conflicts. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196639 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/ExecutionEngine/ExecutionEngine.h32
-rw-r--r--include/llvm/ExecutionEngine/RuntimeDyld.h10
2 files changed, 42 insertions, 0 deletions
diff --git a/include/llvm/ExecutionEngine/ExecutionEngine.h b/include/llvm/ExecutionEngine/ExecutionEngine.h
index 233084dd50..ad1a83f95b 100644
--- a/include/llvm/ExecutionEngine/ExecutionEngine.h
+++ b/include/llvm/ExecutionEngine/ExecutionEngine.h
@@ -48,6 +48,11 @@ class RTDyldMemoryManager;
class Triple;
class Type;
+namespace object {
+ class Archive;
+ class ObjectFile;
+}
+
/// \brief Helper class for helping synchronize access to the global address map
/// table.
class ExecutionEngineState {
@@ -204,6 +209,33 @@ public:
Modules.push_back(M);
}
+ /// addObjectFile - Add an ObjectFile to the execution engine.
+ ///
+ /// This method is only supported by MCJIT. MCJIT will immediately load the
+ /// object into memory and adds its symbols to the list used to resolve
+ /// external symbols while preparing other objects for execution.
+ ///
+ /// Objects added using this function will not be made executable until
+ /// needed by another object.
+ ///
+ /// MCJIT will take ownership of the ObjectFile.
+ virtual void addObjectFile(object::ObjectFile *O) {
+ llvm_unreachable(
+ "ExecutionEngine subclass doesn't implement addObjectFile.");
+ }
+
+ /// addArchive - Add an Archive to the execution engine.
+ ///
+ /// This method is only supported by MCJIT. MCJIT will use the archive to
+ /// resolve external symbols in objects it is loading. If a symbol is found
+ /// in the Archive the contained object file will be extracted (in memory)
+ /// and loaded for possible execution.
+ ///
+ /// MCJIT will take ownership of the Archive.
+ virtual void addArchive(object::Archive *A) {
+ llvm_unreachable("ExecutionEngine subclass doesn't implement addArchive.");
+ }
+
//===--------------------------------------------------------------------===//
const DataLayout *getDataLayout() const { return TD; }
diff --git a/include/llvm/ExecutionEngine/RuntimeDyld.h b/include/llvm/ExecutionEngine/RuntimeDyld.h
index b8324387bb..fd9f338669 100644
--- a/include/llvm/ExecutionEngine/RuntimeDyld.h
+++ b/include/llvm/ExecutionEngine/RuntimeDyld.h
@@ -21,6 +21,10 @@
namespace llvm {
+namespace object {
+ class ObjectFile;
+}
+
class RuntimeDyldImpl;
class ObjectImage;
@@ -46,6 +50,12 @@ public:
/// failure, the input buffer will be deleted.
ObjectImage *loadObject(ObjectBuffer *InputBuffer);
+ /// Prepare the referenced object file for execution.
+ /// Ownership of the input object is transferred to the ObjectImage
+ /// instance returned from this function if successful. In the case of load
+ /// failure, the input object will be deleted.
+ ObjectImage *loadObject(object::ObjectFile *InputObject);
+
/// Get the address of our local copy of the symbol. This may or may not
/// be the address used for relocation (clients can copy the data around
/// and resolve relocatons based on where they put it).