From bb53a7fb5123ec25a391396d00711fd29790550f Mon Sep 17 00:00:00 2001 From: David Given Date: Fri, 14 Oct 2016 23:12:29 +0200 Subject: [PATCH] Fix stupid issue where hop output registers were being overwritten, leading to invalid SSA form. --- mach/proto/mcg/pass_instructionselection.c | 32 +++++++++++----------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/mach/proto/mcg/pass_instructionselection.c b/mach/proto/mcg/pass_instructionselection.c index 7e38efe4b..e8c9c453f 100644 --- a/mach/proto/mcg/pass_instructionselection.c +++ b/mach/proto/mcg/pass_instructionselection.c @@ -181,26 +181,26 @@ static struct insn* walk_instructions(struct burm_node* node, int goal) if (!insn->insndata->is_fragment) { - struct vreg* vreg = NULL; + insn->hop = current_hop = new_hop(current_bb, insn->ir); + emit(insn); - switch (node->label) + if (!current_hop->output) { - case ir_to_esn(IR_REG, 1): - case ir_to_esn(IR_REG, 2): - case ir_to_esn(IR_REG, 4): - case ir_to_esn(IR_REG, 8): - vreg = node->ir->result; - break; - - case ir_to_esn(IR_NOP, 0): - vreg = node->left->ir->result; - break; + switch (node->label) + { + case ir_to_esn(IR_REG, 1): + case ir_to_esn(IR_REG, 2): + case ir_to_esn(IR_REG, 4): + case ir_to_esn(IR_REG, 8): + current_hop->output = node->ir->result; + break; + + case ir_to_esn(IR_NOP, 0): + current_hop->output = node->left->ir->result; + break; + } } - insn->hop = current_hop = new_hop(current_bb, insn->ir); - current_hop->output = vreg; - emit(insn); - hop_print('I', current_hop); array_append(¤t_bb->hops, current_hop); -- 2.34.1