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

Make mips backend compile on a qemu image.

* include/lightning/jit_mips.h, lib/jit_mips.c: Update to
	make the mips backend compile in a qemu image.

	* lib/jit_ppc.c: Minor adaptations to help in having the
	ppc backend compilable.
This commit is contained in:
pcpa 2012-12-04 00:27:44 -02:00
parent 1c9088beca
commit 01be83d480
4 changed files with 61 additions and 31 deletions

View file

@ -109,7 +109,7 @@ jit_get_cpu(void)
void
_jit_init(jit_state_t *_jit)
{
_jit->reglen = esize(_rvs) - 1;
_jit->reglen = jit_size(_rvs) - 1;
jit_carry = _NOREG;
}
@ -248,7 +248,7 @@ _jit_arg(jit_state_t *_jit)
return (offset);
}
ebool_t
jit_bool_t
_jit_arg_reg_p(jit_state_t *_jit, jit_int32_t offset)
{
return (offset >= 0 && offset < 4);
@ -277,7 +277,7 @@ _jit_arg_f(jit_state_t *_jit)
return (offset);
}
ebool_t
jit_bool_t
_jit_arg_f_reg_p(jit_state_t *_jit, jit_int32_t offset)
{
return (offset >= 0 && offset < 4);
@ -306,7 +306,7 @@ _jit_arg_d(jit_state_t *_jit)
return (offset);
}
ebool_t
jit_bool_t
_jit_arg_d_reg_p(jit_state_t *_jit, jit_int32_t offset)
{
return (jit_arg_f_reg_p(offset));
@ -382,6 +382,28 @@ _jit_getarg_l(jit_state_t *_jit, jit_int32_t u, jit_int32_t v)
}
#endif
void
_jit_getarg_f(jit_state_t *_jit, jit_int32_t u, jit_int32_t v)
{
if (v < 4)
jit_extr_f(u, _A0 - v);
else if (v < 8)
jit_movr_f(u, _F12 + ((v - 4) >> 1));
else
jit_ldxi_f(u, _FP, v);
}
void
_jit_getarg_d(jit_state_t *_jit, jit_int32_t u, jit_int32_t v)
{
if (v < 4)
jit_extr_d(u, _A0 - v);
else if (v < 8)
jit_movr_d(u, _F12 + ((v - 4) >> 1));
else
jit_ldxi_d(u, _FP, v);
}
void
_jit_pushargr(jit_state_t *_jit, jit_int32_t u)
{
@ -429,7 +451,7 @@ _jit_pushargr_f(jit_state_t *_jit, jit_int32_t u)
}
void
_jit_pushargi_f(jit_state_t *_jit, efloat32_t u)
_jit_pushargi_f(jit_state_t *_jit, jit_float32_t u)
{
jit_int32_t regno;
@ -463,7 +485,7 @@ _jit_pushargr_d(jit_state_t *_jit, jit_int32_t u)
}
void
_jit_pushargi_d(jit_state_t *_jit, efloat64_t u)
_jit_pushargi_d(jit_state_t *_jit, jit_float64_t u)
{
jit_int32_t regno;
@ -622,12 +644,12 @@ _jit_emit(jit_state_t *_jit)
_jit->emit = 1;
_jit->code_length = 16 * 1024 * 1024;
_jit->code = mmap(NULL, _jit->code_length,
PROT_EXEC | PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANON, -1, 0);
assert(_jit->code != MAP_FAILED);
_jit->pc.uc = _jit->code;
_jit->code.length = 16 * 1024 * 1024;
_jit->code.ptr = mmap(NULL, _jit->code.length,
PROT_EXEC | PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANON, -1, 0);
assert(_jit->code.ptr != MAP_FAILED);
_jit->pc.uc = _jit->code.ptr;
/* clear jit_flag_patch from label nodes if reallocating buffer
* and starting over
@ -1155,11 +1177,11 @@ _jit_emit(jit_state_t *_jit)
for (offset = 0; offset < _jit->patches.offset; offset++) {
node = _jit->patches.ptr[offset].node;
word = node->code == jit_code_movi ? node->v.n->u.w : node->u.n->u.w;
patch_at(_jit->patches.ptr[offset].instr, word);
patch_at(_jit->patches.ptr[offset].inst, word);
}
#if defined(__linux__)
_flush_cache((char *)_jit->code, _jit->pc.uc - _jit->code.ptr, ICACHE);
_flush_cache((char *)_jit->code.ptr, _jit->pc.uc - _jit->code.ptr, ICACHE);
#endif
return (_jit->code.ptr);