aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/t_aarch64_aapcs.c
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2026-04-08 10:26:18 +0200
committerlemon <lsof@mailbox.org>2026-04-08 10:26:18 +0200
commit8b79b61ae78c91c069447331ed64d400187bdd77 (patch)
tree57a5d9b04c1514ac59c18286cb08393ecd0b1e69 /src/t_aarch64_aapcs.c
parentb8dea129488959adeadc2e444d769f2a2ac709d8 (diff)
Implement basic aarch64 struct arg passing ABI
- Missing: vaargs, >2 member HFAs - Reworked the way stack allocation references are lowered. Now RSTACK persists throughout all passes until emit. This allows deferring stack frame layouting until the end in a less messy way than before, which was emiting frame-pointer relative addresses @ isel time and patching them up later in emit to account for actual stack frame layout.
Diffstat (limited to 'src/t_aarch64_aapcs.c')
-rw-r--r--src/t_aarch64_aapcs.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/t_aarch64_aapcs.c b/src/t_aarch64_aapcs.c
index a321f5b..1cf3a61 100644
--- a/src/t_aarch64_aapcs.c
+++ b/src/t_aarch64_aapcs.c
@@ -93,7 +93,7 @@ abiarg(short r[2], uchar cls[2], uchar *r2off, int *ni, int *nf, int *ns, IRType
if (n <= NFLT - *nf) {
for (int i = 0; i < n; ++i) {
r[i] = V(0) + *nf + i;
- cls[i] = type2cls[k];
+ cls[i] = k;
}
*nf += n;
} else { /* stack */
@@ -121,17 +121,17 @@ abiarg(short r[2], uchar cls[2], uchar *r2off, int *ni, int *nf, int *ns, IRType
}
static int
-abiret(short r[2], uchar cls[2], uchar *r2off, int *ni, IRType typ)
+abiret(short r[2], uchar cls[2], uchar *r2off, int *_ni, IRType typ)
{
if (!typ.isagg) {
r[0] = kisflt(cls[0] = typ.cls) ? V(0) : R0;
return 1;
}
- int nf = 0, ns = 0;
- int ret = abiarg(r, cls, r2off, ni, &nf, &ns, typ);
- if (ret) return ret;
+ int ni = 0, nf = 0, ns = 0;
+ int ret = abiarg(r, cls, r2off, &ni, &nf, &ns, typ);
+ if (ret && cls[0] != KPTR) /* in regs */
+ return ret;
/* caller-allocated result address in x8 */
- assert(*ni == 0);
r[0] = -1;
r[1] = R(8);
return 0;