Changes in directory llvm/lib/ExecutionEngine/Interpreter:

Interpreter.cpp updated: 1.30 -> 1.31
Interpreter.h updated: 1.74 -> 1.75
---
Log message:

Simplify interpreter construction.


---
Diffs of the changes:  (+11 -21)

 Interpreter.cpp |   30 ++++++++++--------------------
 Interpreter.h   |    2 +-
 2 files changed, 11 insertions(+), 21 deletions(-)


Index: llvm/lib/ExecutionEngine/Interpreter/Interpreter.cpp
diff -u llvm/lib/ExecutionEngine/Interpreter/Interpreter.cpp:1.30 
llvm/lib/ExecutionEngine/Interpreter/Interpreter.cpp:1.31
--- llvm/lib/ExecutionEngine/Interpreter/Interpreter.cpp:1.30   Tue May  2 
20:29:56 2006
+++ llvm/lib/ExecutionEngine/Interpreter/Interpreter.cpp        Fri Jun 16 
13:08:38 2006
@@ -39,37 +39,27 @@
     return 0;  // error materializing the module.
   }
   
-  bool isLittleEndian = false;
-  switch (M->getEndianness()) {
-  case Module::LittleEndian: isLittleEndian = true; break;
-  case Module::BigEndian:    isLittleEndian = false; break;
-  case Module::AnyPointerSize:
+  if (M->getEndianness() == Module::AnyEndianness) {
     int Test = 0;
     *(char*)&Test = 1;    // Return true if the host is little endian
-    isLittleEndian = (Test == 1);
-    break;
+    bool isLittleEndian = (Test == 1);
+    M->setEndianness(isLittleEndian ? Module::LittleEndian : 
Module::BigEndian);
   }
 
-  bool isLongPointer = false;
-  switch (M->getPointerSize()) {
-  case Module::Pointer32: isLongPointer = false; break;
-  case Module::Pointer64: isLongPointer = true; break;
-  case Module::AnyPointerSize:
-    isLongPointer = (sizeof(void*) == 8);  // Follow host
-    break;
+  if (M->getPointerSize() == Module::AnyPointerSize) {
+    // Follow host.
+    bool Ptr64 = sizeof(void*) == 8;
+    M->setPointerSize(Ptr64 ? Module::Pointer64 : Module::Pointer32);
   }
 
-  return new Interpreter(M, isLittleEndian, isLongPointer);
+  return new Interpreter(M);
 }
 
 
//===----------------------------------------------------------------------===//
 // Interpreter ctor - Initialize stuff
 //
-Interpreter::Interpreter(Module *M, bool isLittleEndian, bool isLongPointer)
-  : ExecutionEngine(M),
-    TD("lli", isLittleEndian, isLongPointer ? 8 : 4, isLongPointer ? 8 : 4,
-       isLongPointer ? 8 : 4) {
-
+Interpreter::Interpreter(Module *M) : ExecutionEngine(M), TD("lli", M) {
+      
   memset(&ExitValue, 0, sizeof(ExitValue));
   setTargetData(&TD);
   // Initialize the "backend"


Index: llvm/lib/ExecutionEngine/Interpreter/Interpreter.h
diff -u llvm/lib/ExecutionEngine/Interpreter/Interpreter.h:1.74 
llvm/lib/ExecutionEngine/Interpreter/Interpreter.h:1.75
--- llvm/lib/ExecutionEngine/Interpreter/Interpreter.h:1.74     Wed Mar 22 
23:22:51 2006
+++ llvm/lib/ExecutionEngine/Interpreter/Interpreter.h  Fri Jun 16 13:08:38 2006
@@ -94,7 +94,7 @@
   std::vector<Function*> AtExitHandlers;
 
 public:
-  Interpreter(Module *M, bool isLittleEndian, bool isLongPointer);
+  Interpreter(Module *M);
   ~Interpreter();
 
   /// runAtExitHandlers - Run any functions registered by the program's calls 
to



_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to