1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-02 13:00: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

@ -1,3 +1,11 @@
2012-12-04 Paulo Andrade <pcpa@gnu.org>
* 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.
2012-12-03 Paulo Andrade <pcpa@gnu.org> 2012-12-03 Paulo Andrade <pcpa@gnu.org>
* configure.ac, include/lightning/jit_private.h, lib/jit_arm-cpu.c, * configure.ac, include/lightning/jit_private.h, lib/jit_arm-cpu.c,

View file

@ -33,8 +33,8 @@ typedef enum {
#define jit_r(i) (_V0 + (i)) #define jit_r(i) (_V0 + (i))
#define jit_r_num() 12 #define jit_r_num() 12
#define jit_v(i) (_S0 + (i)) #define jit_v(i) (_S0 + (i))
#define jit_r_num() 8 #define jit_v_num() 8
#define jit_arg_reg_p(i) ((i) >= 0 && (i) < 4) #define jit_arg_f_reg_p(i) ((i) >= 0 && (i) < 4)
#define jit_f(i) (_F0 + (i)) #define jit_f(i) (_F0 + (i))
#define jit_f_num() 14 #define jit_f_num() 14
_AT, _AT,

View file

@ -109,7 +109,7 @@ jit_get_cpu(void)
void void
_jit_init(jit_state_t *_jit) _jit_init(jit_state_t *_jit)
{ {
_jit->reglen = esize(_rvs) - 1; _jit->reglen = jit_size(_rvs) - 1;
jit_carry = _NOREG; jit_carry = _NOREG;
} }
@ -248,7 +248,7 @@ _jit_arg(jit_state_t *_jit)
return (offset); return (offset);
} }
ebool_t jit_bool_t
_jit_arg_reg_p(jit_state_t *_jit, jit_int32_t offset) _jit_arg_reg_p(jit_state_t *_jit, jit_int32_t offset)
{ {
return (offset >= 0 && offset < 4); return (offset >= 0 && offset < 4);
@ -277,7 +277,7 @@ _jit_arg_f(jit_state_t *_jit)
return (offset); return (offset);
} }
ebool_t jit_bool_t
_jit_arg_f_reg_p(jit_state_t *_jit, jit_int32_t offset) _jit_arg_f_reg_p(jit_state_t *_jit, jit_int32_t offset)
{ {
return (offset >= 0 && offset < 4); return (offset >= 0 && offset < 4);
@ -306,7 +306,7 @@ _jit_arg_d(jit_state_t *_jit)
return (offset); return (offset);
} }
ebool_t jit_bool_t
_jit_arg_d_reg_p(jit_state_t *_jit, jit_int32_t offset) _jit_arg_d_reg_p(jit_state_t *_jit, jit_int32_t offset)
{ {
return (jit_arg_f_reg_p(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 #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 void
_jit_pushargr(jit_state_t *_jit, jit_int32_t u) _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 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; jit_int32_t regno;
@ -463,7 +485,7 @@ _jit_pushargr_d(jit_state_t *_jit, jit_int32_t u)
} }
void 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; jit_int32_t regno;
@ -622,12 +644,12 @@ _jit_emit(jit_state_t *_jit)
_jit->emit = 1; _jit->emit = 1;
_jit->code_length = 16 * 1024 * 1024; _jit->code.length = 16 * 1024 * 1024;
_jit->code = mmap(NULL, _jit->code_length, _jit->code.ptr = mmap(NULL, _jit->code.length,
PROT_EXEC | PROT_READ | PROT_WRITE, PROT_EXEC | PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANON, -1, 0); MAP_PRIVATE | MAP_ANON, -1, 0);
assert(_jit->code != MAP_FAILED); assert(_jit->code.ptr != MAP_FAILED);
_jit->pc.uc = _jit->code; _jit->pc.uc = _jit->code.ptr;
/* clear jit_flag_patch from label nodes if reallocating buffer /* clear jit_flag_patch from label nodes if reallocating buffer
* and starting over * and starting over
@ -1155,11 +1177,11 @@ _jit_emit(jit_state_t *_jit)
for (offset = 0; offset < _jit->patches.offset; offset++) { for (offset = 0; offset < _jit->patches.offset; offset++) {
node = _jit->patches.ptr[offset].node; node = _jit->patches.ptr[offset].node;
word = node->code == jit_code_movi ? node->v.n->u.w : node->u.n->u.w; 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__) #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 #endif
return (_jit->code.ptr); return (_jit->code.ptr);

View file

@ -111,7 +111,7 @@ jit_get_cpu(void)
void void
_jit_init(jit_state_t *_jit) _jit_init(jit_state_t *_jit)
{ {
_jit->reglen = esize(_rvs) - 1; _jit->reglen = jit_size(_rvs) - 1;
} }
void void
@ -245,7 +245,7 @@ _jit_arg(jit_state_t *_jit)
return (offset); return (offset);
} }
ebool_t jit_bool_t
_jit_arg_reg_p(jit_state_t *_jit, jit_int32_t offset) _jit_arg_reg_p(jit_state_t *_jit, jit_int32_t offset)
{ {
return (offset >= 0 && offset < 8); return (offset >= 0 && offset < 8);
@ -257,7 +257,7 @@ _jit_arg_f(jit_state_t *_jit)
return (jit_arg_d()); return (jit_arg_d());
} }
ebool_t jit_bool_t
_jit_arg_f_reg_p(jit_state_t *_jit, jit_int32_t offset) _jit_arg_f_reg_p(jit_state_t *_jit, jit_int32_t offset)
{ {
return (jit_arg_d_reg_p(offset)); return (jit_arg_d_reg_p(offset));
@ -275,7 +275,7 @@ _jit_arg_d(jit_state_t *_jit)
return (offset); return (offset);
} }
ebool_t jit_bool_t
_jit_arg_d_reg_p(jit_state_t *_jit, jit_int32_t offset) _jit_arg_d_reg_p(jit_state_t *_jit, jit_int32_t offset)
{ {
return (offset >= 0 && offset < 8); return (offset >= 0 && offset < 8);
@ -400,7 +400,7 @@ _jit_pushargr_f(jit_state_t *_jit, jit_int32_t u)
} }
void void
_jit_pushargi_f(jit_state_t *_jit, efloat32_t u) _jit_pushargi_f(jit_state_t *_jit, jit_float32_t u)
{ {
jit_pushargi_d(u); jit_pushargi_d(u);
} }
@ -420,7 +420,7 @@ _jit_pushargr_d(jit_state_t *_jit, jit_int32_t u)
} }
void 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; jit_int32_t regno;
@ -569,12 +569,12 @@ _jit_emit(jit_state_t *_jit)
_jit->emit = 1; _jit->emit = 1;
_jit->code_length = 16 * 1024 * 1024; _jit->code.length = 16 * 1024 * 1024;
_jit->code = mmap(NULL, _jit->code_length, _jit->code.ptr = mmap(NULL, _jit->code.length,
PROT_EXEC | PROT_READ | PROT_WRITE, PROT_EXEC | PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANON, -1, 0); MAP_PRIVATE | MAP_ANON, -1, 0);
assert(_jit->code != MAP_FAILED); assert(_jit->code.ptr != MAP_FAILED);
_jit->pc.uc = _jit->code; _jit->pc.uc = _jit->code.ptr;
/* clear jit_flag_patch from label nodes if reallocating buffer /* clear jit_flag_patch from label nodes if reallocating buffer
* and starting over * and starting over
@ -1030,7 +1030,7 @@ _jit_emit(jit_state_t *_jit)
} }
node = undo.node; node = undo.node;
_jit->pc.w = undo.word; _jit->pc.w = undo.word;
_jit->patches->offset = undo.patch_offset; _jit->patches.offset = undo.patch_offset;
goto restart_function; goto restart_function;
} }
/* remember label is defined */ /* remember label is defined */
@ -1057,10 +1057,10 @@ _jit_emit(jit_state_t *_jit)
#undef case_rw #undef case_rw
#undef case_rr #undef case_rr
for (offset = 0; offset < _jit->patches->offset; offset++) { for (offset = 0; offset < _jit->patches.offset; offset++) {
node = _jit->patches.ptr[offset].node; node = _jit->patches.ptr[offset].node;
word = node->code == jit_code_movi ? node->v.n->u.w : node->u.n->u.w; 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);
} }
return (_jit->code.ptr); return (_jit->code.ptr);