Add preliminary support for "any" pointersize/endianness. This will need
authorChris Lattner <sabre@nondot.org>
Sun, 24 Aug 2003 14:02:47 +0000 (14:02 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 24 Aug 2003 14:02:47 +0000 (14:02 +0000)
to change soon though.

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

lib/ExecutionEngine/ExecutionEngine.cpp
lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
tools/lli/lli.cpp

index 9b51e3c798fb6c9ac744f97a7890a22ec82f476a..e376b855105799cef91fed90799e4b65096b20b8 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.has32BitPointers())
+    case Type::PointerTyID: if (CurMod.getPointerSize() != Module::Pointer64)
                               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.has32BitPointers())
+    case Type::PointerTyID: if (CurMod.getPointerSize() != Module::Pointer64)
                               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 (getModule().has32BitPointers())
+    case Type::PointerTyID: if (CurMod.getPointerSize() != Module::Pointer64)
                               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 (getModule().has32BitPointers())
+    case Type::PointerTyID: if (CurMod.getPointerSize() != Module::Pointer64)
                               goto Load4BytesBigEndian;
     case Type::DoubleTyID:
     case Type::ULongTyID:
index 73deed9ab261ee48213ebf226216802b95f040d1..d24557abe05ccabe73cbaf77e354415fcb6abde9 100644 (file)
@@ -308,7 +308,8 @@ GenericValue lle_X_sprintf(FunctionType *M, const vector<GenericValue> &Args) {
       case 'u': case 'o':
       case 'x': case 'X':
         if (HowLong >= 1) {
-          if (HowLong == 1 && TheInterpreter->getModule().has64BitPointers() &&
+          if (HowLong == 1 &&
+              TheInterpreter->getModule().getPointerSize()==Module::Pointer64 &&
               sizeof(long) < sizeof(long long)) {
             // Make sure we use %lld with a 64 bit argument because we might be
             // compiling LLI on a 32 bit compiler.
index 7a0925deece388a8603aac89ca2e66f6f7908bde..6c537ec037db130d664180b9ead8c06ca8a721d6 100644 (file)
@@ -75,8 +75,10 @@ int main(int argc, char** argv, const char ** envp) {
   }
 #endif
 
-  unsigned Config = (M->isLittleEndian()   ? TM::LittleEndian : TM::BigEndian) |
-                    (M->has32BitPointers() ? TM::PtrSize32    : TM::PtrSize64);
+  // FIXME: in adddition to being gross, this is also wrong: This should use the
+  // pointersize/endianness of the host if the pointer size is not specified!!
+  unsigned Config = (M->getEndianness() != Module::BigEndian ? TM::LittleEndian : TM::BigEndian) |
+                    (M->getPointerSize() != Module::Pointer64 ? TM::PtrSize32    : TM::PtrSize64);
   ExecutionEngine *EE = 0;
 
   // If there is nothing that is forcing us to use the interpreter, make a JIT.