aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/TargetInfo.cpp
diff options
context:
space:
mode:
authorGeorge Koehler <kernigh@gmail.com>2021-01-23 00:13:36 -0500
committerBrad Smith <brad@comstyle.com>2021-01-23 00:13:36 -0500
commit018984ae6833fae107aa9c502ab5536efceca88e (patch)
treed1e43e283a95b75c0bcf497ff1145c11ae3318e1 /clang/lib/CodeGen/TargetInfo.cpp
parent6c43564530365ac2c074d7515d4eada294d4ca0c (diff)
downloadllvm-018984ae6833fae107aa9c502ab5536efceca88e.zip
llvm-018984ae6833fae107aa9c502ab5536efceca88e.tar.gz
llvm-018984ae6833fae107aa9c502ab5536efceca88e.tar.bz2
[PowerPC] Fix va_arg in C++, Objective-C on 32-bit ELF targets
In the PPC32 SVR4 ABI, a va_list has copies of registers from the function call. va_arg looked in the wrong registers for (the pointer representation of) an object in Objective-C, and for some types in C++. Fix va_arg to look in the general-purpose registers, not the floating-point registers. Also fix va_arg for some C++ types, like a member function pointer, that are aggregates for the ABI. Anthony Richardby found the problem in Objective-C. Eli Friedman suggested part of this fix. Fixes https://bugs.llvm.org/show_bug.cgi?id=47921 Reviewed By: efriedma, nemanjai Differential Revision: https://reviews.llvm.org/D90329
Diffstat (limited to 'clang/lib/CodeGen/TargetInfo.cpp')
-rw-r--r--clang/lib/CodeGen/TargetInfo.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp
index 9a11a07..bcd2429 100644
--- a/clang/lib/CodeGen/TargetInfo.cpp
+++ b/clang/lib/CodeGen/TargetInfo.cpp
@@ -4709,13 +4709,12 @@ Address PPC32_SVR4_ABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAList,
// };
bool isI64 = Ty->isIntegerType() && getContext().getTypeSize(Ty) == 64;
- bool isInt =
- Ty->isIntegerType() || Ty->isPointerType() || Ty->isAggregateType();
+ bool isInt = !Ty->isFloatingType();
bool isF64 = Ty->isFloatingType() && getContext().getTypeSize(Ty) == 64;
// All aggregates are passed indirectly? That doesn't seem consistent
// with the argument-lowering code.
- bool isIndirect = Ty->isAggregateType();
+ bool isIndirect = isAggregateTypeForABI(Ty);
CGBuilderTy &Builder = CGF.Builder;