mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-22 02:11:19 +00:00
[qfcc] Ensure ops on globals occur before return
This fixes the return-postop test, and covers calls, too.
This commit is contained in:
parent
a3c37201b2
commit
3d8ee5df43
2 changed files with 14 additions and 3 deletions
|
@ -462,7 +462,8 @@ dagnode_set_edges (dag_t *dag, dagnode_t *n, statement_t *s)
|
|||
if (n->type == st_func) {
|
||||
const char *num_params = 0;
|
||||
int first_param = 0;
|
||||
flowvar_t **flowvars = dag->flownode->graph->func->vars;
|
||||
function_t *func = dag->flownode->graph->func;
|
||||
flowvar_t **flowvars = func->vars;
|
||||
|
||||
if (!strcmp (n->label->opcode, "call")) {
|
||||
// nothing to do
|
||||
|
@ -482,6 +483,17 @@ dagnode_set_edges (dag_t *dag, dagnode_t *n, statement_t *s)
|
|||
}
|
||||
label->live = 1;
|
||||
}
|
||||
// ensure all operantions on global variables are completed before
|
||||
// the st_func statement executes
|
||||
for (set_iter_t *g = set_first (func->global_vars); g;
|
||||
g = set_next (g)) {
|
||||
flowvar_t *var = flowvars[g->element];
|
||||
dagnode_t *gn = dag_node (var->op);
|
||||
if (gn) {
|
||||
set_add (n->edges, gn->number);
|
||||
set_remove (gn->edges, n->number);
|
||||
}
|
||||
}
|
||||
if (num_params && isdigit (*num_params)) {
|
||||
for (i = first_param; i < *num_params - '0'; i++) {
|
||||
flowvar_t *var = flowvars[i + 1];
|
||||
|
|
|
@ -68,8 +68,7 @@ test_progs_dat=\
|
|||
tools/qfcc/test/while.dat \
|
||||
tools/qfcc/test/zerolinker.dat
|
||||
|
||||
fail_progs_dat=\
|
||||
tools/qfcc/test/return-postop.dat
|
||||
fail_progs_dat=
|
||||
|
||||
test_build_errors=\
|
||||
tools/qfcc/test/classarray.r \
|
||||
|
|
Loading…
Reference in a new issue