[llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp

Chris Lattner lattner at cs.uiuc.edu
Tue Mar 21 22:08:03 PST 2006



Changes in directory llvm/lib/ExecutionEngine:

ExecutionEngine.cpp updated: 1.75 -> 1.76
---
Log message:

Eliminate the dependency of ExecutionEngine on the JIT/Interpreter libraries.

Now you can build a tool with just the JIT or just the interpreter.


---
Diffs of the changes:  (+8 -18)

 ExecutionEngine.cpp |   26 ++++++++------------------
 1 files changed, 8 insertions(+), 18 deletions(-)


Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.75 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.76
--- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.75	Wed Mar  8 12:42:46 2006
+++ llvm/lib/ExecutionEngine/ExecutionEngine.cpp	Wed Mar 22 00:07:50 2006
@@ -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 @@
   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 *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;






More information about the llvm-commits mailing list