[llvm-commits] CVS: llvm/tools/lli/Interpreter/Execution.cpp

Chris Lattner lattner at cs.uiuc.edu
Thu Apr 24 23:22:00 PDT 2003


Changes in directory llvm/tools/lli/Interpreter:

Execution.cpp updated: 1.83 -> 1.84

---
Log message:

Fix problem where we would read 64 bits worth of pointer information, even on 32 bit targets!


---
Diffs of the changes:

Index: llvm/tools/lli/Interpreter/Execution.cpp
diff -u llvm/tools/lli/Interpreter/Execution.cpp:1.83 llvm/tools/lli/Interpreter/Execution.cpp:1.84
--- llvm/tools/lli/Interpreter/Execution.cpp:1.83	Wed Apr 23 14:55:35 2003
+++ llvm/tools/lli/Interpreter/Execution.cpp	Thu Apr 24 23:21:19 2003
@@ -6,12 +6,8 @@
 
 #include "Interpreter.h"
 #include "ExecutionAnnotations.h"
-#include "llvm/GlobalVariable.h"
-#include "llvm/Function.h"
-#include "llvm/iPHINode.h"
-#include "llvm/iOther.h"
-#include "llvm/iTerminators.h"
-#include "llvm/iMemory.h"
+#include "llvm/Module.h"
+#include "llvm/Instructions.h"
 #include "llvm/DerivedTypes.h"
 #include "llvm/Constants.h"
 #include "llvm/Assembly/Writer.h"
@@ -776,6 +772,7 @@
     case Type::ShortTyID:   Result.UShortVal = (unsigned)Ptr->Untyped[0] |
                                               ((unsigned)Ptr->Untyped[1] << 8);
                             break;
+    Load4BytesLittleEndian:                            
     case Type::FloatTyID:
     case Type::UIntTyID:
     case Type::IntTyID:     Result.UIntVal = (unsigned)Ptr->Untyped[0] |
@@ -783,10 +780,11 @@
                                             ((unsigned)Ptr->Untyped[2] << 16) |
                                             ((unsigned)Ptr->Untyped[3] << 24);
                             break;
+    case Type::PointerTyID: if (getModule().has32BitPointers())
+                              goto Load4BytesLittleEndian;
     case Type::DoubleTyID:
     case Type::ULongTyID:
-    case Type::LongTyID:    
-    case Type::PointerTyID: Result.ULongVal = (uint64_t)Ptr->Untyped[0] |
+    case Type::LongTyID:    Result.ULongVal = (uint64_t)Ptr->Untyped[0] |
                                              ((uint64_t)Ptr->Untyped[1] <<  8) |
                                              ((uint64_t)Ptr->Untyped[2] << 16) |
                                              ((uint64_t)Ptr->Untyped[3] << 24) |
@@ -808,6 +806,7 @@
     case Type::ShortTyID:   Result.UShortVal = (unsigned)Ptr->Untyped[1] |
                                               ((unsigned)Ptr->Untyped[0] << 8);
                             break;
+    Load4BytesBigEndian:
     case Type::FloatTyID:
     case Type::UIntTyID:
     case Type::IntTyID:     Result.UIntVal = (unsigned)Ptr->Untyped[3] |
@@ -815,10 +814,11 @@
                                             ((unsigned)Ptr->Untyped[1] << 16) |
                                             ((unsigned)Ptr->Untyped[0] << 24);
                             break;
+    case Type::PointerTyID: if (getModule().has32BitPointers())
+                              goto Load4BytesBigEndian;
     case Type::DoubleTyID:
     case Type::ULongTyID:
-    case Type::LongTyID:    
-    case Type::PointerTyID: Result.ULongVal = (uint64_t)Ptr->Untyped[7] |
+    case Type::LongTyID:    Result.ULongVal = (uint64_t)Ptr->Untyped[7] |
                                              ((uint64_t)Ptr->Untyped[6] <<  8) |
                                              ((uint64_t)Ptr->Untyped[5] << 16) |
                                              ((uint64_t)Ptr->Untyped[4] << 24) |





More information about the llvm-commits mailing list