[clang] [PowerPC] make `_Complex` ABI GCC-compatible (PR #208917)
Matt Turner via cfe-commits
cfe-commits at lists.llvm.org
Sun Nov 29 08:49:38 PST 2026
================
@@ -371,12 +382,15 @@ class PPC32_SVR4_ABIInfo : public DefaultABIInfo {
IsRetSmallStructInRegABI(RetSmallStructInRegABI) {}
ABIArgInfo classifyReturnType(QualType RetTy) const;
+ ABIArgInfo classifyArgumentType(QualType Ty, int &ArgGPRsLeft) const;
void computeInfo(CGFunctionInfo &FI) const override {
if (!getCXXABI().classifyReturnType(FI))
FI.getReturnInfo() = classifyReturnType(FI.getReturnType());
+
+ int ArgGPRsLeft = NumArgGPRs;
----------------
mattst88 wrote:
When the return is indirect, the sret pointer takes r3, so only seven GPRs are
left at this point. With
```c
struct S { int a[8]; };
struct S fs(int, int, int, int, int, int, _Complex double);
void cs(void) { fs(1, 2, 3, 4, 5, 6, 7.0 + 8.0i); }
```
GCC puts the ints in r4-r9, leaves r10 unused and stores the `_Complex double`
at 8(r1). This patch thinks two GPRs are left and adds a `[2 x i32]` pad. The
pad gets r10 and the first stack word, and the value ends up at 12(r1).
https://github.com/llvm/llvm-project/pull/208917
More information about the cfe-commits
mailing list