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

Implement jit_putarg*

* include/lightning.h, lib/jit_aarch64.c,
	lib/jit_alpha.c, lib/jit_arm.c, lib/jit_hppa.c,
	lib/jit_ia64.c, lib/jit_mips.c,	lib/jit_ppc.c,
	lib/jit_s390.c, lib/jit_sparc.c, lib/jit_x86.c:
	Implement jit_putarg*. It works as a mix of jit_getarg*
	and jit_pusharg*, in the way that the first argument is
	a register or immediate, and the second is a pointer
	returned by jit_arg*. The use of the interface is to change
	values of arguments to the current jit function.

	* check/put.ok, check/put.tst: New test cases exercising
	the new jit_putarg* interface.

	* check/Makefile.am, check/lightning.c: Update for the
	new test case and interface.
This commit is contained in:
Paulo Andrade 2015-01-15 14:20:07 -02:00
parent 192f89c0ee
commit 27d9b68a3f
16 changed files with 1535 additions and 20 deletions

View file

@ -283,6 +283,13 @@ _jit_arg_f(jit_state_t *_jit)
offset = _jitc->function->self.size;
#else
offset = _jitc->function->self.size + 4;
#endif
}
if (_jitc->function->self.argi < 8) {
#if __WORDSIZE == 32
_jitc->function->self.argi += 2;
#else
_jitc->function->self.argi++;
#endif
}
_jitc->function->self.size += sizeof(jit_word_t);
@ -304,6 +311,13 @@ _jit_arg_d(jit_state_t *_jit)
offset = _jitc->function->self.argf++;
else
offset = _jitc->function->self.size;
if (_jitc->function->self.argi < 8) {
#if __WORDSIZE == 32
_jitc->function->self.argi += 2;
#else
_jitc->function->self.argi++;
#endif
}
_jitc->function->self.size += sizeof(jit_float64_t);
return (jit_new_node_w(jit_code_arg_d, offset));
}
@ -317,6 +331,7 @@ _jit_arg_d_reg_p(jit_state_t *_jit, jit_int32_t offset)
void
_jit_getarg_c(jit_state_t *_jit, jit_int32_t u, jit_node_t *v)
{
assert(v->code == jit_code_arg);
if (v->u.w < 8)
jit_extr_c(u, JIT_RA0 - v->u.w);
else {
@ -332,6 +347,7 @@ _jit_getarg_c(jit_state_t *_jit, jit_int32_t u, jit_node_t *v)
void
_jit_getarg_uc(jit_state_t *_jit, jit_int32_t u, jit_node_t *v)
{
assert(v->code == jit_code_arg);
if (v->u.w < 8)
jit_extr_uc(u, JIT_RA0 - v->u.w);
else {
@ -347,6 +363,7 @@ _jit_getarg_uc(jit_state_t *_jit, jit_int32_t u, jit_node_t *v)
void
_jit_getarg_s(jit_state_t *_jit, jit_int32_t u, jit_node_t *v)
{
assert(v->code == jit_code_arg);
if (v->u.w < 8)
jit_extr_s(u, JIT_RA0 - v->u.w);
else {
@ -362,6 +379,7 @@ _jit_getarg_s(jit_state_t *_jit, jit_int32_t u, jit_node_t *v)
void
_jit_getarg_us(jit_state_t *_jit, jit_int32_t u, jit_node_t *v)
{
assert(v->code == jit_code_arg);
if (v->u.w < 8)
jit_extr_us(u, JIT_RA0 - v->u.w);
else {
@ -377,6 +395,7 @@ _jit_getarg_us(jit_state_t *_jit, jit_int32_t u, jit_node_t *v)
void
_jit_getarg_i(jit_state_t *_jit, jit_int32_t u, jit_node_t *v)
{
assert(v->code == jit_code_arg);
if (v->u.w < 8) {
#if __WORDSIZE == 32
jit_movr(u, JIT_RA0 - v->u.w);
@ -398,6 +417,7 @@ _jit_getarg_i(jit_state_t *_jit, jit_int32_t u, jit_node_t *v)
void
_jit_getarg_ui(jit_state_t *_jit, jit_int32_t u, jit_node_t *v)
{
assert(v->code == jit_code_arg);
if (v->u.w < 8)
jit_extr_ui(u, JIT_RA0 - v->u.w);
else {
@ -413,6 +433,7 @@ _jit_getarg_ui(jit_state_t *_jit, jit_int32_t u, jit_node_t *v)
void
_jit_getarg_l(jit_state_t *_jit, jit_int32_t u, jit_node_t *v)
{
assert(v->code == jit_code_arg);
if (v->u.w < 8)
jit_movr(u, JIT_RA0 - v->u.w);
else
@ -420,24 +441,101 @@ _jit_getarg_l(jit_state_t *_jit, jit_int32_t u, jit_node_t *v)
}
#endif
void
_jit_putargr(jit_state_t *_jit, jit_int32_t u, jit_node_t *v)
{
assert(v->code == jit_code_arg);
if (v->u.w < 8)
jit_movr(JIT_RA0 - v->u.w, u);
else
jit_stxi(v->u.w, JIT_FP, u);
}
void
_jit_putargi(jit_state_t *_jit, jit_word_t u, jit_node_t *v)
{
jit_int32_t regno;
assert(v->code == jit_code_arg);
if (v->u.w < 8)
jit_movi(JIT_RA0 - v->u.w, u);
else {
regno = jit_get_reg(jit_class_gpr);
jit_movi(regno, u);
jit_stxi(v->u.w, JIT_FP, regno);
jit_unget_reg(regno);
}
}
void
_jit_getarg_f(jit_state_t *_jit, jit_int32_t u, jit_node_t *v)
{
assert(v->code == jit_code_arg_f);
if (v->u.w < 13)
jit_movr_d(u, JIT_FA0 - v->u.w);
else
jit_ldxi_f(u, JIT_FP, v->u.w);
}
void
_jit_putargr_f(jit_state_t *_jit, jit_int32_t u, jit_node_t *v)
{
assert(v->code == jit_code_arg_f);
if (v->u.w < 13)
jit_movr_d(JIT_FA0 - v->u.w, u);
else
jit_stxi_f(v->u.w, JIT_FP, u);
}
void
_jit_putargi_f(jit_state_t *_jit, jit_float32_t u, jit_node_t *v)
{
jit_int32_t regno;
assert(v->code == jit_code_arg_f);
if (v->u.w < 13)
jit_movi_d(JIT_FA0 - v->u.w, u);
else {
regno = jit_get_reg(jit_class_fpr);
jit_movi_d(regno, u);
jit_stxi_f(v->u.w, JIT_FP, regno);
jit_unget_reg(regno);
}
}
void
_jit_getarg_d(jit_state_t *_jit, jit_int32_t u, jit_node_t *v)
{
assert(v->code == jit_code_arg_d);
if (v->u.w < 13)
jit_movr_d(u, JIT_FA0 - v->u.w);
else
jit_ldxi_d(u, JIT_FP, v->u.w);
}
void
_jit_putargr_d(jit_state_t *_jit, jit_int32_t u, jit_node_t *v)
{
assert(v->code == jit_code_arg_d);
if (v->u.w < 13)
jit_movr_d(JIT_FA0 - v->u.w, u);
else
jit_stxi_d(v->u.w, JIT_FP, u);
}
void
_jit_putargi_d(jit_state_t *_jit, jit_float64_t u, jit_node_t *v)
{
jit_int32_t regno;
assert(v->code == jit_code_arg_d);
if (v->u.w < 13)
jit_movi_d(JIT_FA0 - v->u.w, u);
else {
regno = jit_get_reg(jit_class_fpr);
jit_movi_d(regno, u);
jit_stxi_d(v->u.w, JIT_FP, regno);
jit_unget_reg(regno);
}
}
void
_jit_pushargr(jit_state_t *_jit, jit_int32_t u)
{