diff options
author | Misha Brukman <brukman+llvm@gmail.com> | 2003-10-16 21:18:05 +0000 |
---|---|---|
committer | Misha Brukman <brukman+llvm@gmail.com> | 2003-10-16 21:18:05 +0000 |
commit | 260b0c88a006d3952975fb5000de38f32e5744c7 (patch) | |
tree | bf658ed1635f2d66860c0c96587529d72e48f368 /llvm/lib/ExecutionEngine/ExecutionEngine.cpp | |
parent | c0acd1173d02385755c9dd8be57e004aafa9743a (diff) | |
download | bcm5719-llvm-260b0c88a006d3952975fb5000de38f32e5744c7.tar.gz bcm5719-llvm-260b0c88a006d3952975fb5000de38f32e5744c7.zip |
* Reorder includes as per the style guide
* Move the constructors from .h file here
* Document ExecutionEngine::create()
* Catch exception possibly thrown by ModuleProvider::releaseModule()
llvm-svn: 9181
Diffstat (limited to 'llvm/lib/ExecutionEngine/ExecutionEngine.cpp')
-rw-r--r-- | llvm/lib/ExecutionEngine/ExecutionEngine.cpp | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp index 35a735d647c..ceeb857020f 100644 --- a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp +++ b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp @@ -6,12 +6,13 @@ //===----------------------------------------------------------------------===// #define DEBUG_TYPE "jit" -#include "llvm/ExecutionEngine/ExecutionEngine.h" -#include "JIT/VM.h" #include "Interpreter/Interpreter.h" -#include "llvm/DerivedTypes.h" +#include "JIT/VM.h" #include "llvm/Constants.h" +#include "llvm/DerivedTypes.h" #include "llvm/Module.h" +#include "llvm/ModuleProvider.h" +#include "llvm/ExecutionEngine/ExecutionEngine.h" #include "llvm/ExecutionEngine/GenericValue.h" #include "llvm/Target/TargetData.h" #include "Support/Debug.h" @@ -21,11 +22,22 @@ Statistic<> NumInitBytes("lli", "Number of bytes of global vars initialized"); +ExecutionEngine::ExecutionEngine(ModuleProvider *P) : + CurMod(*P->getModule()), MP(P) { + assert(P && "ModuleProvider is null?"); +} + +ExecutionEngine::ExecutionEngine(Module *M) : CurMod(*M), MP(0) { + assert(M && "Module is null?"); +} + ExecutionEngine::~ExecutionEngine() { delete MP; } -/// FIXME: document +/// If possible, create a JIT, unless the caller specifically requests an +/// Interpreter or there's an error. If even an Interpreter cannot be created, +/// NULL is returned. /// ExecutionEngine *ExecutionEngine::create(ModuleProvider *MP, bool ForceInterpreter, @@ -37,8 +49,12 @@ ExecutionEngine *ExecutionEngine::create(ModuleProvider *MP, EE = VM::create(MP); // If we can't make a JIT, make an interpreter instead. - if (EE == 0) - EE = Interpreter::create(MP->releaseModule(), TraceMode); + try { + if (EE == 0) + EE = Interpreter::create(MP->releaseModule(), TraceMode); + } catch (...) { + EE = 0; + } return EE; } |