]> granicus.if.org Git - clang/commitdiff
x86_64 ABI: Ignore padding bit-fields during classification.
authorDaniel Dunbar <daniel@zuster.org>
Fri, 8 May 2009 22:26:44 +0000 (22:26 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Fri, 8 May 2009 22:26:44 +0000 (22:26 +0000)
 - {return-types,single-args}-{32,64} pass the first 1k ABI tests with
   bit-fields enabled.

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

lib/CodeGen/CGCall.cpp
test/CodeGen/x86_64-arguments.c

index 49c6f0e3a611f3c9f4dec8aaf1aae632dfb64296..265bb7893bb387191c1d4e69c263f4d2f6ace48d 100644 (file)
@@ -205,8 +205,7 @@ static const Type *isSingleElementStruct(QualType T, ASTContext &Context) {
         FT = AT->getElementType();
 
     // Ignore empty records and padding bit-fields.
-    if (isEmptyRecord(Context, FT) || 
-        (FD->isBitField() && !FD->getIdentifier()))
+    if (isEmptyRecord(Context, FT) || FD->isUnnamedBitfield())
       continue;
 
     if (Found)
@@ -803,6 +802,10 @@ void X86_64ABIInfo::classify(QualType Ty,
       // structure to be passed in memory even if unaligned, and
       // therefore they can straddle an eightbyte.
       if (BitField) {
+        // Ignore padding bit-fields.
+        if (i->isUnnamedBitfield())
+          continue;
+
         uint64_t Offset = OffsetBase + Layout.getFieldOffset(idx);
         uint64_t Size = i->getBitWidth()->EvaluateAsInt(Context).getZExtValue();
 
index 860caff7de88207b94eb2956d010ff165e67c5d4..fa73f7de674258d34f698c26c847b0850ea71883 100644 (file)
@@ -9,7 +9,7 @@
 // RUN: grep 'define void @f7(i32 %a0)' %t &&
 // RUN: grep 'type { i64, double }.*type .0' %t &&
 // RUN: grep 'define .0 @f8_1()' %t &&
-// RUN: grep 'define void @f8_2(.0)' %t
+// RUN: grep 'define void @f8_2(.0)' %t &&
 
 char f0(void) {
 }
@@ -44,3 +44,12 @@ union u8 {
 };
 union u8 f8_1() {}
 void f8_2(union u8 a0) {}
+
+// RUN: grep 'define i64 @f9()' %t &&
+struct s9 { int a; int b; int : 0; } f9(void) {}
+
+// RUN: grep 'define void @f10(i64)' %t &&
+struct s10 { int a; int b; int : 0; };
+void f10(struct s10 a0) {}
+
+// RUN: true