nooc

nooc programming language compiler
git clone git://git.nihaljere.xyz/nooc
Log | Files | Refs | LICENSE

commit d78ea8f502d9cc135ae097d08e2cc4d0b43e2a28
parent a4dd029ba2d03e7d014958eff03de5d2ba407f08
Author: Nihal Jere <nihal@nihaljere.xyz>
Date:   Tue, 11 Jan 2022 18:46:25 -0600

ir: fix *INS, reset out_index once done with it

Diffstat:
Mir.c | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/ir.c b/ir.c @@ -155,7 +155,7 @@ genexpr(struct iproc *out, size_t expri) uint64_t right = genexpr(out, expr->d.bop.right); what = NEWTMP; STARTINS(IR_ASSIGN, what); - STARTINS(IR_SIZE, 8); + PUTINS(IR_SIZE, 8); switch (expr->d.bop.kind) { case BOP_PLUS: PUTINS(IR_ADD, left); // FIXME: operand size? @@ -211,6 +211,8 @@ genexpr(struct iproc *out, size_t expri) for (size_t i = expr->d.call.params.len; i <= expr->d.call.params.len; i--) { PUTINS(IR_CALLARG, params[i]); } + + out_index = 0; break; } case EXPR_COND: { @@ -309,7 +311,7 @@ genblock(struct iproc *out, struct block *block) genexpr(out, item->idx); break; case ITEM_RETURN: - PUTINS(IR_RETURN, 0); + STARTINS(IR_RETURN, 0); break; default: die("ir_genproc: unreachable");