mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 23:32:09 +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
bbac02de24
commit
ca818eaff8
2 changed files with 14 additions and 3 deletions
|
@ -450,7 +450,8 @@ dagnode_set_edges (dag_t *dag, dagnode_t *n)
|
|||
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 (!strncmp (n->label->opcode, "<RCALL", 6)) {
|
||||
num_params = n->label->opcode + 6;
|
||||
|
@ -468,6 +469,17 @@ dagnode_set_edges (dag_t *dag, dagnode_t *n)
|
|||
}
|
||||
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];
|
||||
|
|
|
@ -63,8 +63,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