diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-05-08 21:30:11 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-05-08 21:30:11 +0000 |
commit | 4752783057b179fe9b9823875d7347ae68823418 (patch) | |
tree | 6188d28ec785878a7fbc2a213c2f795585e5f6fc /clang/lib/CodeGen/CGCall.cpp | |
parent | 8881780832d09683135905a692f349bd84a5023b (diff) | |
download | bcm5719-llvm-4752783057b179fe9b9823875d7347ae68823418.tar.gz bcm5719-llvm-4752783057b179fe9b9823875d7347ae68823418.zip |
Darwin x86_32: When coercing a "single element" structure, make sure
to use a wide enough type. This might be wider than the "single
element"'s type in the presence of padding bit-fields.
- Darwin x86_32 now passes the first 1k ABI tests with bit-field
generation enabled.
llvm-svn: 71270
Diffstat (limited to 'clang/lib/CodeGen/CGCall.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGCall.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index 883eb5ede48..49c6f0e3a61 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -404,15 +404,19 @@ ABIArgInfo X86_32ABIInfo::classifyReturnType(QualType RetTy, // Classify "single element" structs as their element type. if (const Type *SeltTy = isSingleElementStruct(RetTy, Context)) { if (const BuiltinType *BT = SeltTy->getAsBuiltinType()) { - // FIXME: This is gross, it would be nice if we could just - // pass back SeltTy and have clients deal with it. Is it worth - // supporting coerce to both LLVM and clang Types? if (BT->isIntegerType()) { - uint64_t Size = Context.getTypeSize(SeltTy); + // We need to use the size of the structure, padding + // bit-fields can adjust that to be larger than the single + // element type. + uint64_t Size = Context.getTypeSize(RetTy); return ABIArgInfo::getCoerce(llvm::IntegerType::get((unsigned) Size)); } else if (BT->getKind() == BuiltinType::Float) { + assert(Context.getTypeSize(RetTy) == Context.getTypeSize(SeltTy) && + "Unexpect single element structure size!"); return ABIArgInfo::getCoerce(llvm::Type::FloatTy); } else if (BT->getKind() == BuiltinType::Double) { + assert(Context.getTypeSize(RetTy) == Context.getTypeSize(SeltTy) && + "Unexpect single element structure size!"); return ABIArgInfo::getCoerce(llvm::Type::DoubleTy); } } else if (SeltTy->isPointerType()) { |