summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorDaniel Sanders <daniel.sanders@imgtec.com>2014-09-04 13:28:14 +0000
committerDaniel Sanders <daniel.sanders@imgtec.com>2014-09-04 13:28:14 +0000
commited39f58390c72bc8c8d7358b286f5c7860f553e2 (patch)
tree3852245a94967e0faaf1adf9f386969467db10c8 /clang/lib
parentd3b10d9daf04ee6428c89b1c0e26dc0d94cb53ab (diff)
downloadbcm5719-llvm-ed39f58390c72bc8c8d7358b286f5c7860f553e2.tar.gz
bcm5719-llvm-ed39f58390c72bc8c8d7358b286f5c7860f553e2.zip
[mips] Zero-sized structs cannot be ignored in MipsABIInfo::classifyReturnType() for O32
Summary: They are returned indirectly which causes the other arguments to move to the next argument slot. With this, utils/ABITest does not discover any failing cases in the first 500 attempts on big/little endian for O32. Previously some of these failed. Also tested N32/N64 little endian (big endian has other known issues) with no issues. Reviewers: atanasyan Reviewed By: atanasyan Subscribers: atanasyan, cfe-commits Differential Revision: http://reviews.llvm.org/D4811 llvm-svn: 217147
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/CodeGen/TargetInfo.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp
index fb3b931ce95..d33d6a09e01 100644
--- a/clang/lib/CodeGen/TargetInfo.cpp
+++ b/clang/lib/CodeGen/TargetInfo.cpp
@@ -5548,7 +5548,12 @@ MipsABIInfo::returnAggregateInRegs(QualType RetTy, uint64_t Size) const {
ABIArgInfo MipsABIInfo::classifyReturnType(QualType RetTy) const {
uint64_t Size = getContext().getTypeSize(RetTy);
- if (RetTy->isVoidType() || Size == 0)
+ if (RetTy->isVoidType())
+ return ABIArgInfo::getIgnore();
+
+ // O32 doesn't treat zero-sized structs differently from other structs.
+ // However, N32/N64 ignores zero sized return values.
+ if (!IsO32 && Size == 0)
return ABIArgInfo::getIgnore();
if (isAggregateTypeForABI(RetTy) || RetTy->isVectorType()) {
OpenPOWER on IntegriCloud