[llvm-commits] CVS: llvm/tools/lli/ExecutionEngine.cpp ExecutionEngine.h lli.cpp

Brian Gaeke gaeke at cs.uiuc.edu
Wed Sep 3 15:35:02 PDT 2003


Changes in directory llvm/tools/lli:

ExecutionEngine.cpp updated: 1.23 -> 1.24
ExecutionEngine.h updated: 1.8 -> 1.9
lli.cpp updated: 1.22 -> 1.23

---
Log message:

ExecutionEngine.cpp: Move execution engine creation stuff into a new
  static method here.
 Remove some extra blank lines.
ExecutionEngine.h: Add its prototype.
lli.cpp: Call it.

Make creation method for each type of EE into a static method of its
own subclass.

Interpreter/Interpreter.cpp: ExecutionEngine::createInterpreter -->
 Interpreter::create
Interpreter/Interpreter.h: Likewise.
JIT/JIT.cpp: ExecutionEngine::createJIT --> VM::create
JIT/VM.h: Likewise.


---
Diffs of the changes:

Index: llvm/tools/lli/ExecutionEngine.cpp
diff -u llvm/tools/lli/ExecutionEngine.cpp:1.23 llvm/tools/lli/ExecutionEngine.cpp:1.24
--- llvm/tools/lli/ExecutionEngine.cpp:1.23	Sun Aug 24 14:55:26 2003
+++ llvm/tools/lli/ExecutionEngine.cpp	Wed Sep  3 15:34:17 2003
@@ -15,9 +15,25 @@
 #include "Support/Debug.h"
 #include "Support/Statistic.h"
 #include "Config/dlfcn.h"
+#include "JIT/VM.h"
+#include "Interpreter/Interpreter.h"
 
 Statistic<> NumInitBytes("lli", "Number of bytes of global vars initialized");
 
+ExecutionEngine *ExecutionEngine::create (Module *M, bool ForceInterpreter,
+					  bool DebugMode, bool TraceMode) {
+  ExecutionEngine *EE = 0;
+
+  // If there is nothing that is forcing us to use the interpreter, make a JIT.
+  if (!ForceInterpreter && !DebugMode && !TraceMode)
+    EE = VM::create(M);
+
+  // If we can't make a JIT, make an interpreter instead.
+  if (EE == 0)
+    EE = Interpreter::create(M, DebugMode, TraceMode);
+  return EE;
+}
+
 // getPointerToGlobal - This returns the address of the specified global
 // value.  This may involve code generation if it's a function.
 //
@@ -29,7 +45,6 @@
   return GlobalAddress[GV];
 }
 
-
 GenericValue ExecutionEngine::getConstantValue(const Constant *C) {
   GenericValue Result;
 
@@ -258,7 +273,6 @@
   }
   return Result;
 }
-
 
 // InitializeMemory - Recursive function to apply a Constant value into the
 // specified memory location...


Index: llvm/tools/lli/ExecutionEngine.h
diff -u llvm/tools/lli/ExecutionEngine.h:1.8 llvm/tools/lli/ExecutionEngine.h:1.9
--- llvm/tools/lli/ExecutionEngine.h:1.8	Sun Aug 24 14:50:50 2003
+++ llvm/tools/lli/ExecutionEngine.h	Wed Sep  3 15:34:17 2003
@@ -48,6 +48,9 @@
                   const std::vector<std::string> &Args,
                   const char ** envp) = 0;
 
+  static ExecutionEngine *create (Module *M, bool ForceInterpreter,
+				  bool DebugMode, bool TraceMode);
+
   /// createJIT - Create an return a new JIT compiler if there is one available
   /// for the current target.  Otherwise it returns null.
   ///


Index: llvm/tools/lli/lli.cpp
diff -u llvm/tools/lli/lli.cpp:1.22 llvm/tools/lli/lli.cpp:1.23
--- llvm/tools/lli/lli.cpp:1.22	Sun Aug 24 14:52:02 2003
+++ llvm/tools/lli/lli.cpp	Wed Sep  3 15:34:17 2003
@@ -59,15 +59,9 @@
     exit(1);
   }
 
-  ExecutionEngine *EE = 0;
-
-  // If there is nothing that is forcing us to use the interpreter, make a JIT.
-  if (!ForceInterpreter && !DebugMode && !TraceMode)
-    EE = ExecutionEngine::createJIT(M);
-
-  // If we can't make a JIT, make an interpreter instead.
-  if (EE == 0)
-    EE = ExecutionEngine::createInterpreter(M, DebugMode, TraceMode);
+  ExecutionEngine *EE =
+    ExecutionEngine::create (M, ForceInterpreter, DebugMode, TraceMode);
+  assert (EE && "Couldn't create an ExecutionEngine, not even an interpreter?");
 
   // Add the module name to the start of the argv vector...
   // But delete .bc first, since programs (and users) might not expect to





More information about the llvm-commits mailing list