[llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
Misha Brukman
brukman at cs.uiuc.edu
Thu Oct 16 16:19:01 PDT 2003
Changes in directory llvm/lib/ExecutionEngine:
ExecutionEngine.cpp updated: 1.32 -> 1.33
---
Log message:
* Reorder includes as per the style guide
* Move the constructors from .h file here
* Document ExecutionEngine::create()
* Catch exception possibly thrown by ModuleProvider::releaseModule()
---
Diffs of the changes: (+22 -6)
Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.32 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.33
--- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.32 Tue Oct 14 16:36:31 2003
+++ llvm/lib/ExecutionEngine/ExecutionEngine.cpp Thu Oct 16 16:18:05 2003
@@ -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 @@
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;
}
More information about the llvm-commits
mailing list