From 905e9cef302727fdaacd7069826ff448c2d88361 Mon Sep 17 00:00:00 2001 From: Quentin Carbonneaux Date: Mon, 14 Mar 2022 09:59:14 +0100 Subject: arm64/abi: fix big aggregates passed on the stack The riscv test abi8.ssa caught a bug in the arm backend. It turns out we were using the wrong class when loading pointers to aggregates from the stack. The fix is simple and mirrors what is done in the riscv abi. --- arm64/abi.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'arm64') diff --git a/arm64/abi.c b/arm64/abi.c index 6ed393d..b6b4612 100644 --- a/arm64/abi.c +++ b/arm64/abi.c @@ -100,6 +100,9 @@ typclass(Class *c, Typ *t, int *gp, int *fp) * memory */ c->class |= Cptr; c->size = 8; + c->ngp = 1; + *c->reg = *gp; + *c->cls = Kl; return; } @@ -230,14 +233,7 @@ argsclass(Ins *i0, Ins *i1, Class *carg, Ref *env) case Oparc: case Oargc: typclass(c, &typ[i->arg[0].val], gp, fp); - if (c->class & Cptr) { - if (ngp > 0) { - ngp--; - *c->reg = *gp++; - *c->cls = Kl; - break; - } - } else if (c->ngp <= ngp) { + if (c->ngp <= ngp) { if (c->nfp <= nfp) { ngp -= c->ngp; nfp -= c->nfp; -- cgit 1.4.1