1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-19 19:20:23 +02:00

Only mark callee save regs as live on jumps that cannot be tracked.

* lib/lightning.c: Do not mark all registers in unknown state
	as live on jit_jmpr, or jit_jmpi to an absolute address. Instead,
	treat it as a function call, and only consider JIT_Vn registers
	as possibly live.
This commit is contained in:
pcpa 2014-09-01 16:27:19 -03:00
parent 4f8d85b90d
commit 45c4df506c
2 changed files with 34 additions and 0 deletions

View file

@ -2006,6 +2006,7 @@ _jit_update(jit_state_t *_jit, jit_node_t *node,
jit_regset_t *live, jit_regset_t *mask)
{
jit_int32_t spec;
jit_int32_t regno;
jit_regset_t ztmp;
jit_regset_t zmask;
unsigned long value;
@ -2165,6 +2166,32 @@ _jit_update(jit_state_t *_jit, jit_node_t *node,
}
continue;
}
/* Should not really mark as live all registers in unknown
* state if using jit_jmpr(), or jit_jmpi(absolute_address)
* because that would leave the register allocator with
* no options for "nospill" temporaries (other temporaries
* also benefit from not needing to spill/reload), so, the
* user must ensure to either spill/reload, or only leave
* live registers on JIT_Vn if using a jump that cannot
* be tracked around the generated jit code */
for (spec = JIT_R_NUM - 1; spec >= 0; spec--) {
regno = jit_r(spec);
if (jit_regset_tstbit(mask, regno))
jit_regset_clrbit(mask, regno);
}
for (spec = JIT_F_NUM - 1; spec >= 0; spec--) {
regno = jit_f(spec);
if (jit_regset_tstbit(mask, regno))
jit_regset_clrbit(mask, regno);
}
/* In some backends JIT_Rn and JIT_Fn are callee save */
for (regno = 0; regno < _jitc->reglen; regno++) {
spec = jit_class(_rvs[regno].spec);
if (jit_regset_tstbit(mask, regno) &&
(spec & (jit_class_gpr|jit_class_fpr)) &&
!(spec & jit_class_sav))
jit_regset_clrbit(mask, regno);
}
/* assume value is live due to jump to unknown location */
jit_regset_ior(live, live, mask);
jit_regset_set_ui(mask, 0);