[cfe-commits] r66713 - in /cfe/trunk: lib/CodeGen/CGCall.cpp test/CodeGen/x86_32-arguments.c
Daniel Dunbar
daniel at zuster.org
Wed Mar 11 15:05:27 PDT 2009
Author: ddunbar
Date: Wed Mar 11 17:05:26 2009
New Revision: 66713
URL: http://llvm.org/viewvc/llvm-project?rev=66713&view=rev
Log:
x86_32 ABI: Don't try and expand structures with bitfields.
- This is an ABI incompatiblity, but this is not likely to be a huge
deal in practice. For now we at least generate self consistent code
instead of crashing.
- <rdar://problem/6657601> x86-32 ABI: Bitfields in small structures
are not passed correctly
Added:
cfe/trunk/test/CodeGen/x86_32-arguments.c
Modified:
cfe/trunk/lib/CodeGen/CGCall.cpp
Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=66713&r1=66712&r2=66713&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Wed Mar 11 17:05:26 2009
@@ -215,14 +215,14 @@
if (!is32Or64BitBasicType(FD->getType(), Context))
return false;
- // If this is a bit-field we need to make sure it is still a
- // 32-bit or 64-bit type.
- if (Expr *BW = FD->getBitWidth()) {
- unsigned Width = BW->getIntegerConstantExprValue(Context).getZExtValue();
- if (Width <= 16)
- return false;
- }
+ // FIXME: Reject bitfields wholesale; there are two problems, we
+ // don't know how to expand them yet, and the predicate for
+ // telling if a bitfield still counts as "basic" is more
+ // complicated than what we were doing previously.
+ if (FD->isBitField())
+ return false;
}
+
return true;
}
Added: cfe/trunk/test/CodeGen/x86_32-arguments.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/x86_32-arguments.c?rev=66713&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/x86_32-arguments.c (added)
+++ cfe/trunk/test/CodeGen/x86_32-arguments.c Wed Mar 11 17:05:26 2009
@@ -0,0 +1,67 @@
+// RUN: clang -triple i386-unknown-unknown -emit-llvm -o %t %s &&
+// RUN: grep 'define signext i8 @f0()' %t &&
+// RUN: grep 'define signext i16 @f1()' %t &&
+// RUN: grep 'define i32 @f2()' %t &&
+// RUN: grep 'define float @f3()' %t &&
+// RUN: grep 'define double @f4()' %t &&
+// RUN: grep 'define x86_fp80 @f5()' %t &&
+// RUN: grep 'define void @f6(i8 signext %a0, i16 signext %a1, i32 %a2, i64 %a3, i8\* %a4)' %t &&
+// RUN: grep 'define void @f7(i32 %a0)' %t &&
+// RUN: grep 'define i64 @f8_1()' %t &&
+// RUN: grep 'define void @f8_2(i32 %a0.0, i32 %a0.1)' %t &&
+// RUN: grep 'define i64 @f9_1()' %t &&
+
+// FIXME: This is wrong, but we want the coverage of the other
+// tests. This should be the same as @f8_2.
+// RUN: grep 'define void @f9_2(%.truct.s9\* byval %a0)' %t &&
+
+// RUN: true
+
+char f0(void) {
+}
+
+short f1(void) {
+}
+
+int f2(void) {
+}
+
+float f3(void) {
+}
+
+double f4(void) {
+}
+
+long double f5(void) {
+}
+
+void f6(char a0, short a1, int a2, long long a3, void *a4) {
+}
+
+typedef enum { A, B, C } E;
+
+void f7(E a0) {
+}
+
+struct s8 {
+ int a;
+ int b;
+};
+struct s8 f8_1(void) {
+}
+void f8_2(struct s8 a0) {
+}
+
+// This should be passed just as s8.
+
+// FIXME: This is currently broken, but the test case is accepting it
+// so we get coverage of the other cases.
+struct s9 {
+ int a : 17;
+ int b;
+};
+struct s9 f9_1(void) {
+}
+void f9_2(struct s9 a0) {
+}
+
More information about the cfe-commits
mailing list