summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-04-25 04:21:19 +0000
committerChris Lattner <sabre@nondot.org>2003-04-25 04:21:19 +0000
commitba90675054e973d2360c1c54863bf3b867422cae (patch)
treeb6863f4a755a961644830dd292843b2423f8cd73 /llvm/lib/ExecutionEngine
parent3c98276168d07629a88bf5de93c9902e486d02d4 (diff)
downloadbcm5719-llvm-ba90675054e973d2360c1c54863bf3b867422cae.tar.gz
bcm5719-llvm-ba90675054e973d2360c1c54863bf3b867422cae.zip
Fix problem where we would read 64 bits worth of pointer information, even on 32 bit targets!
llvm-svn: 5930
Diffstat (limited to 'llvm/lib/ExecutionEngine')
-rw-r--r--llvm/lib/ExecutionEngine/Interpreter/Execution.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp b/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
index 9d5166dab81..a14adafa0b6 100644
--- a/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
+++ b/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp
@@ -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 @@ void Interpreter::executeLoadInst(LoadInst &I, ExecutionContext &SF) {
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 @@ void Interpreter::executeLoadInst(LoadInst &I, ExecutionContext &SF) {
((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 @@ void Interpreter::executeLoadInst(LoadInst &I, ExecutionContext &SF) {
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 @@ void Interpreter::executeLoadInst(LoadInst &I, ExecutionContext &SF) {
((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) |
OpenPOWER on IntegriCloud