summaryrefslogtreecommitdiffstats
path: root/include/llvm/ExecutionEngine
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/ExecutionEngine')
-rw-r--r--include/llvm/ExecutionEngine/ExecutionEngine.h11
-rw-r--r--include/llvm/ExecutionEngine/ObjectCache.h54
-rw-r--r--include/llvm/ExecutionEngine/RuntimeDyld.h7
-rw-r--r--include/llvm/ExecutionEngine/SectionMemoryManager.h6
4 files changed, 75 insertions, 3 deletions
diff --git a/include/llvm/ExecutionEngine/ExecutionEngine.h b/include/llvm/ExecutionEngine/ExecutionEngine.h
index 3fd69e2..bbaebc6 100644
--- a/include/llvm/ExecutionEngine/ExecutionEngine.h
+++ b/include/llvm/ExecutionEngine/ExecutionEngine.h
@@ -15,6 +15,7 @@
#ifndef LLVM_EXECUTIONENGINE_EXECUTIONENGINE_H
#define LLVM_EXECUTIONENGINE_EXECUTIONENGINE_H
+#include "llvm-c/ExecutionEngine.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
@@ -42,6 +43,7 @@ class JITMemoryManager;
class MachineCodeInfo;
class Module;
class MutexGuard;
+class ObjectCache;
class DataLayout;
class Triple;
class Type;
@@ -371,6 +373,12 @@ public:
virtual void RegisterJITEventListener(JITEventListener *) {}
virtual void UnregisterJITEventListener(JITEventListener *) {}
+ /// Sets the pre-compiled object cache. The ownership of the ObjectCache is
+ /// not changed. Supported by MCJIT but not JIT.
+ virtual void setObjectCache(ObjectCache *) {
+ llvm_unreachable("No support for an object cache");
+ }
+
/// DisableLazyCompilation - When lazy compilation is off (the default), the
/// JIT will eagerly compile every function reachable from the argument to
/// getPointerToFunction. If lazy compilation is turned on, the JIT will only
@@ -625,6 +633,9 @@ public:
ExecutionEngine *create(TargetMachine *TM);
};
+// Create wrappers for C Binding types (see CBindingWrapping.h).
+DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ExecutionEngine, LLVMExecutionEngineRef)
+
} // End llvm namespace
#endif
diff --git a/include/llvm/ExecutionEngine/ObjectCache.h b/include/llvm/ExecutionEngine/ObjectCache.h
new file mode 100644
index 0000000..0bee861
--- /dev/null
+++ b/include/llvm/ExecutionEngine/ObjectCache.h
@@ -0,0 +1,54 @@
+//===-- ObjectCache.h - Class definition for the ObjectCache -----C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIB_EXECUTIONENGINE_OBJECTCACHE_H
+#define LLVM_LIB_EXECUTIONENGINE_OBJECTCACHE_H
+
+#include "llvm/Support/MemoryBuffer.h"
+
+namespace llvm {
+
+class Module;
+
+/// This is the base ObjectCache type which can be provided to an
+/// ExecutionEngine for the purpose of avoiding compilation for Modules that
+/// have already been compiled and an object file is available.
+class ObjectCache {
+public:
+ ObjectCache() { }
+
+ virtual ~ObjectCache() { }
+
+ /// notifyObjectCompiled - Provides a pointer to compiled code for Module M.
+ virtual void notifyObjectCompiled(const Module *M, const MemoryBuffer *Obj) = 0;
+
+ /// getObjectCopy - Returns a pointer to a newly allocated MemoryBuffer that
+ /// contains the object which corresponds with Module M, or 0 if an object is
+ /// not available. The caller owns the MemoryBuffer returned by this function.
+ MemoryBuffer* getObjectCopy(const Module* M) {
+ const MemoryBuffer* Obj = getObject(M);
+ if (Obj)
+ return MemoryBuffer::getMemBufferCopy(Obj->getBuffer());
+ else
+ return 0;
+ }
+
+protected:
+ /// getObject - Returns a pointer to a MemoryBuffer that contains an object
+ /// that corresponds with Module M, or 0 if an object is not available.
+ /// The pointer returned by this function is not suitable for loading because
+ /// the memory is read-only and owned by the ObjectCache. To retrieve an
+ /// owning pointer to a MemoryBuffer (which is suitable for calling
+ /// RuntimeDyld::loadObject() with) use getObjectCopy() instead.
+ virtual const MemoryBuffer* getObject(const Module* M) = 0;
+};
+
+}
+
+#endif
diff --git a/include/llvm/ExecutionEngine/RuntimeDyld.h b/include/llvm/ExecutionEngine/RuntimeDyld.h
index 4222d53..c6c126c 100644
--- a/include/llvm/ExecutionEngine/RuntimeDyld.h
+++ b/include/llvm/ExecutionEngine/RuntimeDyld.h
@@ -66,6 +66,11 @@ public:
///
/// Returns true if an error occurred, false otherwise.
virtual bool applyPermissions(std::string *ErrMsg = 0) = 0;
+
+ /// Register the EH frames with the runtime so that c++ exceptions work. The
+ /// default implementation does nothing. Look at SectionMemoryManager for one
+ /// that uses __register_frame.
+ virtual void registerEHFrames(StringRef SectionData);
};
class RuntimeDyld {
@@ -109,6 +114,8 @@ public:
void mapSectionAddress(const void *LocalAddress, uint64_t TargetAddress);
StringRef getErrorString();
+
+ StringRef getEHFrameSection();
};
} // end namespace llvm
diff --git a/include/llvm/ExecutionEngine/SectionMemoryManager.h b/include/llvm/ExecutionEngine/SectionMemoryManager.h
index ae5004e1..84a4e08 100644
--- a/include/llvm/ExecutionEngine/SectionMemoryManager.h
+++ b/include/llvm/ExecutionEngine/SectionMemoryManager.h
@@ -72,6 +72,8 @@ public:
/// \returns true if an error occurred, false otherwise.
virtual bool applyPermissions(std::string *ErrMsg = 0);
+ void registerEHFrames(StringRef SectionData);
+
/// This method returns the address of the specified function. As such it is
/// only useful for resolving library symbols, not code generated symbols.
///
@@ -87,9 +89,7 @@ public:
/// explicit cache flush, otherwise JIT code manipulations (like resolved
/// relocations) will get to the data cache but not to the instruction cache.
///
- /// This method is not called by RuntimeDyld or MCJIT during the load
- /// process. Clients may call this function when needed. See the lli
- /// tool for example use.
+ /// This method is called from applyPermissions.
virtual void invalidateInstructionCache();
private:
OpenPOWER on IntegriCloud