Skip to content

Commit

Permalink
turn guard(type|conc) into guardjust(type|conc)
Browse files Browse the repository at this point in the history
if the facts support it, i.e. if the register is
known to contain the right type already.
  • Loading branch information
timo committed Aug 16, 2018
1 parent d2c40f0 commit 53dd98e
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/spesh/optimize.c
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,22 @@ static void optimize_guard(MVMThreadContext *tc, MVMSpeshGraph *g, MVMSpeshBB *b

ins->info = MVM_op_get_op(MVM_OP_set);
}
else if ((opcode == MVM_OP_sp_guardconc || opcode == MVM_OP_sp_guardtype) && can_drop_type_guard) {
MVM_spesh_graph_add_comment(tc, g, ins, "%s r%d(%d) r%d(%d); flags 0x%x",
ins->info->name,
ins->operands[0].reg.orig,
ins->operands[0].reg.i,
ins->operands[1].reg.orig,
ins->operands[1].reg.i,
facts->flags);

ins->operands[2] = ins->operands[3];
if (opcode == MVM_OP_sp_guardconc)
ins->info = MVM_op_get_op(MVM_OP_sp_guardjustconc);
else {
ins->info = MVM_op_get_op(MVM_OP_sp_guardjusttype);
}
}
}

static void optimize_can_op(MVMThreadContext *tc, MVMSpeshGraph *g, MVMSpeshBB *bb, MVMSpeshIns *ins) {
Expand Down

0 comments on commit 53dd98e

Please sign in to comment.