summaryrefslogtreecommitdiff
path: root/include/llvm/ExecutionEngine
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/ExecutionEngine')
-rw-r--r--include/llvm/ExecutionEngine/ExecutionEngine.h32
-rw-r--r--include/llvm/ExecutionEngine/SectionMemoryManager.h52
2 files changed, 28 insertions, 56 deletions
diff --git a/include/llvm/ExecutionEngine/ExecutionEngine.h b/include/llvm/ExecutionEngine/ExecutionEngine.h
index bbaebc6f90..83a672de2b 100644
--- a/include/llvm/ExecutionEngine/ExecutionEngine.h
+++ b/include/llvm/ExecutionEngine/ExecutionEngine.h
@@ -34,6 +34,7 @@ namespace llvm {
struct GenericValue;
class Constant;
+class DataLayout;
class ExecutionEngine;
class Function;
class GlobalVariable;
@@ -44,7 +45,7 @@ class MachineCodeInfo;
class Module;
class MutexGuard;
class ObjectCache;
-class DataLayout;
+class RTDyldMemoryManager;
class Triple;
class Type;
@@ -142,7 +143,7 @@ protected:
static ExecutionEngine *(*MCJITCtor)(
Module *M,
std::string *ErrorStr,
- JITMemoryManager *JMM,
+ RTDyldMemoryManager *MCJMM,
bool GVsWithCode,
TargetMachine *TM);
static ExecutionEngine *(*InterpCtor)(Module *M, std::string *ErrorStr);
@@ -496,6 +497,7 @@ private:
EngineKind::Kind WhichEngine;
std::string *ErrorStr;
CodeGenOpt::Level OptLevel;
+ RTDyldMemoryManager *MCJMM;
JITMemoryManager *JMM;
bool AllocateGVsWithCode;
TargetOptions Options;
@@ -511,6 +513,7 @@ private:
WhichEngine = EngineKind::Either;
ErrorStr = NULL;
OptLevel = CodeGenOpt::Default;
+ MCJMM = NULL;
JMM = NULL;
Options = TargetOptions();
AllocateGVsWithCode = false;
@@ -532,12 +535,29 @@ public:
WhichEngine = w;
return *this;
}
+
+ /// setMCJITMemoryManager - Sets the MCJIT memory manager to use. This allows
+ /// clients to customize their memory allocation policies for the MCJIT. This
+ /// is only appropriate for the MCJIT; setting this and configuring the builder
+ /// to create anything other than MCJIT will cause a runtime error. If create()
+ /// is called and is successful, the created engine takes ownership of the
+ /// memory manager. This option defaults to NULL. Using this option nullifies
+ /// the setJITMemoryManager() option.
+ EngineBuilder &setMCJITMemoryManager(RTDyldMemoryManager *mcjmm) {
+ MCJMM = mcjmm;
+ JMM = NULL;
+ return *this;
+ }
- /// setJITMemoryManager - Sets the memory manager to use. This allows
- /// clients to customize their memory allocation policies. If create() is
- /// called and is successful, the created engine takes ownership of the
- /// memory manager. This option defaults to NULL.
+ /// setJITMemoryManager - Sets the JIT memory manager to use. This allows
+ /// clients to customize their memory allocation policies. This is only
+ /// appropriate for either JIT or MCJIT; setting this and configuring the
+ /// builder to create an interpreter will cause a runtime error. If create()
+ /// is called and is successful, the created engine takes ownership of the
+ /// memory manager. This option defaults to NULL. This option overrides
+ /// setMCJITMemoryManager() as well.
EngineBuilder &setJITMemoryManager(JITMemoryManager *jmm) {
+ MCJMM = NULL;
JMM = jmm;
return *this;
}
diff --git a/include/llvm/ExecutionEngine/SectionMemoryManager.h b/include/llvm/ExecutionEngine/SectionMemoryManager.h
index 07e6832324..305a96619a 100644
--- a/include/llvm/ExecutionEngine/SectionMemoryManager.h
+++ b/include/llvm/ExecutionEngine/SectionMemoryManager.h
@@ -16,7 +16,7 @@
#define LLVM_EXECUTIONENGINE_SECTIONMEMORYMANAGER_H
#include "llvm/ADT/SmallVector.h"
-#include "llvm/ExecutionEngine/JITMemoryManager.h"
+#include "llvm/ExecutionEngine/RuntimeDyld.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Memory.h"
@@ -35,7 +35,7 @@ namespace llvm {
/// in the JITed object. Permissions can be applied either by calling
/// MCJIT::finalizeObject or by calling SectionMemoryManager::applyPermissions
/// directly. Clients of MCJIT should call MCJIT::finalizeObject.
-class SectionMemoryManager : public JITMemoryManager {
+class SectionMemoryManager : public RTDyldMemoryManager {
SectionMemoryManager(const SectionMemoryManager&) LLVM_DELETED_FUNCTION;
void operator=(const SectionMemoryManager&) LLVM_DELETED_FUNCTION;
@@ -108,54 +108,6 @@ private:
MemoryGroup CodeMem;
MemoryGroup RWDataMem;
MemoryGroup RODataMem;
-
-public:
- ///
- /// Functions below are not used by MCJIT or RuntimeDyld, but must be
- /// implemented because they are declared as pure virtuals in the base class.
- ///
-
- virtual void setMemoryWritable() {
- llvm_unreachable("Unexpected call!");
- }
- virtual void setMemoryExecutable() {
- llvm_unreachable("Unexpected call!");
- }
- virtual void setPoisonMemory(bool poison) {
- llvm_unreachable("Unexpected call!");
- }
- virtual void AllocateGOT() {
- llvm_unreachable("Unexpected call!");
- }
- virtual uint8_t *getGOTBase() const {
- llvm_unreachable("Unexpected call!");
- return 0;
- }
- virtual uint8_t *startFunctionBody(const Function *F,
- uintptr_t &ActualSize){
- llvm_unreachable("Unexpected call!");
- return 0;
- }
- virtual uint8_t *allocateStub(const GlobalValue *F, unsigned StubSize,
- unsigned Alignment) {
- llvm_unreachable("Unexpected call!");
- return 0;
- }
- virtual void endFunctionBody(const Function *F, uint8_t *FunctionStart,
- uint8_t *FunctionEnd) {
- llvm_unreachable("Unexpected call!");
- }
- virtual uint8_t *allocateSpace(intptr_t Size, unsigned Alignment) {
- llvm_unreachable("Unexpected call!");
- return 0;
- }
- virtual uint8_t *allocateGlobal(uintptr_t Size, unsigned Alignment) {
- llvm_unreachable("Unexpected call!");
- return 0;
- }
- virtual void deallocateFunctionBody(void *Body) {
- llvm_unreachable("Unexpected call!");
- }
};
}