mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-13 00:24:12 +00:00
Handle back edges in return type flow.
Turns out the flow loop needs to be repeated until there are no changes.
This commit is contained in:
parent
9e4fb3d3e7
commit
df66669a87
1 changed files with 22 additions and 14 deletions
|
@ -595,16 +595,21 @@ static void
|
||||||
flow_return_type (flowgraph_t *graph)
|
flow_return_type (flowgraph_t *graph)
|
||||||
{
|
{
|
||||||
etype_t return_type;
|
etype_t return_type;
|
||||||
|
etype_t old_rtype;
|
||||||
flownode_t *node;
|
flownode_t *node;
|
||||||
set_iter_t *pred_iter;
|
set_iter_t *pred_iter;
|
||||||
flownode_t *pred;
|
flownode_t *pred;
|
||||||
int i;
|
int i;
|
||||||
|
int changed;
|
||||||
|
|
||||||
|
do {
|
||||||
|
changed = 0;
|
||||||
node = graph->nodes[0];
|
node = graph->nodes[0];
|
||||||
flow_set_return_type (node, ev_void);
|
flow_set_return_type (node, ev_void);
|
||||||
for (i = 1; i < graph->num_nodes; i++) {
|
for (i = 1; i < graph->num_nodes; i++) {
|
||||||
node = graph->nodes[graph->dfo[i]];
|
node = graph->nodes[graph->dfo[i]];
|
||||||
return_type = ev_type_count;
|
return_type = ev_type_count;
|
||||||
|
old_rtype = node->return_type.in;
|
||||||
for (pred_iter = set_first (node->predecessors); pred_iter;
|
for (pred_iter = set_first (node->predecessors); pred_iter;
|
||||||
pred_iter = set_next (pred_iter)) {
|
pred_iter = set_next (pred_iter)) {
|
||||||
pred = graph->nodes[pred_iter->member];
|
pred = graph->nodes[pred_iter->member];
|
||||||
|
@ -614,7 +619,10 @@ flow_return_type (flowgraph_t *graph)
|
||||||
return_type = ev_void;
|
return_type = ev_void;
|
||||||
}
|
}
|
||||||
flow_set_return_type (node, return_type);
|
flow_set_return_type (node, return_type);
|
||||||
|
if (return_type != old_rtype)
|
||||||
|
changed = 1;
|
||||||
}
|
}
|
||||||
|
} while (changed);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in a new issue