Add a convenience method for creating EE's.
authorChris Lattner <sabre@nondot.org>
Sun, 21 Oct 2007 22:57:11 +0000 (22:57 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 21 Oct 2007 22:57:11 +0000 (22:57 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43206 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ExecutionEngine/ExecutionEngine.h
lib/ExecutionEngine/ExecutionEngine.cpp

index 2a2fb7cb8c4bd92d4693205c9d4dfb0211e41f49..da034a7cc2f945698c436a1af7f8e3aebd805f29 100644 (file)
@@ -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.
   ///
index 512c4520e07ee61108f65ec8d66853197363dfbf..192caa894caa210b605845ce25ab1c6de7f110ad 100644 (file)
@@ -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.
 ///