summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/llvm/ExecutionEngine/ExecutionEngine.h8
-rw-r--r--lib/ExecutionEngine/ExecutionEngine.cpp4
2 files changed, 11 insertions, 1 deletions
diff --git a/include/llvm/ExecutionEngine/ExecutionEngine.h b/include/llvm/ExecutionEngine/ExecutionEngine.h
index 2a2fb7cb8c..da034a7cc2 100644
--- a/include/llvm/ExecutionEngine/ExecutionEngine.h
+++ b/include/llvm/ExecutionEngine/ExecutionEngine.h
@@ -108,11 +108,17 @@ public:
Function *FindFunctionNamed(const char *FnName);
/// create - This is the factory method for creating an execution engine which
- /// is appropriate for the current machine.
+ /// is appropriate for the current machine. This takes ownership of the
+ /// module provider.
static ExecutionEngine *create(ModuleProvider *MP,
bool ForceInterpreter = false,
std::string *ErrorStr = 0);
+ /// create - This is the factory method for creating an execution engine which
+ /// is appropriate for the current machine. This takes ownership of the
+ /// module.
+ static ExecutionEngine *create(Module *M);
+
/// runFunction - Execute the specified function with the specified arguments,
/// and return the result.
///
diff --git a/lib/ExecutionEngine/ExecutionEngine.cpp b/lib/ExecutionEngine/ExecutionEngine.cpp
index 512c4520e0..192caa894c 100644
--- a/lib/ExecutionEngine/ExecutionEngine.cpp
+++ b/lib/ExecutionEngine/ExecutionEngine.cpp
@@ -328,6 +328,10 @@ ExecutionEngine *ExecutionEngine::create(ModuleProvider *MP,
return EE;
}
+ExecutionEngine *ExecutionEngine::create(Module *M) {
+ return create(new ExistingModuleProvider(M));
+}
+
/// getPointerToGlobal - This returns the address of the specified global
/// value. This may involve code generation if it's a function.
///