aboutsummaryrefslogtreecommitdiff
path: root/lib/ExecutionEngine/JIT/JIT.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-12-06 01:34:04 +0000
committerChris Lattner <sabre@nondot.org>2007-12-06 01:34:04 +0000
commit34c9433004cabd4760987dce4804a91c84908219 (patch)
treeab136b7e1e199a68e9fe6ab59846e27cb8fce91e /lib/ExecutionEngine/JIT/JIT.cpp
parent9f2f142d255bc96f109dd5c6524a485937b1f3a1 (diff)
add a new ExecutionEngine::createJIT which can be used if you only want
to create a JIT. This lets you specify JIT-specific configuration items like the JITMemoryManager to use. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44647 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine/JIT/JIT.cpp')
-rw-r--r--lib/ExecutionEngine/JIT/JIT.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/lib/ExecutionEngine/JIT/JIT.cpp b/lib/ExecutionEngine/JIT/JIT.cpp
index b599497502..d6267d509a 100644
--- a/lib/ExecutionEngine/JIT/JIT.cpp
+++ b/lib/ExecutionEngine/JIT/JIT.cpp
@@ -61,12 +61,29 @@ namespace llvm {
}
}
-JIT::JIT(ModuleProvider *MP, TargetMachine &tm, TargetJITInfo &tji)
+/// createJIT - This is the factory method for creating a JIT for the current
+/// machine, it does not fall back to the interpreter. This takes ownership
+/// of the module provider.
+ExecutionEngine *ExecutionEngine::createJIT(ModuleProvider *MP,
+ std::string *ErrorStr,
+ JITMemoryManager *JMM) {
+ ExecutionEngine *EE = JIT::createJIT(MP, ErrorStr, JMM);
+ if (!EE) return 0;
+
+
+ // Make sure we can resolve symbols in the program as well. The zero arg
+ // to the function tells DynamicLibrary to load the program, not a library.
+ sys::DynamicLibrary::LoadLibraryPermanently(0, ErrorStr);
+ return EE;
+}
+
+JIT::JIT(ModuleProvider *MP, TargetMachine &tm, TargetJITInfo &tji,
+ JITMemoryManager *JMM)
: ExecutionEngine(MP), TM(tm), TJI(tji), jitstate(MP) {
setTargetData(TM.getTargetData());
// Initialize MCE
- MCE = createEmitter(*this, 0);
+ MCE = createEmitter(*this, JMM);
// Add target data
MutexGuard locked(lock);