Treat certain move instructions as assignments.

MOVE (static move) and MOVEP to a pointer constant know exactly where their
data is going, so treat them similarly to assignments: save their
distination operands (the addressed def for MOVEP) and mark them as
defined.
This commit is contained in:
Bill Currie 2012-12-13 12:50:00 +09:00
parent c61e03a0b9
commit 5681e0fd42

View file

@ -796,6 +796,18 @@ flow_analyze_statement (statement_t *s, set_t *use, set_t *def, set_t *kill,
flow_add_op_var (use, s->opb);
if (!strcmp (s->opcode, "<MOVE>")) {
flow_add_op_var (def, s->opc);
} else if (!strcmp (s->opcode, "<MOVEP>")
&& s->opc->op_type == op_value
&& s->opc->o.value->type == ev_pointer
&& s->opc->o.value->v.pointer.def) {
operand_t *op;
ex_pointer_t *ptr = &s->opc->o.value->v.pointer;
op = def_operand (ptr->def, ptr->type);
flow_add_op_var (def, op);
if (operands)
operands[0] = op;
else
free_operand (op);
} else {
if (s->opc)
flow_add_op_var (use, s->opc);
@ -804,9 +816,12 @@ flow_analyze_statement (statement_t *s, set_t *use, set_t *def, set_t *kill,
//FIXME set of everything
}
if (operands) {
if (!strcmp (s->opcode, "<MOVE>"))
operands[0] = s->opc;
operands[1] = s->opa;
operands[2] = s->opb;
operands[3] = s->opc;
if (strcmp (s->opcode, "<MOVE>"))
operands[3] = s->opc;
}
break;
case st_state: