x86-64 ABI conformance; for objects of 4 or 12 bytes
pass the 4-byte piece as 4 bytes not 8 bytes.
Fixes all but 1 struct-layout-1 failure (does not,
however, fix 477.dealII).
llvm-svn: 51959
diff --git a/llvm-gcc-4.2/gcc/config/i386/llvm-i386.cpp b/llvm-gcc-4.2/gcc/config/i386/llvm-i386.cpp
index a2c8a47..db46d0c 100644
--- a/llvm-gcc-4.2/gcc/config/i386/llvm-i386.cpp
+++ b/llvm-gcc-4.2/gcc/config/i386/llvm-i386.cpp
@@ -1315,20 +1315,28 @@
enum machine_mode Mode = ix86_getNaturalModeForType(type);
int NumClasses = ix86_ClassifyArgument(Mode, type, Class, 0);
*DontCheckAlignment= true;
- if (NumClasses == 1 && (Class[0] == X86_64_INTEGERSI_CLASS ||
- Class[0] == X86_64_INTEGER_CLASS)) {
+ if (NumClasses == 1 && Class[0] == X86_64_INTEGER_CLASS) {
/* 8 byte object, one int register */
*size = 8;
return true;
}
+ if (NumClasses == 1 && Class[0] == X86_64_INTEGERSI_CLASS) {
+ /* 4 byte object, one int register */
+ *size = 4;
+ return true;
+ }
if (NumClasses == 2 && (Class[0] == X86_64_INTEGERSI_CLASS ||
Class[0] == X86_64_INTEGER_CLASS)) {
- if (Class[1] == X86_64_INTEGERSI_CLASS ||
- Class[1] == X86_64_INTEGER_CLASS) {
+ if (Class[1] == X86_64_INTEGER_CLASS) {
/* 16 byte object, 2 int registers */
*size = 16;
return true;
}
+ if (Class[1] == X86_64_INTEGERSI_CLASS) {
+ /* 12 byte object, 2 int registers */
+ *size = 12;
+ return true;
+ }
if (Class[1] == X86_64_NO_CLASS) {
/* 16 byte object, only 1st register has information */
*size = 8;
diff --git a/llvm-gcc-4.2/gcc/llvm-abi.h b/llvm-gcc-4.2/gcc/llvm-abi.h
index 93ca7de..a57e2c6 100644
--- a/llvm-gcc-4.2/gcc/llvm-abi.h
+++ b/llvm-gcc-4.2/gcc/llvm-abi.h
@@ -570,7 +570,7 @@
Elts.push_back(Type::Int8Ty);
Size -= 1;
}
- assert((origSize || Size == 0) && "Didn't cover value?");
+ assert(Size == 0 && "Didn't cover value?");
const StructType *STy = StructType::get(Elts, false);
unsigned i = 0;