[qfcc] Ensure all operands are cleared before flow

I had missed the flowvar clearing for auxiliary use/def/kill operands.
It's possible it wasn't necessary at the time since the operands were
added just for dealloc checking, but there's every reason it could
become necessary.
This commit is contained in:
Bill Currie 2023-05-20 13:54:40 +09:00
parent b5a57cd15c
commit 208359edc6

View file

@ -550,6 +550,23 @@ static int flow_def_clear_flowvars (def_t *def, void *data)
return 0; return 0;
} }
static void
clear_operand (operand_t *op)
{
if (op && op->op_type == op_def) {
def_visit_all (op->def, 0, flow_def_clear_flowvars, 0);
}
}
static void
clear_operand_chain (operand_t *op)
{
while (op) {
clear_operand (op);
op = op->next;
}
}
static void static void
add_var_addrs (set_t *set, flowvar_t *var) add_var_addrs (set_t *set, flowvar_t *var)
{ {
@ -622,11 +639,11 @@ flow_build_vars (function_t *func)
s = func->statements[i]; s = func->statements[i];
flow_analyze_statement (s, 0, 0, 0, operands); flow_analyze_statement (s, 0, 0, 0, operands);
for (j = 0; j < FLOW_OPERANDS; j++) { for (j = 0; j < FLOW_OPERANDS; j++) {
if (operands[j] && operands[j]->op_type == op_def) { clear_operand (operands[j]);
def_visit_all (operands[j]->def, 0,
flow_def_clear_flowvars, 0);
}
} }
clear_operand_chain (s->use);
clear_operand_chain (s->def);
clear_operand_chain (s->kill);
} }
// count .return and .param_[0-7] as they are always needed // count .return and .param_[0-7] as they are always needed
for (i = 0; i < num_flow_params; i++) { for (i = 0; i < num_flow_params; i++) {