summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/TargetInfo.cpp
diff options
context:
space:
mode:
authorAkira Hatanaka <ahatanaka@mips.com>2012-02-09 19:54:16 +0000
committerAkira Hatanaka <ahatanaka@mips.com>2012-02-09 19:54:16 +0000
commit4984f5dbbe8fdc9435d32e373b94a7081aeb5434 (patch)
treea5e90addabd026afc02b21c97ebe103cf21eb2f4 /clang/lib/CodeGen/TargetInfo.cpp
parent3edb3b4ac5a40c31a03f3c6a88f8d86573e5c9a8 (diff)
downloadbcm5719-llvm-4984f5dbbe8fdc9435d32e373b94a7081aeb5434.tar.gz
bcm5719-llvm-4984f5dbbe8fdc9435d32e373b94a7081aeb5434.zip
Class objects passed by value follow the same rules as structure objects.
Double fields of by-value class objects should be passed in floating point registers. llvm-svn: 150200
Diffstat (limited to 'clang/lib/CodeGen/TargetInfo.cpp')
-rw-r--r--clang/lib/CodeGen/TargetInfo.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp
index b48bff8a1e7..cae8f5fb1a0 100644
--- a/clang/lib/CodeGen/TargetInfo.cpp
+++ b/clang/lib/CodeGen/TargetInfo.cpp
@@ -3065,9 +3065,10 @@ llvm::Type* MipsABIInfo::HandleAggregates(QualType Ty) const {
if (Ty->isComplexType())
return CGT.ConvertType(Ty);
- const RecordType *RT = Ty->getAsStructureType();
+ const RecordType *RT = Ty->getAs<RecordType>();
- if (!RT)
+ // Unions are passed in integer registers.
+ if (!RT || !RT->isStructureOrClassType())
return 0;
const RecordDecl *RD = RT->getDecl();
@@ -3080,6 +3081,8 @@ llvm::Type* MipsABIInfo::HandleAggregates(QualType Ty) const {
llvm::IntegerType *I64 = llvm::IntegerType::get(getVMContext(), 64);
SmallVector<llvm::Type*, 8> ArgList;
+ // Iterate over fields in the struct/class and check if there are any aligned
+ // double fields.
for (RecordDecl::field_iterator i = RD->field_begin(), e = RD->field_end();
i != e; ++i, ++idx) {
const QualType Ty = (*i)->getType();
@@ -3101,7 +3104,7 @@ llvm::Type* MipsABIInfo::HandleAggregates(QualType Ty) const {
LastOffset = Offset + 64;
}
- // This structure doesn't have an aligned double field.
+ // This struct/class doesn't have an aligned double field.
if (!LastOffset)
return 0;
OpenPOWER on IntegriCloud