[qfcc] Force @return to be live

The change to not split basic blocks on function calls resulted in the
@return def not being live and thus getting dropped when optimizing.
Marking the def as not local forces flow and dags to treat it as global
and thus forced it to be live.
This commit is contained in:
Bill Currie 2024-03-08 09:03:52 +09:00
parent e7930305cc
commit 4daa84ed2a

View file

@ -1505,7 +1505,11 @@ statement_return (sblock_t *sblock, const expr_t *e)
// FIXME hard-coded reg, and assumes 3 is free // FIXME hard-coded reg, and assumes 3 is free
#define REG 3 #define REG 3
const expr_t *with = new_with_expr (11, REG, new_short_expr (0)); const expr_t *with = new_with_expr (11, REG, new_short_expr (0));
def_t *ret_ptr = new_def (0, 0, 0, sc_local); def_t *ret_ptr = new_def ("@return", 0, 0, sc_local);
// @return is neither global nor local, but making it not
// local causes flow (and dags) to treat it as global and thus
// it is live.
ret_ptr->local = 0;
operand_t *ret_op = def_operand (ret_ptr, &type_void, e); operand_t *ret_op = def_operand (ret_ptr, &type_void, e);
ret_ptr->reg = REG; ret_ptr->reg = REG;
sblock = statement_single (sblock, with); sblock = statement_single (sblock, with);