diff options
author | Chris Lattner <sabre@nondot.org> | 2006-03-22 06:07:50 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-03-22 06:07:50 +0000 |
commit | 2fe4bb06c6c40d16b7a5ae9cdf6bb6fe94d51be0 (patch) | |
tree | 9aa1af4b15d5ac30cf9d801c52a0ddf1e018369f /lib/ExecutionEngine/ExecutionEngine.cpp | |
parent | 765c93cefda367d8e5a8e0afcd610a7e15bbd987 (diff) | |
download | external_llvm-2fe4bb06c6c40d16b7a5ae9cdf6bb6fe94d51be0.zip external_llvm-2fe4bb06c6c40d16b7a5ae9cdf6bb6fe94d51be0.tar.gz external_llvm-2fe4bb06c6c40d16b7a5ae9cdf6bb6fe94d51be0.tar.bz2 |
Eliminate the dependency of ExecutionEngine on the JIT/Interpreter libraries.
Now you can build a tool with just the JIT or just the interpreter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26946 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine/ExecutionEngine.cpp')
-rw-r--r-- | lib/ExecutionEngine/ExecutionEngine.cpp | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/lib/ExecutionEngine/ExecutionEngine.cpp b/lib/ExecutionEngine/ExecutionEngine.cpp index 86af7bf..b920898 100644 --- a/lib/ExecutionEngine/ExecutionEngine.cpp +++ b/lib/ExecutionEngine/ExecutionEngine.cpp @@ -13,8 +13,6 @@ //===----------------------------------------------------------------------===// #define DEBUG_TYPE "jit" -#include "Interpreter/Interpreter.h" -#include "JIT/JIT.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" #include "llvm/Module.h" @@ -26,6 +24,7 @@ #include "llvm/Support/Debug.h" #include "llvm/System/DynamicLibrary.h" #include "llvm/Target/TargetData.h" +#include <iostream> using namespace llvm; namespace { @@ -33,6 +32,9 @@ namespace { Statistic<> NumGlobals ("lli", "Number of global vars initialized"); } +ExecutionEngine::EECtorFn ExecutionEngine::JITCtor = 0; +ExecutionEngine::EECtorFn ExecutionEngine::InterpCtor = 0; + ExecutionEngine::ExecutionEngine(ModuleProvider *P) : CurMod(*P->getModule()), MP(P) { assert(P && "ModuleProvider is null?"); @@ -163,24 +165,12 @@ ExecutionEngine *ExecutionEngine::create(ModuleProvider *MP, ExecutionEngine *EE = 0; // Unless the interpreter was explicitly selected, try making a JIT. - if (!ForceInterpreter) - EE = JIT::create(MP, IL); + if (!ForceInterpreter && JITCtor) + EE = JITCtor(MP, IL); // If we can't make a JIT, make an interpreter instead. - if (EE == 0) { - try { - Module *M = MP->materializeModule(); - try { - EE = Interpreter::create(M, IL); - } catch (...) { - std::cerr << "Error creating the interpreter!\n"; - } - } catch (std::string& errmsg) { - std::cerr << "Error reading the bytecode file: " << errmsg << "\n"; - } catch (...) { - std::cerr << "Error reading the bytecode file!\n"; - } - } + if (EE == 0 && InterpCtor) + EE = InterpCtor(MP, IL); if (EE == 0) delete IL; |