Consult the target data, not the module, about how large the current pointer
authorChris Lattner <sabre@nondot.org>
Sun, 24 Aug 2003 19:55:26 +0000 (19:55 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 24 Aug 2003 19:55:26 +0000 (19:55 +0000)
size is.  This ensures that if the module has no specified pointer size that
things will work correctly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8136 91177308-0d34-0410-b5e6-96231b3b80d8

lib/ExecutionEngine/ExecutionEngine.cpp

index e376b855105799cef91fed90799e4b65096b20b8..89d9e1628925c5b78ae4dabacd5f6427d0cf9087 100644 (file)
@@ -132,7 +132,7 @@ void ExecutionEngine::StoreValueToMemory(GenericValue Val, GenericValue *Ptr,
                             Ptr->Untyped[2] = (Val.UIntVal >> 16) & 255;
                             Ptr->Untyped[3] = (Val.UIntVal >> 24) & 255;
                             break;
-    case Type::PointerTyID: if (CurMod.getPointerSize() != Module::Pointer64)
+    case Type::PointerTyID: if (getTargetData().getPointerSize() == 4)
                               goto Store4BytesLittleEndian;
     case Type::DoubleTyID:
     case Type::ULongTyID:
@@ -165,7 +165,7 @@ void ExecutionEngine::StoreValueToMemory(GenericValue Val, GenericValue *Ptr,
                             Ptr->Untyped[1] = (Val.UIntVal >> 16) & 255;
                             Ptr->Untyped[0] = (Val.UIntVal >> 24) & 255;
                             break;
-    case Type::PointerTyID: if (CurMod.getPointerSize() != Module::Pointer64)
+    case Type::PointerTyID: if (getTargetData().getPointerSize() == 4)
                               goto Store4BytesBigEndian;
     case Type::DoubleTyID:
     case Type::ULongTyID:
@@ -204,7 +204,7 @@ GenericValue ExecutionEngine::LoadValueFromMemory(GenericValue *Ptr,
                                             ((unsigned)Ptr->Untyped[2] << 16) |
                                             ((unsigned)Ptr->Untyped[3] << 24);
                             break;
-    case Type::PointerTyID: if (CurMod.getPointerSize() != Module::Pointer64)
+    case Type::PointerTyID: if (getTargetData().getPointerSize() == 4)
                               goto Load4BytesLittleEndian;
     case Type::DoubleTyID:
     case Type::ULongTyID:
@@ -238,7 +238,7 @@ GenericValue ExecutionEngine::LoadValueFromMemory(GenericValue *Ptr,
                                             ((unsigned)Ptr->Untyped[1] << 16) |
                                             ((unsigned)Ptr->Untyped[0] << 24);
                             break;
-    case Type::PointerTyID: if (CurMod.getPointerSize() != Module::Pointer64)
+    case Type::PointerTyID: if (getTargetData().getPointerSize() == 4)
                               goto Load4BytesBigEndian;
     case Type::DoubleTyID:
     case Type::ULongTyID: