mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
Fix problem where we would read 64 bits worth of pointer information, even on 32 bit targets!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5930 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
bceb2b0061
commit
d5bc41a249
@ -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) |
|
||||
|
Loading…
Reference in New Issue
Block a user