[llvm-commits] [llvm-gcc-4.0] r42095 - /llvm-gcc-4.0/trunk/gcc/llvm-types.cpp

Dale Johannesen dalej at apple.com
Tue Sep 18 10:33:57 PDT 2007


Author: johannes
Date: Tue Sep 18 12:33:56 2007
New Revision: 42095

URL: http://llvm.org/viewvc/llvm-project?rev=42095&view=rev
Log:
Enhance assertion to allow x86 long double.


Modified:
    llvm-gcc-4.0/trunk/gcc/llvm-types.cpp

Modified: llvm-gcc-4.0/trunk/gcc/llvm-types.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-types.cpp?rev=42095&r1=42094&r2=42095&view=diff

==============================================================================
--- llvm-gcc-4.0/trunk/gcc/llvm-types.cpp (original)
+++ llvm-gcc-4.0/trunk/gcc/llvm-types.cpp Tue Sep 18 12:33:56 2007
@@ -73,8 +73,13 @@
 // Note down LLVM type for GCC tree node.
 static const Type * llvm_set_type(tree Tr, const Type *Ty) {
 
-  assert(!TYPE_SIZE(Tr) || !Ty->isSized() || !isInt64(TYPE_SIZE(Tr), true) ||
-         getInt64(TYPE_SIZE(Tr), true) == getTargetData().getTypeSizeInBits(Ty)
+  // For x86 long double, llvm records the size of the data (80) while
+  // gcc's TYPE_SIZE including alignment padding.  Compensate.
+  assert((!TYPE_SIZE(Tr) || !Ty->isSized() || !isInt64(TYPE_SIZE(Tr), true) ||
+         getInt64(TYPE_SIZE(Tr), true) == getTargetData().getTypeSizeInBits(Ty) ||
+         (getTargetData().getTypeSizeInBits(Ty) == 80 &&
+          (getInt64(TYPE_SIZE(Tr), true) == 96 ||
+           getInt64(TYPE_SIZE(Tr), true) == 128)))
          && "LLVM type size doesn't match GCC type size!");
 
   unsigned &TypeSlot = LTypesMap[Ty];





More information about the llvm-commits mailing list