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
diff --git a/lib/ExecutionEngine/JIT/JIT.cpp b/lib/ExecutionEngine/JIT/JIT.cpp
index b599497..d6267d5 100644
--- a/lib/ExecutionEngine/JIT/JIT.cpp
+++ b/lib/ExecutionEngine/JIT/JIT.cpp
@@ -61,12 +61,29 @@
   }
 }
 
-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);