From 79d6ac719042371d255ed1cf412e3232d13d1e56 Mon Sep 17 00:00:00 2001 From: lemon Date: Wed, 25 Mar 2026 16:36:29 +0100 Subject: aarch64 struct arg passing ABI wip --- src/ir_abi0.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/ir_abi0.c') diff --git a/src/ir_abi0.c b/src/ir_abi0.c index 74a9d62..8722438 100644 --- a/src/ir_abi0.c +++ b/src/ir_abi0.c @@ -45,8 +45,13 @@ abiarg(ABIArgVec *abiargs, uchar *r2off, int *ni, int *nf, int *ns, IRType ty) int ret = mctarg->abiarg(r, cls, r2off, ni, nf, ns, ty); if (!ret) { /* in stack */ vpush(abiargs, ((ABIArg) { ty, .isstk = 1, .stk = r[0] })); - } else if (ret == 1 && ty.isagg && cls[0] == KPTR) { /* aggregate by pointer */ - vpush(abiargs, ((ABIArg) { cls2type(cls[0]), .reg = r[0] })); + } else if (ty.isagg && cls[0] == KPTR) { /* aggregate by pointer */ + ABIArg a = { cls2type(KPTR) }; + if (ret < 0) /* stack */ + a.isstk = 1, a.stk = r[0]; + else /* reg */ + a.isstk = 0, a.reg = r[0]; + vpush(abiargs, a); } else { /* by regs */ vpush(abiargs, ((ABIArg) { cls2type(cls[0]), .reg = r[0] })); if (ret == 2) -- cgit v1.2.3