Detach dead temporary variables from dag nodes.

This allows temporary variables that are used in multiple nodes to remain
in the dag, but also will allow more freedom when generating code from the
dag.
This commit is contained in:
Bill Currie 2012-11-07 11:49:17 +09:00
parent fe13f21d9d
commit 88b8bebe3c

View file

@ -350,6 +350,18 @@ dag_create (const flownode_t *flownode)
// c = a ^ b
// c = a (move) b (count)
}
for (d = dagnodes; d; d = d->next) {
daglabel_t **l = &d->identifiers;
while (*l) {
if ((*l)->op->op_type == op_temp
&& !set_is_member (flownode->live_vars.out,
flow_get_var ((*l)->op)->number))
daglabel_detatch (*l);
else
l = &(*l)->next;
}
}
while (dagnodes->is_child) {
dagnode_t *n = dagnodes->next;
dagnodes->next = 0;