diff options
author | Martin Storsjö <martin@martin.st> | 2021-05-31 23:55:26 +0300 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2021-06-07 22:34:10 +0300 |
commit | 6de45b9e6a2c4b69ca82916a4cc1b4b8636d79b3 (patch) | |
tree | 9b0b4268c7c334b4f0e200bdbfeed770dd5f7f99 /clang/lib/CodeGen/TargetInfo.cpp | |
parent | 8fdd7c2ff16da370e28ef1b22e400d57a541484f (diff) | |
download | llvm-6de45b9e6a2c4b69ca82916a4cc1b4b8636d79b3.zip llvm-6de45b9e6a2c4b69ca82916a4cc1b4b8636d79b3.tar.gz llvm-6de45b9e6a2c4b69ca82916a4cc1b4b8636d79b3.tar.bz2 |
[clang] Fix reading long doubles with va_arg on x86_64 mingw
On x86_64 mingw, long doubles are always passed indirectly as
arguments (see an existing case in WinX86_64ABIInfo::classify);
generalize the existing code for reading varargs - any non-aggregate
type that is larger than 64 bits (which would be both long double
in mingw, and __int128) are passed indirectly too.
This makes reading varargs consistent with how they're passed,
fixing interop with both gcc and clang callers, for long double
and __int128.
Differential Revision: https://reviews.llvm.org/D103452
Diffstat (limited to 'clang/lib/CodeGen/TargetInfo.cpp')
-rw-r--r-- | clang/lib/CodeGen/TargetInfo.cpp | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp index af516bb..440153c 100644 --- a/clang/lib/CodeGen/TargetInfo.cpp +++ b/clang/lib/CodeGen/TargetInfo.cpp @@ -4358,15 +4358,10 @@ void WinX86_64ABIInfo::computeInfo(CGFunctionInfo &FI) const { Address WinX86_64ABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAListAddr, QualType Ty) const { - - bool IsIndirect = false; - // MS x64 ABI requirement: "Any argument that doesn't fit in 8 bytes, or is // not 1, 2, 4, or 8 bytes, must be passed by reference." - if (isAggregateTypeForABI(Ty) || Ty->isMemberPointerType()) { - uint64_t Width = getContext().getTypeSize(Ty); - IsIndirect = Width > 64 || !llvm::isPowerOf2_64(Width); - } + uint64_t Width = getContext().getTypeSize(Ty); + bool IsIndirect = Width > 64 || !llvm::isPowerOf2_64(Width); return emitVoidPtrVAArg(CGF, VAListAddr, Ty, IsIndirect, CGF.getContext().getTypeInfoInChars(Ty), |