Don't allocate new vregs for REG and NOP --- a bit hacky, but suppresses stray
movs very effectively.
This commit is contained in:
parent
bd28bddb92
commit
e13ff5be31
2 changed files with 17 additions and 3 deletions
|
@ -129,8 +129,24 @@ static struct insn* walk_instructions(struct burm_node* node, int goal)
|
||||||
|
|
||||||
if (!insn->insndata->is_fragment)
|
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 = current_hop = new_hop(0, insn->ir);
|
||||||
insn->hop->output = new_vreg();
|
insn->hop->output = vreg;
|
||||||
emit(insn);
|
emit(insn);
|
||||||
hop_print('I', current_hop);
|
hop_print('I', current_hop);
|
||||||
|
|
||||||
|
|
|
@ -69,11 +69,9 @@ PATTERNS
|
||||||
cost 4;
|
cost 4;
|
||||||
|
|
||||||
reg = in:REG
|
reg = in:REG
|
||||||
emit "mov %reg, %in"
|
|
||||||
cost 1;
|
cost 1;
|
||||||
|
|
||||||
reg = NOP(in:reg)
|
reg = NOP(in:reg)
|
||||||
emit "mov %reg, %in"
|
|
||||||
cost 1;
|
cost 1;
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue