simplify creation of the interpreter, make ExecutionEngine ctor protected,

delete one ExecutionEngine ctor, minor cleanup.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44646 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2007-12-06 01:08:09 +00:00
parent 7f3a75a529
commit 9f2f142d25
7 changed files with 38 additions and 43 deletions

View File

@@ -12,8 +12,8 @@
//
//===----------------------------------------------------------------------===//
#ifndef EXECUTION_ENGINE_H
#define EXECUTION_ENGINE_H
#ifndef LLVM_EXECUTION_ENGINE_H
#define LLVM_EXECUTION_ENGINE_H
#include <vector>
#include <map>
@@ -34,6 +34,7 @@ class ModuleProvider;
class TargetData;
class Type;
class MutexGuard;
class JITMemoryManager;
class ExecutionEngineState {
private:
@@ -90,18 +91,36 @@ public:
/// any of those classes.
sys::Mutex lock; // Used to make this class and subclasses thread-safe
ExecutionEngine(ModuleProvider *P);
ExecutionEngine(Module *M);
//===----------------------------------------------------------------------===//
// ExecutionEngine Startup
//===----------------------------------------------------------------------===//
virtual ~ExecutionEngine();
const TargetData *getTargetData() const { return TD; }
/// create - This is the factory method for creating an execution engine which
/// 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);
/// addModuleProvider - Add a ModuleProvider to the list of modules that we
/// can JIT from. Note that this takes ownership of the ModuleProvider: when
/// the ExecutionEngine is destroyed, it destroys the MP as well.
void addModuleProvider(ModuleProvider *P) {
Modules.push_back(P);
}
//===----------------------------------------------------------------------===//
const TargetData *getTargetData() const { return TD; }
/// removeModuleProvider - Remove a ModuleProvider from the list of modules.
/// Release module from ModuleProvider.
@@ -112,18 +131,6 @@ public:
/// general code.
Function *FindFunctionNamed(const char *FnName);
/// create - This is the factory method for creating an execution engine which
/// 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.
///
@@ -233,6 +240,8 @@ public:
}
protected:
ExecutionEngine(ModuleProvider *P);
void emitGlobals();
// EmitGlobalVariable - This method emits the specified global variable to the