1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-21 11:10:21 +02:00

Implement the "live" code to explicitly tell a register is live.

*include/lightning.h, lib/lightning.c: Add the new jit_live code
	to explicitly mark a register as live. It is required to avoid
	assuming functions always return a value in the gpr and fpr return
	register, and to avoid the need of some very specialized codes
	that vary too much from backend to backend, to instruct the
	optimization code the return register is live.

	* lib/jit_arm.c, lib/jit_mips.c, lib/jit_ppc.c, lib/jit_print.c,
	lib/jit_x86.c: Update for the new jit_live code.

	* check/ret.ok, check/ret.tst: New files implementing a simple
	test case that would previously fail at least in ix86/x86_64.

	* check/Makefile.am: Update for new "ret" test case.
This commit is contained in:
pcpa 2013-02-05 14:14:25 -02:00
parent 7b2c9cfb2a
commit 60c1c545fc
12 changed files with 140 additions and 32 deletions

View file

@ -278,7 +278,10 @@ _jit_ret(jit_state_t *_jit)
void
_jit_retr(jit_state_t *_jit, jit_int32_t u)
{
jit_movr(JIT_RET, u);
if (JIT_RET != u)
jit_movr(JIT_RET, u);
else
jit_live(JIT_RET);
jit_ret();
}
@ -295,20 +298,24 @@ _jit_retr_f(jit_state_t *_jit, jit_int32_t u)
if (jit_cpu.abi) {
if (u != JIT_FRET)
jit_movr_f(JIT_FRET, u);
else
jit_live(JIT_FRET);
}
else {
if (u != JIT_RET)
jit_movr_f_w(JIT_RET, u);
else
jit_live(JIT_RET);
}
else if (u != JIT_RET)
jit_movr_f_w(JIT_RET, u);
jit_ret();
}
void
_jit_reti_f(jit_state_t *_jit, jit_float32_t u)
{
if (jit_cpu.abi) {
if (u != JIT_FRET)
jit_movi_f(JIT_FRET, u);
}
else if (u != JIT_RET)
if (jit_cpu.abi)
jit_movi_f(JIT_FRET, u);
else
jit_movi_f_w(JIT_RET, u);
jit_ret();
}
@ -319,20 +326,24 @@ _jit_retr_d(jit_state_t *_jit, jit_int32_t u)
if (jit_cpu.abi) {
if (u != JIT_FRET)
jit_movr_d(JIT_FRET, u);
else
jit_live(JIT_FRET);
}
else {
if (u != JIT_RET)
jit_movr_d_ww(JIT_RET, _R1, u);
else
jit_live(JIT_RET);
}
else if (u != JIT_RET)
jit_movr_d_ww(JIT_RET, _R1, u);
jit_ret();
}
void
_jit_reti_d(jit_state_t *_jit, jit_float64_t u)
{
if (jit_cpu.abi) {
if (u != JIT_FRET)
jit_movi_d(JIT_FRET, u);
}
else if (u != JIT_RET)
if (jit_cpu.abi)
jit_movi_d(JIT_FRET, u);
else
jit_movi_d_ww(JIT_RET, _R1, u);
jit_ret();
}
@ -1476,6 +1487,7 @@ _emit_code(jit_state_t *_jit)
else
vfp_movi_d(rn(node->u.w), node->w.d);
break;
case jit_code_live:
case jit_code_arg:
case jit_code_arg_f: case jit_code_arg_d:
break;