mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 23:32:09 +00:00
Move the flow-var use/define calcs to a better place.
dags.c really isn't the right place. The only reason it wasn't in flow.c in the first place is find_operands was in the wrong place.
This commit is contained in:
parent
c4d4174ebc
commit
04a8e19481
2 changed files with 17 additions and 9 deletions
|
@ -276,18 +276,9 @@ make_dag (const sblock_t *block)
|
|||
operand_t *x = 0, *y = 0, *z = 0, *w = 0;
|
||||
dagnode_t *n = 0, *ny, *nz, *nw;
|
||||
daglabel_t *op, *lx;
|
||||
flowvar_t *var;
|
||||
int simp;
|
||||
|
||||
simp = find_operands (s, &x, &y, &z, &w);
|
||||
if (x && (var = flow_get_var (x)))
|
||||
set_add (var->define, s->number);
|
||||
if (y && (var = flow_get_var (y)))
|
||||
set_add (var->use, s->number);
|
||||
if (z && (var = flow_get_var (z)))
|
||||
set_add (var->use, s->number);
|
||||
if (w && (var = flow_get_var (w)))
|
||||
set_add (var->use, s->number);
|
||||
if (!(ny = node (y))) {
|
||||
ny = leaf_node (y);
|
||||
if (simp) {
|
||||
|
|
|
@ -321,6 +321,23 @@ flow_live_vars (flowgraph_t *graph)
|
|||
void
|
||||
flow_data_flow (flowgraph_t *graph)
|
||||
{
|
||||
int i, j;
|
||||
flownode_t *node;
|
||||
statement_t *st;
|
||||
operand_t *d, *u[3];
|
||||
flowvar_t *var;
|
||||
|
||||
for (i = 0; i < graph->num_nodes; i++) {
|
||||
node = graph->nodes[i];
|
||||
for (st = node->sblock->statements; st; st = st->next) {
|
||||
find_operands (st, &d, &u[0], &u[1], &u[2]);
|
||||
if (d && (var = flow_get_var (d)))
|
||||
set_add (var->define, st->number);
|
||||
for (j = 0; j < 3; j++)
|
||||
if (u[j] && (var = flow_get_var (u[j])))
|
||||
set_add (var->use, st->number);
|
||||
}
|
||||
}
|
||||
flow_live_vars (graph);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue