From 6fda06d6f032c3a45c459324184c2b0f2c30b5cb Mon Sep 17 00:00:00 2001 From: Dibyendu Majumdar Date: Sat, 25 Jun 2022 17:53:41 +0100 Subject: [PATCH] #245 ensure result is let on top of virtual stack --- ravicomp/src/linearizer.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ravicomp/src/linearizer.c b/ravicomp/src/linearizer.c index a5bcd1bc..9114549c 100644 --- a/ravicomp/src/linearizer.c +++ b/ravicomp/src/linearizer.c @@ -1273,12 +1273,9 @@ static Pseudo *indexed_load(Proc *proc, Pseudo *index_pseudo) default: break; } - Pseudo *target_pseudo = allocate_temp_pseudo(proc, target_type, false); Instruction *insn = allocate_instruction(proc, (enum opcode)op, line_number); Pseudo *tofree1 = add_instruction_operand(proc, insn, container_pseudo); Pseudo *tofree2 = add_instruction_operand(proc, insn, key_pseudo); - add_instruction_target(proc, insn, target_pseudo); - add_instruction(proc, insn); free_temp_pseudo(proc, container_pseudo, false); free_temp_pseudo(proc, key_pseudo, false); index_pseudo->index_info.used = 1; @@ -1286,6 +1283,9 @@ static Pseudo *indexed_load(Proc *proc, Pseudo *index_pseudo) free_temp_pseudo(proc, tofree1, false); if (tofree2) free_temp_pseudo(proc, tofree2, false); + Pseudo *target_pseudo = allocate_temp_pseudo(proc, target_type, true); + add_instruction_target(proc, insn, target_pseudo); + add_instruction(proc, insn); return target_pseudo; }