aboutsummaryrefslogtreecommitdiff
path: root/compiler.c
diff options
context:
space:
mode:
Diffstat (limited to 'compiler.c')
-rw-r--r--compiler.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler.c b/compiler.c
index c6adf6a..b0297f9 100644
--- a/compiler.c
+++ b/compiler.c
@@ -278,7 +278,7 @@ static void compile_node(struct ir *ir, struct symtab *symtab, struct node *node
symtab = symtab_sub(symtab);
for (int i = 0; i < numparams; i++) {
struct symbol *parsym = symbol_make_var(strdup(sym->params[i].name), sym->params[i].type);
- parsym->ref = ref_mem(REG_BP, -2 - i, REFREL_ZERO);
+ parsym->ref = ref_mem(REG_BP, 2 + i, REFREL_ZERO);
symtab_insert(symtab, parsym);
}
@@ -368,6 +368,7 @@ static void compile_data_setup(struct ir *ir, struct symtab *symtab, struct node
ir_append(ir, irins_make_jcc(afterlbl, CCNZ));
compile_data_setup_node(ir, symtab, root);
+ ir_append(ir, irins_make_01(INS_MOV, flag, ref_imm(1)));
ir_append(ir, irins_make_name(INS_LBL, afterlbl));
ir_append(ir, irins_make_name(INS_CALL, "main"));