diff options
Diffstat (limited to 'src/lower.c')
-rw-r--r-- | src/lower.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/lower.c b/src/lower.c index 7c5fdbd..1949bd5 100644 --- a/src/lower.c +++ b/src/lower.c @@ -299,11 +299,11 @@ static void lower_proc_call(struct fn *f, struct ast *c) output_insn(f, CALL, null_loc(), null_loc(), null_loc(), loc_as_int(def->l)); + f->sp -= count; + c->l = build_local_loc(f->sp); if (c->t != TYPE_VOID) output_insn(f, RETVAL, c->l, null_loc(), null_loc(), 0); - - f->sp -= count; } static void lower_func_call(struct fn *f, struct ast *c) @@ -322,11 +322,12 @@ static void lower_func_call(struct fn *f, struct ast *c) struct ast *def = file_scope_find(c->scope, func_call_id(c)); output_insn(f, CALL, null_loc(), null_loc(), null_loc(), loc_as_int(def->l)); + + f->sp -= count; + c->l = build_local_loc(f->sp); if (c->t != TYPE_VOID) output_insn(f, RETVAL, c->l, null_loc(), null_loc(), 0); - - f->sp -= count; } static void lower_eq(struct fn *f, struct ast *n) |