From: David Given Date: Tue, 4 Oct 2016 19:29:03 +0000 (+0200) Subject: Don't allocate new vregs for REG and NOP --- a bit hacky, but suppresses stray X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=e13ff5be315820ac593656788f6b1060ba1032fc;p=ack.git Don't allocate new vregs for REG and NOP --- a bit hacky, but suppresses stray movs very effectively. --- diff --git a/mach/proto/mcg/pass_instructionselection.c b/mach/proto/mcg/pass_instructionselection.c index 20a93c697..48ede30df 100644 --- a/mach/proto/mcg/pass_instructionselection.c +++ b/mach/proto/mcg/pass_instructionselection.c @@ -129,8 +129,24 @@ static struct insn* walk_instructions(struct burm_node* node, int goal) if (!insn->insndata->is_fragment) { + struct vreg* vreg = NULL; + + switch (node->label) + { + case ir_to_esn(IR_REG, 0): + vreg = node->ir->result; + break; + + case ir_to_esn(IR_NOP, 0): + vreg = node->left->ir->result; + break; + + default: + vreg = new_vreg(); + } + insn->hop = current_hop = new_hop(0, insn->ir); - insn->hop->output = new_vreg(); + insn->hop->output = vreg; emit(insn); hop_print('I', current_hop); diff --git a/mach/proto/mcg/table b/mach/proto/mcg/table index 0fa07b6bc..4d892c069 100644 --- a/mach/proto/mcg/table +++ b/mach/proto/mcg/table @@ -69,11 +69,9 @@ PATTERNS cost 4; reg = in:REG - emit "mov %reg, %in" cost 1; reg = NOP(in:reg) - emit "mov %reg, %in" cost 1;