From 1139df03b0edbf08deb9aa26ade3776be3c1e180 Mon Sep 17 00:00:00 2001 From: lemon Date: Sun, 11 Jun 2023 19:29:30 +0200 Subject: remove RPARAM, add Oparam, lower args/rets to abi regs in abi0 --- parse.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'parse.c') diff --git a/parse.c b/parse.c index e97c46a..b488b36 100644 --- a/parse.c +++ b/parse.c @@ -1797,6 +1797,16 @@ function(struct parser *pr, struct function *fn, const char **pnames, const stru const bool doemit = fn->curblk; struct env e; envdown(pr, &e); + + /* emit Oparam instructions */ + EMITS { + for (int i = 0; i < td->nmemb; ++i) { + union irtype pty = mkirtype(td->param[i]); + union ref r = addinstr(fn, mkinstr(Oparam, pty.isagg ? KPTR : pty.cls, + mkref(RICON, i), mktyperef(pty))); + assert(r.t == RTMP && r.i == i); + } + } /* add parameters to symbol table and create prologue (arguments) block */ for (int i = 0; i < td->nmemb; ++i) { if (pnames[i]) { @@ -1805,9 +1815,9 @@ function(struct parser *pr, struct function *fn, const char **pnames, const stru EMITS { if (isscalar(arg.ty)) { arg.id = addinstr(fn, mkalloca(typesize(arg.ty), typealign(arg.ty))).i; - genstore(fn, arg.ty, mkref(RTMP, arg.id), mkref(RPARAM, i)); + genstore(fn, arg.ty, mkref(RTMP, arg.id), mkref(RTMP, i)); } else { - arg.id = addinstr(fn, mkinstr(Ocopy, KPTR, mkref(RPARAM, i))).i; + arg.id = addinstr(fn, mkinstr(Ocopy, KPTR, mkref(RTMP, i))).i; } } putdecl(pr, &arg); -- cgit v1.2.3