mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-04 22:40:25 +02:00
Remove inconsistent, public jit_arg_reg_p macro
* include/lightning/jit_aarch64.h, include/lightning/jit_alpha.h, include/lightning/jit_arm.h, include/lightning/jit_hppa.h, include/lightning/jit_mips.h, include/lightning/jit_ppc.h, include/lightning/jit_s390.h, include/lightning/jit_sparc.h, include/lightning/jit_x86.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: Remove jit_arg_reg_p and jit_arg_f_reg_p from a public header, and define it only on port specific files where an integer offset is used to qualify an argument identifier. Exported code expects an opaque pointer (but of jit_node_t* type) to "qualify" an argument identifier. This patch, and the code review/simplification done during it also corrected some bugs: o Inconsistent jit_arg_d value of double argument after 3 integer arguments in arm for jit_functions; tested, C functions were being properly called. o Inconsistent use of getarg_{f,d} and putarg*_{f,d} on s390 (32-bit) that happened to not have a proper test case, as it would only happen for jit functions, and tested, called C functions had proper arguments. o Corrected a "last minute" correction that did not go to the committed version, and would not compile on hppa, due to bad _jit_putargi_d prototype definition.
This commit is contained in:
parent
3695a2e99c
commit
73e520767f
20 changed files with 404 additions and 709 deletions
34
ChangeLog
34
ChangeLog
|
@ -1,3 +1,37 @@
|
|||
2015-01-17 Paulo Andrade <pcpa@gnu.org>
|
||||
|
||||
* include/lightning/jit_aarch64.h,
|
||||
include/lightning/jit_alpha.h,
|
||||
include/lightning/jit_arm.h,
|
||||
include/lightning/jit_hppa.h,
|
||||
include/lightning/jit_mips.h,
|
||||
include/lightning/jit_ppc.h,
|
||||
include/lightning/jit_s390.h,
|
||||
include/lightning/jit_sparc.h,
|
||||
include/lightning/jit_x86.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: Remove jit_arg_reg_p and
|
||||
jit_arg_f_reg_p from a public header, and define it only
|
||||
on port specific files where an integer offset is used
|
||||
to qualify an argument identifier. Exported code expects
|
||||
an opaque pointer (but of jit_node_t* type) to "qualify"
|
||||
an argument identifier.
|
||||
This patch, and the code review/simplification done during
|
||||
it also corrected some bugs:
|
||||
o Inconsistent jit_arg_d value of double argument after 3
|
||||
integer arguments in arm for jit_functions; tested, C
|
||||
functions were being properly called.
|
||||
o Inconsistent use of getarg_{f,d} and putarg*_{f,d} on
|
||||
s390 (32-bit) that happened to not have a proper test
|
||||
case, as it would only happen for jit functions, and
|
||||
tested, called C functions had proper arguments.
|
||||
o Corrected a "last minute" correction that did not go
|
||||
to the committed version, and would not compile on hppa,
|
||||
due to bad _jit_putargi_d prototype definition.
|
||||
|
||||
2015-01-17 Paulo Andrade <pcpa@gnu.org>
|
||||
|
||||
* doc/body.texi: Correct wrong/outdated information for
|
||||
|
|
|
@ -28,12 +28,10 @@
|
|||
*/
|
||||
#define JIT_FP _R29
|
||||
typedef enum {
|
||||
#define jit_arg_reg_p(i) ((i) >= 0 && (i) < 8)
|
||||
#define jit_r(i) (_R9 + (i))
|
||||
#define jit_r_num() 7
|
||||
#define jit_v(i) (_R19 + (i))
|
||||
#define jit_v_num() 10
|
||||
#define jit_arg_f_reg_p(i) ((i) >= 0 && (i) < 8)
|
||||
#define jit_f(i) (_V8 + (i))
|
||||
#define jit_f_num() 8
|
||||
#define JIT_R0 _R9
|
||||
|
|
|
@ -28,12 +28,10 @@
|
|||
*/
|
||||
#define JIT_FP _FP
|
||||
typedef enum {
|
||||
#define jit_arg_reg_p(i) ((i) >= 0 && (i) < 6)
|
||||
#define jit_r(i) (_S0 + (i))
|
||||
#define jit_r_num() 3
|
||||
#define jit_v(i) (_S3 + (i))
|
||||
#define jit_v_num() 3
|
||||
#define jit_arg_f_reg_p(i) ((i) >= 0 && (i) < 6)
|
||||
#define jit_f(i) (_F2 + (i))
|
||||
#define jit_f_num() 8
|
||||
/* Volatile - Assembly temporary register */
|
||||
|
|
|
@ -32,12 +32,10 @@
|
|||
|
||||
#define JIT_FP _R11
|
||||
typedef enum {
|
||||
#define jit_arg_reg_p(i) ((i) >= 0 && (i) < 4)
|
||||
#define jit_r(i) (_R4 + (i))
|
||||
#define jit_r_num() 3
|
||||
#define jit_v(i) (_R7 + (i))
|
||||
#define jit_v_num() 3
|
||||
#define jit_arg_f_reg_p(i) ((i) >= 0 && (i) < 4)
|
||||
#define jit_f(i) (jit_cpu.abi ? _D8 + ((i)<<1) : _D0 - ((i)<<1))
|
||||
#define jit_f_num() 8
|
||||
_R12, /* ip - temporary */
|
||||
|
|
|
@ -27,8 +27,6 @@
|
|||
* Types
|
||||
*/
|
||||
typedef enum {
|
||||
#define jit_arg_reg_p(i) (i >= 0 && i <= 4)
|
||||
#define jit_arg_f_reg_p(i) (i >= 0 && i <= 4)
|
||||
_R0, /* Always zero */
|
||||
_R1, /* ADDIL implicit target */
|
||||
_R2, /* B,L implicit target */
|
||||
|
|
|
@ -34,15 +34,12 @@
|
|||
typedef enum {
|
||||
#define jit_r(i) (_V0 + (i))
|
||||
#if NEW_ABI
|
||||
# define jit_arg_reg_p(i) ((i) >= 0 && (i) < 4)
|
||||
# define jit_r_num() 7
|
||||
#else
|
||||
# define jit_arg_reg_p(i) ((i) >= 0 && (i) < 4)
|
||||
# define jit_r_num() 11
|
||||
#endif
|
||||
#define jit_v(i) (_S0 + (i))
|
||||
#define jit_v_num() 8
|
||||
#define jit_arg_f_reg_p(i) ((i) >= 0 && (i) < 4)
|
||||
#define jit_f(i) (_F0 + (i))
|
||||
#if NEW_ABI
|
||||
# define jit_f_num() 6
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
* Types
|
||||
*/
|
||||
typedef enum {
|
||||
#define jit_arg_reg_p(i) ((i) >= 0 && (i) < 8)
|
||||
#if __ppc__
|
||||
# define jit_r(i) (_R11 + (i))
|
||||
#else
|
||||
|
@ -48,7 +47,6 @@ typedef enum {
|
|||
# define jit_v(i) (_R27 - (i))
|
||||
# define jit_v_num() 14
|
||||
#endif
|
||||
#define jit_arg_f_reg_p(i) ((i) >= 0 && (i) < 13)
|
||||
#define jit_f(i) (_F14 + (i))
|
||||
#define jit_f_num() 8
|
||||
_R0,
|
||||
|
|
|
@ -28,16 +28,10 @@
|
|||
*/
|
||||
#define JIT_FP _R13
|
||||
typedef enum {
|
||||
#define jit_arg_reg_p(i) ((i) >= 0 && (i) <= 5)
|
||||
#define jit_r(i) (_R12 + ((i) << 1))
|
||||
#define jit_r_num() 3
|
||||
#define jit_v(i) (_R11 + ((i) << 1))
|
||||
#define jit_v_num() 3
|
||||
#if __WORDSIZE == 32
|
||||
# define jit_arg_f_reg_p(i) ((i) >= 0 && (i) <= 2)
|
||||
#else
|
||||
# define jit_arg_f_reg_p(i) ((i) >= 0 && (i) <= 4)
|
||||
#endif
|
||||
#define jit_f(i) (_F8 + (i))
|
||||
#define jit_f_num() 6
|
||||
#define JIT_R0 _R12
|
||||
|
|
|
@ -28,12 +28,10 @@
|
|||
*/
|
||||
#define JIT_FP _FP
|
||||
typedef enum {
|
||||
#define jit_arg_reg_p(i) ((i) >= 0 && (i) < 6)
|
||||
#define jit_r(i) (_G2 + (i))
|
||||
#define jit_r_num() 3
|
||||
#define jit_v(i) (_L0 + (i))
|
||||
#define jit_v_num() 8
|
||||
#define jit_arg_f_reg_p(i) ((i) >= 0 && (i) < 6)
|
||||
#define jit_f(i) (_F0 + ((i) << 1))
|
||||
#define jit_f_num() 8
|
||||
#define JIT_R0 _G2
|
||||
|
|
|
@ -42,12 +42,10 @@
|
|||
#define JIT_FP _RBP
|
||||
typedef enum {
|
||||
#if __X32
|
||||
# define jit_arg_reg_p(i) 0
|
||||
# define jit_r(i) (_RAX + (i))
|
||||
# define jit_r_num() 3
|
||||
# define jit_v(i) (_RBX + (i))
|
||||
# define jit_v_num() 3
|
||||
# define jit_arg_f_reg_p(i) 0
|
||||
# define jit_f(i) (jit_cpu.sse2 ? _XMM0 + (i) : _ST0 + (i))
|
||||
# define jit_f_num() (jit_cpu.sse2 ? 8 : 6)
|
||||
# define JIT_R0 _RAX
|
||||
|
@ -71,12 +69,10 @@ typedef enum {
|
|||
# define jit_sse_reg_p(reg) ((reg) >= _XMM0 && (reg) <= _XMM7)
|
||||
#else
|
||||
# if __CYGWIN__
|
||||
# define jit_arg_reg_p(i) ((i) >= 0 && (i) < 4)
|
||||
# define jit_r(i) (_RAX + (i))
|
||||
# define jit_r_num() 3
|
||||
# define jit_v(i) (_RBX + (i))
|
||||
# define jit_v_num() 7
|
||||
# define jit_arg_f_reg_p(i) jit_arg_reg_p(i)
|
||||
# define jit_f(index) (_XMM4 + (index))
|
||||
# define jit_f_num() 12
|
||||
# define JIT_R0 _RAX
|
||||
|
@ -121,12 +117,10 @@ typedef enum {
|
|||
_XMM3, _XMM2, _XMM1, _XMM0,
|
||||
# define jit_sse_reg_p(reg) ((reg) >= _XMM4 && (reg) <= _XMM0)
|
||||
# else
|
||||
# define jit_arg_reg_p(i) ((i) >= 0 && (i) < 6)
|
||||
# define jit_r(i) (_RAX + (i))
|
||||
# define jit_r_num() 4
|
||||
# define jit_v(i) (_RBX + (i))
|
||||
# define jit_v_num() 4
|
||||
# define jit_arg_f_reg_p(i) ((i) >= 0 && (i) < 8)
|
||||
# define jit_f(index) (_XMM8 + (index))
|
||||
# define jit_f_num() 8
|
||||
# define JIT_R0 _RAX
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
#define rc(value) jit_class_##value
|
||||
#define rn(reg) (jit_regno(_rvs[jit_regno(reg)].spec))
|
||||
#define jit_arg_reg_p(i) ((i) >= 0 && (i) < 8)
|
||||
#define jit_arg_f_reg_p(i) ((i) >= 0 && (i) < 8)
|
||||
|
||||
/*
|
||||
* Prototypes
|
||||
|
@ -248,7 +250,7 @@ _jit_arg(jit_state_t *_jit)
|
|||
{
|
||||
jit_int32_t offset;
|
||||
assert(_jitc->function);
|
||||
if (_jitc->function->self.argi < 8)
|
||||
if (jit_arg_reg_p(_jitc->function->self.argi))
|
||||
offset = _jitc->function->self.argi++;
|
||||
else {
|
||||
offset = _jitc->function->self.size;
|
||||
|
@ -257,18 +259,12 @@ _jit_arg(jit_state_t *_jit)
|
|||
return (jit_new_node_w(jit_code_arg, offset));
|
||||
}
|
||||
|
||||
jit_bool_t
|
||||
_jit_arg_reg_p(jit_state_t *_jit, jit_int32_t offset)
|
||||
{
|
||||
return (offset >= 0 && offset < 8);
|
||||
}
|
||||
|
||||
jit_node_t *
|
||||
_jit_arg_f(jit_state_t *_jit)
|
||||
{
|
||||
jit_int32_t offset;
|
||||
assert(_jitc->function);
|
||||
if (_jitc->function->self.argf < 8)
|
||||
if (jit_arg_f_reg_p(_jitc->function->self.argf))
|
||||
offset = _jitc->function->self.argf++;
|
||||
else {
|
||||
offset = _jitc->function->self.size;
|
||||
|
@ -277,18 +273,12 @@ _jit_arg_f(jit_state_t *_jit)
|
|||
return (jit_new_node_w(jit_code_arg_f, offset));
|
||||
}
|
||||
|
||||
jit_bool_t
|
||||
_jit_arg_f_reg_p(jit_state_t *_jit, jit_int32_t offset)
|
||||
{
|
||||
return (jit_arg_reg_p(offset));
|
||||
}
|
||||
|
||||
jit_node_t *
|
||||
_jit_arg_d(jit_state_t *_jit)
|
||||
{
|
||||
jit_int32_t offset;
|
||||
assert(_jitc->function);
|
||||
if (_jitc->function->self.argf < 8)
|
||||
if (jit_arg_f_reg_p(_jitc->function->self.argf))
|
||||
offset = _jitc->function->self.argf++;
|
||||
else {
|
||||
offset = _jitc->function->self.size;
|
||||
|
@ -297,17 +287,11 @@ _jit_arg_d(jit_state_t *_jit)
|
|||
return (jit_new_node_w(jit_code_arg_d, offset));
|
||||
}
|
||||
|
||||
jit_bool_t
|
||||
_jit_arg_d_reg_p(jit_state_t *_jit, jit_int32_t offset)
|
||||
{
|
||||
return (jit_arg_reg_p(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)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_extr_c(u, JIT_RA0 - v->u.w);
|
||||
else
|
||||
jit_ldxi_c(u, JIT_FP, v->u.w);
|
||||
|
@ -317,7 +301,7 @@ 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)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_extr_uc(u, JIT_RA0 - v->u.w);
|
||||
else
|
||||
jit_ldxi_uc(u, JIT_FP, v->u.w);
|
||||
|
@ -327,7 +311,7 @@ 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)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_extr_s(u, JIT_RA0 - v->u.w);
|
||||
else
|
||||
jit_ldxi_s(u, JIT_FP, v->u.w);
|
||||
|
@ -337,7 +321,7 @@ 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)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_extr_us(u, JIT_RA0 - v->u.w);
|
||||
else
|
||||
jit_ldxi_us(u, JIT_FP, v->u.w);
|
||||
|
@ -347,7 +331,7 @@ 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 (jit_arg_reg_p(v->u.w))
|
||||
jit_extr_i(u, JIT_RA0 - v->u.w);
|
||||
else
|
||||
jit_ldxi_i(u, JIT_FP, v->u.w);
|
||||
|
@ -357,7 +341,7 @@ 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)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_extr_ui(u, JIT_RA0 - v->u.w);
|
||||
else
|
||||
jit_ldxi_ui(u, JIT_FP, v->u.w);
|
||||
|
@ -367,7 +351,7 @@ 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)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_movr(u, JIT_RA0 - v->u.w);
|
||||
else
|
||||
jit_ldxi_l(u, JIT_FP, v->u.w);
|
||||
|
@ -377,7 +361,7 @@ 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)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_movr(JIT_RA0 - v->u.w, u);
|
||||
else
|
||||
jit_stxi(v->u.w, JIT_FP, u);
|
||||
|
@ -388,7 +372,7 @@ _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)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_movi(JIT_RA0 - v->u.w, u);
|
||||
else {
|
||||
regno = jit_get_reg(jit_class_gpr);
|
||||
|
@ -402,7 +386,7 @@ 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 < 8)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_movr_f(u, JIT_FA0 - v->u.w);
|
||||
else
|
||||
jit_ldxi_f(u, JIT_FP, v->u.w);
|
||||
|
@ -412,7 +396,7 @@ 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 < 8)
|
||||
if (jit_arg_f_reg_p(v->u.w))
|
||||
jit_movr_f(JIT_FA0 - v->u.w, u);
|
||||
else
|
||||
jit_stxi_f(v->u.w, JIT_FP, u);
|
||||
|
@ -423,7 +407,7 @@ _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 < 8)
|
||||
if (jit_arg_f_reg_p(v->u.w))
|
||||
jit_movi_f(JIT_FA0 - v->u.w, u);
|
||||
else {
|
||||
regno = jit_get_reg(jit_class_fpr);
|
||||
|
@ -437,7 +421,7 @@ 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 < 8)
|
||||
if (jit_arg_f_reg_p(v->u.w))
|
||||
jit_movr_d(u, JIT_FA0 - v->u.w);
|
||||
else
|
||||
jit_ldxi_d(u, JIT_FP, v->u.w);
|
||||
|
@ -447,7 +431,7 @@ 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 < 8)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_movr_d(JIT_FA0 - v->u.w, u);
|
||||
else
|
||||
jit_stxi_d(v->u.w, JIT_FP, u);
|
||||
|
@ -458,7 +442,7 @@ _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 < 8)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_movi_d(JIT_FA0 - v->u.w, u);
|
||||
else {
|
||||
regno = jit_get_reg(jit_class_fpr);
|
||||
|
@ -472,7 +456,7 @@ void
|
|||
_jit_pushargr(jit_state_t *_jit, jit_int32_t u)
|
||||
{
|
||||
assert(_jitc->function);
|
||||
if (_jitc->function->call.argi < 8) {
|
||||
if (jit_arg_reg_p(_jitc->function->call.argi)) {
|
||||
jit_movr(JIT_RA0 - _jitc->function->call.argi, u);
|
||||
++_jitc->function->call.argi;
|
||||
}
|
||||
|
@ -487,7 +471,7 @@ _jit_pushargi(jit_state_t *_jit, jit_word_t u)
|
|||
{
|
||||
jit_int32_t regno;
|
||||
assert(_jitc->function);
|
||||
if (_jitc->function->call.argi < 8) {
|
||||
if (jit_arg_reg_p(_jitc->function->call.argi)) {
|
||||
jit_movi(JIT_RA0 - _jitc->function->call.argi, u);
|
||||
++_jitc->function->call.argi;
|
||||
}
|
||||
|
@ -504,7 +488,7 @@ void
|
|||
_jit_pushargr_f(jit_state_t *_jit, jit_int32_t u)
|
||||
{
|
||||
assert(_jitc->function);
|
||||
if (_jitc->function->call.argf < 8) {
|
||||
if (jit_arg_f_reg_p(_jitc->function->call.argf)) {
|
||||
jit_movr_f(JIT_FA0 - _jitc->function->call.argf, u);
|
||||
++_jitc->function->call.argf;
|
||||
}
|
||||
|
@ -519,7 +503,7 @@ _jit_pushargi_f(jit_state_t *_jit, jit_float32_t u)
|
|||
{
|
||||
jit_int32_t regno;
|
||||
assert(_jitc->function);
|
||||
if (_jitc->function->call.argf < 8) {
|
||||
if (jit_arg_f_reg_p(_jitc->function->call.argf)) {
|
||||
jit_movi_f(JIT_FA0 - _jitc->function->call.argf, u);
|
||||
++_jitc->function->call.argf;
|
||||
}
|
||||
|
@ -536,7 +520,7 @@ void
|
|||
_jit_pushargr_d(jit_state_t *_jit, jit_int32_t u)
|
||||
{
|
||||
assert(_jitc->function);
|
||||
if (_jitc->function->call.argf < 8) {
|
||||
if (jit_arg_f_reg_p(_jitc->function->call.argf)) {
|
||||
jit_movr_d(JIT_FA0 - _jitc->function->call.argf, u);
|
||||
++_jitc->function->call.argf;
|
||||
}
|
||||
|
@ -551,7 +535,7 @@ _jit_pushargi_d(jit_state_t *_jit, jit_float64_t u)
|
|||
{
|
||||
jit_int32_t regno;
|
||||
assert(_jitc->function);
|
||||
if (_jitc->function->call.argf < 8) {
|
||||
if (jit_arg_f_reg_p(_jitc->function->call.argf)) {
|
||||
jit_movi_d(JIT_FA0 - _jitc->function->call.argf, u);
|
||||
++_jitc->function->call.argf;
|
||||
}
|
||||
|
|
171
lib/jit_alpha.c
171
lib/jit_alpha.c
|
@ -19,6 +19,19 @@
|
|||
|
||||
#define rc(value) jit_class_##value
|
||||
#define rn(reg) (jit_regno(_rvs[jit_regno(reg)].spec))
|
||||
#define jit_arg_reg_p(i) ((i) >= 0 && (i) < 6)
|
||||
#define jit_arg_f_reg_p(i) ((i) >= 0 && (i) < 6)
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
# define C_DISP 0
|
||||
# define S_DISP 0
|
||||
# define I_DISP 0
|
||||
# define F_DISP 0
|
||||
#else
|
||||
# define C_DISP 8 - sizeof(jit_int8_t)
|
||||
# define S_DISP 8 - sizeof(jit_int16_t)
|
||||
# define I_DISP 8 - sizeof(jit_int32_t)
|
||||
# define F_DISP 8 - sizeof(jit_float32_t)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Prototypes
|
||||
|
@ -246,7 +259,7 @@ _jit_arg(jit_state_t *_jit)
|
|||
{
|
||||
jit_int32_t offset;
|
||||
assert(_jitc->function != NULL);
|
||||
if (_jitc->function->self.argi < 6)
|
||||
if (jit_arg_reg_p(_jitc->function->self.argi))
|
||||
offset = _jitc->function->self.argi++;
|
||||
else {
|
||||
offset = _jitc->function->self.size;
|
||||
|
@ -255,18 +268,12 @@ _jit_arg(jit_state_t *_jit)
|
|||
return (jit_new_node_w(jit_code_arg, offset));
|
||||
}
|
||||
|
||||
jit_bool_t
|
||||
_jit_arg_reg_p(jit_state_t *_jit, jit_int32_t offset)
|
||||
{
|
||||
return (offset >= 0 && offset < 6);
|
||||
}
|
||||
|
||||
jit_node_t *
|
||||
_jit_arg_f(jit_state_t *_jit)
|
||||
{
|
||||
jit_int32_t offset;
|
||||
assert(_jitc->function != NULL);
|
||||
if (_jitc->function->self.argi < 6)
|
||||
if (jit_arg_f_reg_p(_jitc->function->self.argi))
|
||||
offset = _jitc->function->self.argi++;
|
||||
else {
|
||||
offset = _jitc->function->self.size;
|
||||
|
@ -275,18 +282,12 @@ _jit_arg_f(jit_state_t *_jit)
|
|||
return (jit_new_node_w(jit_code_arg_f, offset));
|
||||
}
|
||||
|
||||
jit_bool_t
|
||||
_jit_arg_f_reg_p(jit_state_t *_jit, jit_int32_t offset)
|
||||
{
|
||||
return (offset >= 0 && offset < 6);
|
||||
}
|
||||
|
||||
jit_node_t *
|
||||
_jit_arg_d(jit_state_t *_jit)
|
||||
{
|
||||
jit_int32_t offset;
|
||||
assert(_jitc->function != NULL);
|
||||
if (_jitc->function->self.argi < 6)
|
||||
if (jit_arg_f_reg_p(_jitc->function->self.argi))
|
||||
offset = _jitc->function->self.argi++;
|
||||
else {
|
||||
offset = _jitc->function->self.size;
|
||||
|
@ -295,107 +296,71 @@ _jit_arg_d(jit_state_t *_jit)
|
|||
return (jit_new_node_w(jit_code_arg_d, offset));
|
||||
}
|
||||
|
||||
jit_bool_t
|
||||
_jit_arg_d_reg_p(jit_state_t *_jit, jit_int32_t offset)
|
||||
{
|
||||
return (jit_arg_f_reg_p(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 < 6)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_extr_c(u, _A0 - v->u.w);
|
||||
else {
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
jit_ldxi_c(u, _FP, v->u.w);
|
||||
#else
|
||||
jit_ldxi_c(u, JIT_FP, v->u.w + 8 - sizeof(jit_int8_t));
|
||||
#endif
|
||||
}
|
||||
else
|
||||
jit_ldxi_c(u, _FP, v->u.w + C_DISP);
|
||||
}
|
||||
|
||||
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 < 6)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_extr_uc(u, _A0 - v->u.w);
|
||||
else {
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
jit_ldxi_uc(u, _FP, v->u.w);
|
||||
#else
|
||||
jit_ldxi_uc(u, JIT_FP, v->u.w + 8 - sizeof(jit_uint8_t));
|
||||
#endif
|
||||
}
|
||||
else
|
||||
jit_ldxi_uc(u, _FP, v->u.w + C_DISP);
|
||||
}
|
||||
|
||||
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 < 6)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_extr_s(u, _A0 - v->u.w);
|
||||
else {
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
jit_ldxi_s(u, _FP, v->u.w);
|
||||
#else
|
||||
jit_ldxi_s(u, JIT_FP, v->u.w + 8 - sizeof(jit_int16_t));
|
||||
#endif
|
||||
}
|
||||
else
|
||||
jit_ldxi_s(u, _FP, v->u.w + S_DISP);
|
||||
}
|
||||
|
||||
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 < 6)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_extr_us(u, _A0 - v->u.w);
|
||||
else {
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
jit_ldxi_us(u, _FP, v->u.w);
|
||||
#else
|
||||
jit_ldxi_us(u, JIT_FP, v->u.w + 8 - sizeof(jit_uint16_t));
|
||||
#endif
|
||||
}
|
||||
else
|
||||
jit_ldxi_us(u, _FP, v->u.w + S_DISP);
|
||||
}
|
||||
|
||||
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 < 6)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_extr_i(u, _A0 - v->u.w);
|
||||
else {
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
jit_ldxi_i(u, _FP, v->u.w);
|
||||
#else
|
||||
jit_ldxi_i(u, JIT_FP, v->u.w + 8 - sizeof(jit_int32_t));
|
||||
#endif
|
||||
}
|
||||
else
|
||||
jit_ldxi_i(u, _FP, v->u.w + I_DISP);
|
||||
}
|
||||
|
||||
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 < 6)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_extr_ui(u, _A0 - v->u.w);
|
||||
else {
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
jit_ldxi_ui(u, _FP, v->u.w);
|
||||
#else
|
||||
jit_ldxi_ui(u, JIT_FP, v->u.w + 8 - sizeof(jit_uint32_t));
|
||||
#endif
|
||||
}
|
||||
else
|
||||
jit_ldxi_ui(u, _FP, v->u.w + I_DISP);
|
||||
}
|
||||
|
||||
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 < 6)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_movr(u, _A0 - v->u.w);
|
||||
else
|
||||
jit_ldxi_l(u, _FP, v->u.w);
|
||||
|
@ -405,7 +370,7 @@ 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 < 6)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_movr(_A0 - v->u.w, u);
|
||||
else
|
||||
jit_stxi(v->u.w, _FP, u);
|
||||
|
@ -416,7 +381,7 @@ _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 < 6)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_movi(_A0 - v->u.w, u);
|
||||
else {
|
||||
regno = jit_get_reg(jit_class_gpr);
|
||||
|
@ -430,30 +395,20 @@ 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 < 6)
|
||||
if (jit_arg_f_reg_p(v->u.w))
|
||||
jit_movr_f(u, _F16 - v->u.w);
|
||||
else {
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
jit_ldxi_f(u, _FP, v->u.w);
|
||||
#else
|
||||
jit_ldxi_f(u, JIT_FP, v->u.w + 8 - sizeof(jit_float32_t));
|
||||
#endif
|
||||
}
|
||||
else
|
||||
jit_ldxi_f(u, _FP, v->u.w + F_DISP);
|
||||
}
|
||||
|
||||
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 < 6)
|
||||
if (jit_arg_f_reg_p(v->u.w))
|
||||
jit_movr_f(_F16 - v->u.w, u);
|
||||
else {
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
jit_stxi_f(v->u.w, _FP, u);
|
||||
#else
|
||||
jit_stxi_f(v->u.w + 8 - sizeof(jit_float32_t), _FP, u);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
jit_stxi_f(v->u.w, _FP, u + F_DISP);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -461,16 +416,12 @@ _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 < 6)
|
||||
if (jit_arg_f_reg_p(v->u.w))
|
||||
jit_movi_f(_F16 - v->u.w, u);
|
||||
else {
|
||||
regno = jit_get_reg(jit_class_fpr);
|
||||
jit_movi_f(regno, u);
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
jit_stxi_f(v->u.w, _FP, regno);
|
||||
#else
|
||||
jit_stxi_f(v->u.w + 8 - sizeof(jit_float32_t), _FP, regno);
|
||||
#endif
|
||||
jit_stxi_f(v->u.w, _FP, regno + F_DISP);
|
||||
jit_unget_reg(regno);
|
||||
}
|
||||
}
|
||||
|
@ -479,7 +430,7 @@ 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 < 6)
|
||||
if (jit_arg_f_reg_p(v->u.w))
|
||||
jit_movr_d(u, _F16 - v->u.w);
|
||||
else
|
||||
jit_ldxi_d(u, _FP, v->u.w);
|
||||
|
@ -489,7 +440,7 @@ 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 < 6)
|
||||
if (jit_arg_f_reg_p(v->u.w))
|
||||
jit_movr_d(_F16 - v->u.w, u);
|
||||
else
|
||||
jit_stxi_d(v->u.w, _FP, u);
|
||||
|
@ -500,7 +451,7 @@ _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 < 6)
|
||||
if (jit_arg_f_reg_p(v->u.w))
|
||||
jit_movi_d(_F16 - v->u.w, u);
|
||||
else {
|
||||
regno = jit_get_reg(jit_class_fpr);
|
||||
|
@ -514,7 +465,7 @@ void
|
|||
_jit_pushargr(jit_state_t *_jit, jit_int32_t u)
|
||||
{
|
||||
assert(_jitc->function != NULL);
|
||||
if (_jitc->function->call.argi < 6) {
|
||||
if (jit_arg_reg_p(_jitc->function->call.argi)) {
|
||||
jit_movr(_A0 - _jitc->function->call.argi, u);
|
||||
++_jitc->function->call.argi;
|
||||
}
|
||||
|
@ -529,7 +480,7 @@ _jit_pushargi(jit_state_t *_jit, jit_int64_t u)
|
|||
{
|
||||
jit_int32_t regno;
|
||||
assert(_jitc->function != NULL);
|
||||
if (_jitc->function->call.argi < 6) {
|
||||
if (jit_arg_reg_p(_jitc->function->call.argi)) {
|
||||
jit_movi(_A0 - _jitc->function->call.argi, u);
|
||||
++_jitc->function->call.argi;
|
||||
}
|
||||
|
@ -546,17 +497,12 @@ void
|
|||
_jit_pushargr_f(jit_state_t *_jit, jit_int32_t u)
|
||||
{
|
||||
assert(_jitc->function != NULL);
|
||||
if (_jitc->function->call.argi < 6) {
|
||||
if (jit_arg_f_reg_p(_jitc->function->call.argi)) {
|
||||
jit_movr_f(_F16 - _jitc->function->call.argi, u);
|
||||
++_jitc->function->call.argi;
|
||||
}
|
||||
else {
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
jit_stxi_f(_jitc->function->call.size, JIT_SP, u);
|
||||
#else
|
||||
jit_stxi_f(_jitc->function->call.size + 8 - sizeof(jit_float32_t),
|
||||
JIT_SP, u);
|
||||
#endif
|
||||
jit_stxi_f(_jitc->function->call.size + F_DISP, JIT_SP, u);
|
||||
_jitc->function->call.size += 8;
|
||||
}
|
||||
}
|
||||
|
@ -566,19 +512,14 @@ _jit_pushargi_f(jit_state_t *_jit, jit_float32_t u)
|
|||
{
|
||||
jit_int32_t regno;
|
||||
assert(_jitc->function != NULL);
|
||||
if (_jitc->function->call.argi < 6) {
|
||||
if (jit_arg_f_reg_p(_jitc->function->call.argi)) {
|
||||
jit_movi_f(_F16 - _jitc->function->call.argi, u);
|
||||
++_jitc->function->call.argi;
|
||||
}
|
||||
else {
|
||||
regno = jit_get_reg(jit_class_fpr);
|
||||
jit_movi_f(regno, u);
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
jit_stxi_f(_jitc->function->call.size, JIT_SP, regno);
|
||||
#else
|
||||
jit_stxi_f(_jitc->function->call.size + 8 - sizeof(jit_float32_t),
|
||||
JIT_SP, regno);
|
||||
#endif
|
||||
jit_stxi_f(_jitc->function->call.size + F_DISP, JIT_SP, regno);
|
||||
_jitc->function->call.size += 8;
|
||||
jit_unget_reg(regno);
|
||||
}
|
||||
|
@ -588,7 +529,7 @@ void
|
|||
_jit_pushargr_d(jit_state_t *_jit, jit_int32_t u)
|
||||
{
|
||||
assert(_jitc->function != NULL);
|
||||
if (_jitc->function->call.argi < 6) {
|
||||
if (jit_arg_f_reg_p(_jitc->function->call.argi)) {
|
||||
jit_movr_d(_F16 - _jitc->function->call.argi, u);
|
||||
++_jitc->function->call.argi;
|
||||
}
|
||||
|
@ -603,7 +544,7 @@ _jit_pushargi_d(jit_state_t *_jit, jit_float64_t u)
|
|||
{
|
||||
jit_int32_t regno;
|
||||
assert(_jitc->function != NULL);
|
||||
if (_jitc->function->call.argi < 6) {
|
||||
if (jit_arg_f_reg_p(_jitc->function->call.argi)) {
|
||||
jit_movi_d(_F16 - _jitc->function->call.argi, u);
|
||||
++_jitc->function->call.argi;
|
||||
}
|
||||
|
|
|
@ -23,6 +23,9 @@
|
|||
|
||||
#define rc(value) jit_class_##value
|
||||
#define rn(reg) (jit_regno(_rvs[jit_regno(reg)].spec))
|
||||
#define jit_arg_reg_p(i) ((i) >= 0 && (i) < 4)
|
||||
#define jit_arg_f_reg_p(i) ((i) >= 0 && (i) < 16)
|
||||
#define jit_arg_d_reg_p(i) ((i) >= 0 && (i) < 15)
|
||||
|
||||
#define arm_patch_node 0x80000000
|
||||
#define arm_patch_word 0x40000000
|
||||
|
@ -368,7 +371,7 @@ _jit_arg(jit_state_t *_jit)
|
|||
{
|
||||
jit_int32_t offset;
|
||||
assert(_jitc->function);
|
||||
if (_jitc->function->self.argi < 4)
|
||||
if (jit_arg_reg_p(_jitc->function->self.argi))
|
||||
offset = _jitc->function->self.argi++;
|
||||
else {
|
||||
offset = _jitc->function->self.size;
|
||||
|
@ -377,25 +380,19 @@ _jit_arg(jit_state_t *_jit)
|
|||
return (jit_new_node_w(jit_code_arg, offset));
|
||||
}
|
||||
|
||||
jit_bool_t
|
||||
_jit_arg_reg_p(jit_state_t *_jit, jit_int32_t offset)
|
||||
{
|
||||
return (offset >= 0 && offset < 4);
|
||||
}
|
||||
|
||||
jit_node_t *
|
||||
_jit_arg_f(jit_state_t *_jit)
|
||||
{
|
||||
jit_int32_t offset;
|
||||
assert(_jitc->function);
|
||||
if (jit_cpu.abi && !(_jitc->function->self.call & jit_call_varargs)) {
|
||||
if (_jitc->function->self.argf < 16) {
|
||||
if (jit_arg_f_reg_p(_jitc->function->self.argf)) {
|
||||
offset = _jitc->function->self.argf++;
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (_jitc->function->self.argi < 4) {
|
||||
if (jit_arg_reg_p(_jitc->function->self.argi)) {
|
||||
offset = _jitc->function->self.argi++;
|
||||
goto done;
|
||||
}
|
||||
|
@ -406,19 +403,13 @@ done:
|
|||
return (jit_new_node_w(jit_code_arg_f, offset));
|
||||
}
|
||||
|
||||
jit_bool_t
|
||||
_jit_arg_f_reg_p(jit_state_t *_jit, jit_int32_t offset)
|
||||
{
|
||||
return (jit_arg_reg_p(offset));
|
||||
}
|
||||
|
||||
jit_node_t *
|
||||
_jit_arg_d(jit_state_t *_jit)
|
||||
{
|
||||
jit_int32_t offset;
|
||||
assert(_jitc->function);
|
||||
if (jit_cpu.abi && !(_jitc->function->self.call & jit_call_varargs)) {
|
||||
if (_jitc->function->self.argf < 15) {
|
||||
if (jit_arg_d_reg_p(_jitc->function->self.argf)) {
|
||||
if (_jitc->function->self.argf & 1)
|
||||
++_jitc->function->self.argf;
|
||||
offset = _jitc->function->self.argf;
|
||||
|
@ -427,9 +418,9 @@ _jit_arg_d(jit_state_t *_jit)
|
|||
}
|
||||
}
|
||||
else {
|
||||
if (_jitc->function->self.argi < 3) {
|
||||
if (_jitc->function->self.argi & 1)
|
||||
++_jitc->function->self.argi;
|
||||
if (jit_arg_reg_p(_jitc->function->self.argi)) {
|
||||
offset = _jitc->function->self.argi;
|
||||
_jitc->function->self.argi += 2;
|
||||
goto done;
|
||||
|
@ -443,19 +434,13 @@ done:
|
|||
return (jit_new_node_w(jit_code_arg_d, offset));
|
||||
}
|
||||
|
||||
jit_bool_t
|
||||
_jit_arg_d_reg_p(jit_state_t *_jit, jit_int32_t offset)
|
||||
{
|
||||
return (jit_arg_reg_p(offset));
|
||||
}
|
||||
|
||||
void
|
||||
_jit_getarg_c(jit_state_t *_jit, jit_int32_t u, jit_node_t *v)
|
||||
{
|
||||
assert(v->code == jit_code_arg);
|
||||
if (jit_swf_p())
|
||||
jit_ldxi_c(u, JIT_FP, v->u.w < 4 ? v->u.w << 2 : v->u.w);
|
||||
else if (v->u.w < 4)
|
||||
else if (jit_arg_reg_p(v->u.w))
|
||||
jit_extr_c(u, JIT_RA0 - v->u.w);
|
||||
else
|
||||
jit_ldxi_c(u, JIT_FP, v->u.w);
|
||||
|
@ -467,7 +452,7 @@ _jit_getarg_uc(jit_state_t *_jit, jit_int32_t u, jit_node_t *v)
|
|||
assert(v->code == jit_code_arg);
|
||||
if (jit_swf_p())
|
||||
jit_ldxi_uc(u, JIT_FP, v->u.w < 4 ? v->u.w << 2 : v->u.w);
|
||||
else if (v->u.w < 4)
|
||||
else if (jit_arg_reg_p(v->u.w))
|
||||
jit_extr_uc(u, JIT_RA0 - v->u.w);
|
||||
else
|
||||
jit_ldxi_uc(u, JIT_FP, v->u.w);
|
||||
|
@ -479,7 +464,7 @@ _jit_getarg_s(jit_state_t *_jit, jit_int32_t u, jit_node_t *v)
|
|||
assert(v->code == jit_code_arg);
|
||||
if (jit_swf_p())
|
||||
jit_ldxi_s(u, JIT_FP, v->u.w < 4 ? v->u.w << 2 : v->u.w);
|
||||
else if (v->u.w < 4)
|
||||
else if (jit_arg_reg_p(v->u.w))
|
||||
jit_extr_s(u, JIT_RA0 - v->u.w);
|
||||
else
|
||||
jit_ldxi_s(u, JIT_FP, v->u.w);
|
||||
|
@ -491,7 +476,7 @@ _jit_getarg_us(jit_state_t *_jit, jit_int32_t u, jit_node_t *v)
|
|||
assert(v->code == jit_code_arg);
|
||||
if (jit_swf_p())
|
||||
jit_ldxi_us(u, JIT_FP, v->u.w < 4 ? v->u.w << 2 : v->u.w);
|
||||
else if (v->u.w < 4)
|
||||
else if (jit_arg_reg_p(v->u.w))
|
||||
jit_extr_us(u, JIT_RA0 - v->u.w);
|
||||
else
|
||||
jit_ldxi_us(u, JIT_FP, v->u.w);
|
||||
|
@ -503,7 +488,7 @@ _jit_getarg_i(jit_state_t *_jit, jit_int32_t u, jit_node_t *v)
|
|||
assert(v->code == jit_code_arg);
|
||||
if (jit_swf_p())
|
||||
jit_ldxi_i(u, JIT_FP, v->u.w < 4 ? v->u.w << 2 : v->u.w);
|
||||
else if (v->u.w < 4)
|
||||
else if (jit_arg_reg_p(v->u.w))
|
||||
jit_movr(u, JIT_RA0 - v->u.w);
|
||||
else
|
||||
jit_ldxi_i(u, JIT_FP, v->u.w);
|
||||
|
@ -515,7 +500,7 @@ _jit_putargr(jit_state_t *_jit, jit_int32_t u, jit_node_t *v)
|
|||
assert(v->code == jit_code_arg);
|
||||
if (jit_swf_p())
|
||||
jit_stxi(v->u.w < 4 ? v->u.w << 2 : v->u.w, JIT_FP, u);
|
||||
else if (v->u.w < 4)
|
||||
else if (jit_arg_reg_p(v->u.w))
|
||||
jit_movr(JIT_RA0 - v->u.w, u);
|
||||
else
|
||||
jit_stxi(v->u.w, JIT_FP, u);
|
||||
|
@ -532,7 +517,7 @@ _jit_putargi(jit_state_t *_jit, jit_word_t u, jit_node_t *v)
|
|||
jit_stxi(v->u.w < 4 ? v->u.w << 2 : v->u.w, JIT_FP, regno);
|
||||
jit_unget_reg(regno);
|
||||
}
|
||||
else if (v->u.w < 4)
|
||||
else if (jit_arg_reg_p(v->u.w))
|
||||
jit_movi(JIT_RA0 - v->u.w, u);
|
||||
else {
|
||||
regno = jit_get_reg(jit_class_gpr);
|
||||
|
@ -547,7 +532,7 @@ _jit_getarg_f(jit_state_t *_jit, jit_int32_t u, jit_node_t *v)
|
|||
{
|
||||
assert(v->code == jit_code_arg_f);
|
||||
if (jit_cpu.abi) {
|
||||
if (v->u.w < 16)
|
||||
if (jit_arg_f_reg_p(v->u.w))
|
||||
jit_movr_f(u, JIT_FA0 - v->u.w);
|
||||
else
|
||||
jit_ldxi_f(u, JIT_FP, v->u.w);
|
||||
|
@ -555,7 +540,7 @@ _jit_getarg_f(jit_state_t *_jit, jit_int32_t u, jit_node_t *v)
|
|||
else if (jit_swf_p())
|
||||
jit_ldxi_f(u, JIT_FP, v->u.w < 4 ? v->u.w << 2 : v->u.w);
|
||||
else {
|
||||
if (v->u.w < 4)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_movr_w_f(u, JIT_RA0 - v->u.w);
|
||||
else
|
||||
jit_ldxi_f(u, JIT_FP, v->u.w);
|
||||
|
@ -567,7 +552,7 @@ _jit_putargr_f(jit_state_t *_jit, jit_int32_t u, jit_node_t *v)
|
|||
{
|
||||
assert(v->code == jit_code_arg_f);
|
||||
if (jit_cpu.abi) {
|
||||
if (v->u.w < 16)
|
||||
if (jit_arg_f_reg_p(v->u.w))
|
||||
jit_movr_f(JIT_FA0 - v->u.w, u);
|
||||
else
|
||||
jit_stxi_f(v->u.w, JIT_FP, u);
|
||||
|
@ -575,7 +560,7 @@ _jit_putargr_f(jit_state_t *_jit, jit_int32_t u, jit_node_t *v)
|
|||
else if (jit_swf_p())
|
||||
jit_stxi_f(v->u.w < 4 ? v->u.w << 2 : v->u.w, JIT_FP, u);
|
||||
else {
|
||||
if (v->u.w < 4)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_movr_f_w(JIT_RA0 - v->u.w, u);
|
||||
else
|
||||
jit_stxi_f(v->u.w, JIT_FP, u);
|
||||
|
@ -588,7 +573,7 @@ _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 (jit_cpu.abi) {
|
||||
if (v->u.w < 16)
|
||||
if (jit_arg_f_reg_p(v->u.w))
|
||||
jit_movi_f(JIT_FA0 - v->u.w, u);
|
||||
else {
|
||||
regno = jit_get_reg(jit_class_fpr);
|
||||
|
@ -606,7 +591,7 @@ _jit_putargi_f(jit_state_t *_jit, jit_float32_t u, jit_node_t *v)
|
|||
else {
|
||||
regno = jit_get_reg(jit_class_fpr);
|
||||
jit_movi_f(regno, u);
|
||||
if (v->u.w < 4)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_movr_f_w(JIT_RA0 - v->u.w, regno);
|
||||
else
|
||||
jit_stxi_f(v->u.w, JIT_FP, regno);
|
||||
|
@ -619,7 +604,7 @@ _jit_getarg_d(jit_state_t *_jit, jit_int32_t u, jit_node_t *v)
|
|||
{
|
||||
assert(v->code == jit_code_arg_d);
|
||||
if (jit_cpu.abi) {
|
||||
if (v->u.w < 16)
|
||||
if (jit_arg_f_reg_p(v->u.w))
|
||||
jit_movr_d(u, JIT_FA0 - v->u.w);
|
||||
else
|
||||
jit_ldxi_d(u, JIT_FP, v->u.w);
|
||||
|
@ -627,7 +612,7 @@ _jit_getarg_d(jit_state_t *_jit, jit_int32_t u, jit_node_t *v)
|
|||
else if (jit_swf_p())
|
||||
jit_ldxi_d(u, JIT_FP, v->u.w < 4 ? v->u.w << 2 : v->u.w);
|
||||
else {
|
||||
if (v->u.w < 4)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_movr_ww_d(u, JIT_RA0 - v->u.w, JIT_RA0 - (v->u.w + 1));
|
||||
else
|
||||
jit_ldxi_d(u, JIT_FP, v->u.w);
|
||||
|
@ -639,7 +624,7 @@ _jit_putargr_d(jit_state_t *_jit, jit_int32_t u, jit_node_t *v)
|
|||
{
|
||||
assert(v->code == jit_code_arg_d);
|
||||
if (jit_cpu.abi) {
|
||||
if (v->u.w < 16)
|
||||
if (jit_arg_f_reg_p(v->u.w))
|
||||
jit_movr_d(JIT_FA0 - v->u.w, u);
|
||||
else
|
||||
jit_stxi_d(v->u.w, JIT_FP, u);
|
||||
|
@ -647,7 +632,7 @@ _jit_putargr_d(jit_state_t *_jit, jit_int32_t u, jit_node_t *v)
|
|||
else if (jit_swf_p())
|
||||
jit_stxi_d(v->u.w < 4 ? v->u.w << 2 : v->u.w, JIT_FP, u);
|
||||
else {
|
||||
if (v->u.w < 4)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_movr_d_ww(JIT_RA0 - v->u.w, JIT_RA0 - (v->u.w + 1), u);
|
||||
else
|
||||
jit_stxi_d(v->u.w, JIT_FP, u);
|
||||
|
@ -660,7 +645,7 @@ _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 (jit_cpu.abi) {
|
||||
if (v->u.w < 16)
|
||||
if (jit_arg_f_reg_p(v->u.w))
|
||||
jit_movi_d(JIT_FA0 - v->u.w, u);
|
||||
else {
|
||||
regno = jit_get_reg(jit_class_fpr);
|
||||
|
@ -678,7 +663,7 @@ _jit_putargi_d(jit_state_t *_jit, jit_float64_t u, jit_node_t *v)
|
|||
else {
|
||||
regno = jit_get_reg(jit_class_fpr);
|
||||
jit_movi_d(regno, u);
|
||||
if (v->u.w < 4)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_movr_d_ww(JIT_RA0 - v->u.w, JIT_RA0 - (v->u.w + 1), regno);
|
||||
else
|
||||
jit_stxi_d(v->u.w, JIT_FP, regno);
|
||||
|
@ -690,7 +675,7 @@ void
|
|||
_jit_pushargr(jit_state_t *_jit, jit_int32_t u)
|
||||
{
|
||||
assert(_jitc->function);
|
||||
if (_jitc->function->call.argi < 4) {
|
||||
if (jit_arg_reg_p(_jitc->function->call.argi)) {
|
||||
jit_movr(JIT_RA0 - _jitc->function->call.argi, u);
|
||||
++_jitc->function->call.argi;
|
||||
}
|
||||
|
@ -705,7 +690,7 @@ _jit_pushargi(jit_state_t *_jit, jit_word_t u)
|
|||
{
|
||||
jit_int32_t regno;
|
||||
assert(_jitc->function);
|
||||
if (_jitc->function->call.argi < 4) {
|
||||
if (jit_arg_reg_p(_jitc->function->call.argi)) {
|
||||
jit_movi(JIT_RA0 - _jitc->function->call.argi, u);
|
||||
++_jitc->function->call.argi;
|
||||
}
|
||||
|
@ -723,14 +708,14 @@ _jit_pushargr_f(jit_state_t *_jit, jit_int32_t u)
|
|||
{
|
||||
assert(_jitc->function);
|
||||
if (jit_cpu.abi && !(_jitc->function->call.call & jit_call_varargs)) {
|
||||
if (_jitc->function->call.argf < 16) {
|
||||
if (jit_arg_f_reg_p(_jitc->function->call.argf)) {
|
||||
jit_movr_f(JIT_FA0 - _jitc->function->call.argf, u);
|
||||
++_jitc->function->call.argf;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (_jitc->function->call.argi < 4) {
|
||||
if (jit_arg_reg_p(_jitc->function->call.argi)) {
|
||||
jit_movr_f_w(JIT_RA0 - _jitc->function->call.argi, u);
|
||||
++_jitc->function->call.argi;
|
||||
return;
|
||||
|
@ -746,7 +731,7 @@ _jit_pushargi_f(jit_state_t *_jit, jit_float32_t u)
|
|||
jit_int32_t regno;
|
||||
assert(_jitc->function);
|
||||
if (jit_cpu.abi && !(_jitc->function->call.call & jit_call_varargs)) {
|
||||
if (_jitc->function->call.argf < 16) {
|
||||
if (jit_arg_f_reg_p(_jitc->function->call.argf)) {
|
||||
/* cannot jit_movi_f in the argument register because
|
||||
* float arguments are packed, and that would cause
|
||||
* either an assertion in debug mode, or overwritting
|
||||
|
@ -760,7 +745,7 @@ _jit_pushargi_f(jit_state_t *_jit, jit_float32_t u)
|
|||
}
|
||||
}
|
||||
else {
|
||||
if (_jitc->function->call.argi < 4) {
|
||||
if (jit_arg_reg_p(_jitc->function->call.argi)) {
|
||||
jit_movi_f_w(JIT_RA0 - _jitc->function->call.argi, u);
|
||||
++_jitc->function->call.argi;
|
||||
return;
|
||||
|
@ -778,7 +763,7 @@ _jit_pushargr_d(jit_state_t *_jit, jit_int32_t u)
|
|||
{
|
||||
assert(_jitc->function);
|
||||
if (jit_cpu.abi && !(_jitc->function->call.call & jit_call_varargs)) {
|
||||
if (_jitc->function->call.argf < 15) {
|
||||
if (jit_arg_d_reg_p(_jitc->function->call.argf)) {
|
||||
if (_jitc->function->call.argf & 1)
|
||||
++_jitc->function->call.argf;
|
||||
jit_movr_d(JIT_FA0 - _jitc->function->call.argf, u);
|
||||
|
@ -789,7 +774,7 @@ _jit_pushargr_d(jit_state_t *_jit, jit_int32_t u)
|
|||
else {
|
||||
if (_jitc->function->call.argi & 1)
|
||||
++_jitc->function->call.argi;
|
||||
if (_jitc->function->call.argi < 4) {
|
||||
if (jit_arg_reg_p(_jitc->function->call.argi)) {
|
||||
jit_movr_d_ww(JIT_RA0 - _jitc->function->call.argi,
|
||||
JIT_RA0 - (_jitc->function->call.argi + 1),
|
||||
u);
|
||||
|
@ -809,7 +794,7 @@ _jit_pushargi_d(jit_state_t *_jit, jit_float64_t u)
|
|||
jit_int32_t regno;
|
||||
assert(_jitc->function);
|
||||
if (jit_cpu.abi && !(_jitc->function->call.call & jit_call_varargs)) {
|
||||
if (_jitc->function->call.argf < 15) {
|
||||
if (jit_arg_d_reg_p(_jitc->function->call.argf)) {
|
||||
if (_jitc->function->call.argf & 1)
|
||||
++_jitc->function->call.argf;
|
||||
jit_movi_d(JIT_FA0 - _jitc->function->call.argf, u);
|
||||
|
@ -820,7 +805,7 @@ _jit_pushargi_d(jit_state_t *_jit, jit_float64_t u)
|
|||
else {
|
||||
if (_jitc->function->call.argi & 1)
|
||||
++_jitc->function->call.argi;
|
||||
if (_jitc->function->call.argi < 4) {
|
||||
if (jit_arg_reg_p(_jitc->function->call.argi)) {
|
||||
jit_movi_d_ww(JIT_RA0 - _jitc->function->call.argi,
|
||||
JIT_RA0 - (_jitc->function->call.argi + 1),
|
||||
u);
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#define rc(value) jit_class_##value
|
||||
#define rn(reg) (jit_regno(_rvs[jit_regno(reg)].spec))
|
||||
#define jit_arg_reg_p(i) (i >= 0 && i < 4)
|
||||
|
||||
#define PROTO 1
|
||||
# include "jit_hppa-cpu.c"
|
||||
|
@ -264,7 +265,7 @@ _jit_arg(jit_state_t *_jit)
|
|||
jit_int32_t offset;
|
||||
assert(_jitc->function);
|
||||
_jitc->function->self.size -= sizeof(jit_word_t);
|
||||
if (_jitc->function->self.argi < 4)
|
||||
if (jit_arg_reg_p(_jitc->function->self.argi))
|
||||
offset = _jitc->function->self.argi++;
|
||||
else
|
||||
offset = _jitc->function->self.size;
|
||||
|
@ -277,7 +278,7 @@ _jit_arg_f(jit_state_t *_jit)
|
|||
jit_int32_t offset;
|
||||
assert(_jitc->function);
|
||||
_jitc->function->self.size -= sizeof(jit_word_t);
|
||||
if (_jitc->function->self.argi < 4)
|
||||
if (jit_arg_reg_p(_jitc->function->self.argi))
|
||||
offset = _jitc->function->self.argi++;
|
||||
else
|
||||
offset = _jitc->function->self.size;
|
||||
|
@ -294,7 +295,7 @@ _jit_arg_d(jit_state_t *_jit)
|
|||
_jitc->function->self.size -= sizeof(jit_word_t);
|
||||
}
|
||||
_jitc->function->self.size -= sizeof(jit_float64_t);
|
||||
if (_jitc->function->self.argi < 4) {
|
||||
if (jit_arg_reg_p(_jitc->function->self.argi)) {
|
||||
offset = _jitc->function->self.argi + 1;
|
||||
_jitc->function->self.argi += 2;
|
||||
}
|
||||
|
@ -307,12 +308,6 @@ _jit_arg_d(jit_state_t *_jit)
|
|||
return (jit_new_node_w(jit_code_arg_d, offset));
|
||||
}
|
||||
|
||||
jit_bool_t
|
||||
_jit_arg_d_reg_p(jit_state_t *_jit, jit_int32_t offset)
|
||||
{
|
||||
return (jit_arg_f_reg_p(offset));
|
||||
}
|
||||
|
||||
void
|
||||
_jit_getarg_c(jit_state_t *_jit, jit_int32_t u, jit_node_t *v)
|
||||
{
|
||||
|
@ -444,7 +439,7 @@ _jit_putargr_d(jit_state_t *_jit, jit_int32_t u, jit_node_t *v)
|
|||
}
|
||||
|
||||
void
|
||||
_jit_putargi_d(jit_state_t *_jit, jit_float32_t u, jit_node_t *v)
|
||||
_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);
|
||||
|
@ -463,7 +458,7 @@ _jit_pushargr(jit_state_t *_jit, jit_int32_t u)
|
|||
{
|
||||
assert(_jitc->function);
|
||||
_jitc->function->call.size -= sizeof(jit_word_t);
|
||||
if (_jitc->function->call.argi < 4) {
|
||||
if (jit_arg_reg_p(_jitc->function->call.argi)) {
|
||||
jit_movr(_R26 - _jitc->function->call.argi, u);
|
||||
++_jitc->function->call.argi;
|
||||
}
|
||||
|
@ -477,7 +472,7 @@ _jit_pushargi(jit_state_t *_jit, jit_word_t u)
|
|||
jit_int32_t regno;
|
||||
assert(_jitc->function);
|
||||
_jitc->function->call.size -= sizeof(jit_word_t);
|
||||
if (_jitc->function->call.argi < 4) {
|
||||
if (jit_arg_reg_p(_jitc->function->call.argi)) {
|
||||
jit_movi(_R26 - _jitc->function->call.argi, u);
|
||||
++_jitc->function->call.argi;
|
||||
}
|
||||
|
@ -494,7 +489,7 @@ _jit_pushargr_f(jit_state_t *_jit, jit_int32_t u)
|
|||
{
|
||||
assert(_jitc->function);
|
||||
_jitc->function->call.size -= sizeof(jit_word_t);
|
||||
if (_jitc->function->call.argi < 4) {
|
||||
if (jit_arg_reg_p(_jitc->function->call.argi)) {
|
||||
jit_movr_f(_F4 - _jitc->function->call.argi, u);
|
||||
#if !defined(__hpux)
|
||||
if (_jitc->function->call.call & jit_call_varargs)
|
||||
|
@ -516,7 +511,7 @@ _jit_pushargi_f(jit_state_t *_jit, jit_float32_t u)
|
|||
jit_int32_t regno;
|
||||
assert(_jitc->function);
|
||||
_jitc->function->call.size -= sizeof(jit_word_t);
|
||||
if (_jitc->function->call.argi < 4) {
|
||||
if (jit_arg_reg_p(_jitc->function->call.argi)) {
|
||||
jit_movi_f(_F4 - _jitc->function->call.argi, u);
|
||||
#if !defined(__hpux)
|
||||
if (_jitc->function->call.call & jit_call_varargs)
|
||||
|
@ -546,7 +541,7 @@ _jit_pushargr_d(jit_state_t *_jit, jit_int32_t u)
|
|||
++_jitc->function->call.argi;
|
||||
_jitc->function->call.size -= sizeof(jit_word_t);
|
||||
}
|
||||
if (_jitc->function->call.argi < 4) {
|
||||
if (jit_arg_reg_p(_jitc->function->call.argi)) {
|
||||
jit_movr_d(_F4 - (_jitc->function->call.argi + 1), u);
|
||||
#if !defined(__hpux)
|
||||
if (_jitc->function->call.call & jit_call_varargs)
|
||||
|
@ -578,7 +573,7 @@ _jit_pushargi_d(jit_state_t *_jit, jit_float64_t u)
|
|||
++_jitc->function->call.argi;
|
||||
_jitc->function->call.size -= sizeof(jit_word_t);
|
||||
}
|
||||
if (_jitc->function->call.argi < 4) {
|
||||
if (jit_arg_reg_p(_jitc->function->call.argi)) {
|
||||
jit_movi_d(_F4 - (_jitc->function->call.argi + 1), u);
|
||||
#if !defined(__hpux)
|
||||
if (_jitc->function->call.call & jit_call_varargs)
|
||||
|
|
166
lib/jit_ia64.c
166
lib/jit_ia64.c
|
@ -22,6 +22,18 @@
|
|||
|
||||
#define rc(value) jit_class_##value
|
||||
#define rn(reg) (jit_regno(_rvs[jit_regno(reg)].spec))
|
||||
#define jit_arg_reg_p(i) ((i) >= 0 && (i) < 8)
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
# define C_DISP 0
|
||||
# define S_DISP 0
|
||||
# define I_DISP 0
|
||||
# define F_DISP 0
|
||||
#else
|
||||
# define C_DISP 8 - sizeof(jit_int8_t)
|
||||
# define S_DISP 8 - sizeof(jit_int16_t)
|
||||
# define I_DISP 8 - sizeof(jit_int32_t)
|
||||
# define F_DISP 8 - sizeof(jit_float32_t)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Prototypes
|
||||
|
@ -356,7 +368,7 @@ _jit_arg(jit_state_t *_jit)
|
|||
jit_int32_t offset;
|
||||
|
||||
assert(_jitc->function);
|
||||
if (_jitc->function->self.argi < 8)
|
||||
if (jit_arg_reg_p(_jitc->function->self.argi))
|
||||
offset = _jitc->function->self.argi++;
|
||||
else {
|
||||
offset = _jitc->function->self.size;
|
||||
|
@ -365,19 +377,13 @@ _jit_arg(jit_state_t *_jit)
|
|||
return (jit_new_node_w(jit_code_arg, offset));
|
||||
}
|
||||
|
||||
jit_bool_t
|
||||
_jit_arg_reg_p(jit_state_t *_jit, jit_int32_t offset)
|
||||
{
|
||||
return (offset >= 0 && offset < 8);
|
||||
}
|
||||
|
||||
jit_node_t *
|
||||
_jit_arg_f(jit_state_t *_jit)
|
||||
{
|
||||
jit_int32_t offset;
|
||||
|
||||
assert(_jitc->function);
|
||||
if (_jitc->function->self.argi < 8)
|
||||
if (jit_arg_reg_p(_jitc->function->self.argi))
|
||||
offset = _jitc->function->self.argi++;
|
||||
else {
|
||||
offset = _jitc->function->self.size;
|
||||
|
@ -392,7 +398,7 @@ _jit_arg_d(jit_state_t *_jit)
|
|||
jit_int32_t offset;
|
||||
|
||||
assert(_jitc->function);
|
||||
if (_jitc->function->self.argi < 8)
|
||||
if (jit_arg_reg_p(_jitc->function->self.argi))
|
||||
offset = _jitc->function->self.argi++;
|
||||
else {
|
||||
offset = _jitc->function->self.size;
|
||||
|
@ -405,104 +411,67 @@ 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) {
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_extr_c(u, _R32 + v->u.w);
|
||||
}
|
||||
else {
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
jit_ldxi_c(u, JIT_FP, v->u.w);
|
||||
#else
|
||||
jit_ldxi_c(u, JIT_FP,
|
||||
v->u.w + (__WORDSIZE >> 3) - sizeof(jit_int8_t));
|
||||
#endif
|
||||
}
|
||||
else
|
||||
jit_ldxi_c(u, JIT_FP, v->u.w + C_DISP);
|
||||
}
|
||||
|
||||
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)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_extr_uc(u, _R32 + v->u.w);
|
||||
else {
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
jit_ldxi_uc(u, JIT_FP, v->u.w);
|
||||
#else
|
||||
jit_ldxi_uc(u, JIT_FP,
|
||||
v->u.w + (__WORDSIZE >> 3) - sizeof(jit_uint8_t));
|
||||
#endif
|
||||
}
|
||||
else
|
||||
jit_ldxi_uc(u, JIT_FP, v->u.w + C_DISP);
|
||||
}
|
||||
|
||||
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)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_extr_s(u, _R32 + v->u.w);
|
||||
else {
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
jit_ldxi_s(u, JIT_FP, v->u.w);
|
||||
#else
|
||||
jit_ldxi_s(u, JIT_FP,
|
||||
v->u.w + (__WORDSIZE >> 3) - sizeof(jit_int16_t));
|
||||
#endif
|
||||
}
|
||||
else
|
||||
jit_ldxi_s(u, JIT_FP, v->u.w + S_DISP);
|
||||
}
|
||||
|
||||
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)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_extr_us(u, _R32 + v->u.w);
|
||||
else {
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
jit_ldxi_us(u, JIT_FP, v->u.w);
|
||||
#else
|
||||
jit_ldxi_us(u, JIT_FP,
|
||||
v->u.w + (__WORDSIZE >> 3) - sizeof(jit_uint16_t));
|
||||
#endif
|
||||
}
|
||||
else
|
||||
jit_ldxi_us(u, JIT_FP, v->u.w + S_DISP);
|
||||
}
|
||||
|
||||
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 (jit_arg_reg_p(v->u.w))
|
||||
jit_extr_i(u, _R32 + v->u.w);
|
||||
else {
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
jit_ldxi_i(u, JIT_FP, v->u.w);
|
||||
#else
|
||||
jit_ldxi_i(u, JIT_FP,
|
||||
v->u.w + (__WORDSIZE >> 3) - sizeof(jit_int32_t));
|
||||
#endif
|
||||
}
|
||||
else
|
||||
jit_ldxi_i(u, JIT_FP, v->u.w + I_DISP);
|
||||
}
|
||||
|
||||
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)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_extr_ui(u, _R32 + v->u.w);
|
||||
else {
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
jit_ldxi_ui(u, JIT_FP, v->u.w);
|
||||
#else
|
||||
jit_ldxi_ui(u, JIT_FP,
|
||||
v->u.w + (__WORDSIZE >> 3) - sizeof(jit_uint32_t));
|
||||
#endif
|
||||
}
|
||||
else
|
||||
jit_ldxi_ui(u, JIT_FP, v->u.w + I_DISP);
|
||||
}
|
||||
|
||||
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)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_movr(u, _R32 + v->u.w);
|
||||
else
|
||||
jit_ldxi(u, JIT_FP, v->u.w);
|
||||
|
@ -512,7 +481,7 @@ 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)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_movr(_R32 + v->u.w, u);
|
||||
else
|
||||
jit_stxi(v->u.w, JIT_FP, u);
|
||||
|
@ -523,7 +492,7 @@ _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)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_movi(_R32 + v->u.w, u);
|
||||
else {
|
||||
regno = jit_get_reg(jit_class_gpr);
|
||||
|
@ -537,31 +506,20 @@ 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 < 8)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_movr_f(u, _F8 + v->u.w);
|
||||
else {
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
jit_ldxi_f(u, JIT_FP, v->u.w);
|
||||
#else
|
||||
jit_ldxi_f(u, JIT_FP,
|
||||
v->u.w + (__WORDSIZE >> 3) - sizeof(jit_float32_t));
|
||||
#endif
|
||||
}
|
||||
else
|
||||
jit_ldxi_f(u, JIT_FP, v->u.w + F_DISP);
|
||||
}
|
||||
|
||||
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 < 8)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_movr_f(_F8 + v->u.w, u);
|
||||
else {
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
jit_stxi_f(v->u.w, JIT_FP, u);
|
||||
#else
|
||||
jit_stxi_f(v->u.w + (__WORDSIZE >> 3) - sizeof(jit_float32_t), JIT_FP, u);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
jit_stxi_f(v->u.w, JIT_FP, u + F_DISP);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -569,16 +527,12 @@ _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 < 8)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_movi_f(_F8 + v->u.w, u);
|
||||
else {
|
||||
regno = jit_get_reg(jit_class_fpr);
|
||||
jit_movi_f(regno, u);
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
jit_stxi_f(v->u.w, JIT_FP, regno);
|
||||
#else
|
||||
jit_stxi_f(v->u.w, JIT_FP + (__WORDSIZE >> 3) - sizeof(jit_float32_t), regno);
|
||||
#endif
|
||||
jit_stxi_f(v->u.w, JIT_FP, regno + F_DISP);
|
||||
jit_unget_reg(regno);
|
||||
}
|
||||
}
|
||||
|
@ -587,7 +541,7 @@ 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 < 8)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_movr_d(u, _F8 + v->u.w);
|
||||
else
|
||||
jit_ldxi_d(u, JIT_FP, v->u.w);
|
||||
|
@ -597,7 +551,7 @@ 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 < 8)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_movr_d(_F8 + v->u.w, u);
|
||||
else
|
||||
jit_stxi_d(v->u.w, JIT_FP, u);
|
||||
|
@ -608,7 +562,7 @@ _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 < 8)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_movi_d(_F8 + v->u.w, u);
|
||||
else {
|
||||
regno = jit_get_reg(jit_class_fpr);
|
||||
|
@ -622,7 +576,7 @@ void
|
|||
_jit_pushargr(jit_state_t *_jit, jit_int32_t u)
|
||||
{
|
||||
assert(_jitc->function);
|
||||
if (_jitc->function->call.argi < 8) {
|
||||
if (jit_arg_reg_p(_jitc->function->call.argi)) {
|
||||
jit_movr(_OUT0 + _jitc->function->call.argi, u);
|
||||
++_jitc->function->call.argi;
|
||||
}
|
||||
|
@ -637,7 +591,7 @@ _jit_pushargi(jit_state_t *_jit, jit_word_t u)
|
|||
{
|
||||
jit_int32_t regno;
|
||||
assert(_jitc->function);
|
||||
if (_jitc->function->call.argi < 8) {
|
||||
if (jit_arg_reg_p(_jitc->function->call.argi)) {
|
||||
jit_movi(_OUT0 + _jitc->function->call.argi, u);
|
||||
++_jitc->function->call.argi;
|
||||
}
|
||||
|
@ -654,7 +608,7 @@ void
|
|||
_jit_pushargr_f(jit_state_t *_jit, jit_int32_t u)
|
||||
{
|
||||
assert(_jitc->function);
|
||||
if (_jitc->function->call.argi < 8) {
|
||||
if (jit_arg_reg_p(_jitc->function->call.argi)) {
|
||||
if (!(_jitc->function->call.call & jit_call_varargs))
|
||||
jit_movr_f(_F8 + _jitc->function->call.argi, u);
|
||||
else
|
||||
|
@ -662,11 +616,8 @@ _jit_pushargr_f(jit_state_t *_jit, jit_int32_t u)
|
|||
++_jitc->function->call.argi;
|
||||
}
|
||||
else {
|
||||
jit_stxi_f(_jitc->function->call.size + params_offset
|
||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
+ sizeof(jit_float32_t)
|
||||
#endif
|
||||
, JIT_SP, u);
|
||||
jit_stxi_f(_jitc->function->call.size + params_offset + F_DISP,
|
||||
JIT_SP, u);
|
||||
_jitc->function->call.size += sizeof(jit_word_t);
|
||||
}
|
||||
}
|
||||
|
@ -676,7 +627,7 @@ _jit_pushargi_f(jit_state_t *_jit, jit_float32_t u)
|
|||
{
|
||||
jit_int32_t regno;
|
||||
assert(_jitc->function);
|
||||
if (_jitc->function->call.argi < 8) {
|
||||
if (jit_arg_reg_p(_jitc->function->call.argi)) {
|
||||
if (!(_jitc->function->call.call & jit_call_varargs))
|
||||
jit_movi_f(_F8 + _jitc->function->call.argi, u);
|
||||
else
|
||||
|
@ -686,11 +637,8 @@ _jit_pushargi_f(jit_state_t *_jit, jit_float32_t u)
|
|||
else {
|
||||
regno = jit_get_reg(jit_class_fpr);
|
||||
jit_movi_f(regno, u);
|
||||
jit_stxi_f(_jitc->function->call.size + params_offset
|
||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
+ sizeof(jit_float32_t)
|
||||
#endif
|
||||
, JIT_SP, regno);
|
||||
jit_stxi_f(_jitc->function->call.size + params_offset + F_DISP,
|
||||
JIT_SP, regno);
|
||||
_jitc->function->call.size += sizeof(jit_word_t);
|
||||
jit_unget_reg(regno);
|
||||
}
|
||||
|
@ -700,7 +648,7 @@ void
|
|||
_jit_pushargr_d(jit_state_t *_jit, jit_int32_t u)
|
||||
{
|
||||
assert(_jitc->function);
|
||||
if (_jitc->function->call.argi < 8) {
|
||||
if (jit_arg_reg_p(_jitc->function->call.argi)) {
|
||||
if (!(_jitc->function->call.call & jit_call_varargs))
|
||||
jit_movr_d(_F8 + _jitc->function->call.argi, u);
|
||||
else
|
||||
|
@ -718,7 +666,7 @@ _jit_pushargi_d(jit_state_t *_jit, jit_float64_t u)
|
|||
{
|
||||
jit_int32_t regno;
|
||||
assert(_jitc->function);
|
||||
if (_jitc->function->call.argi < 8) {
|
||||
if (jit_arg_reg_p(_jitc->function->call.argi)) {
|
||||
if (!(_jitc->function->call.call & jit_call_varargs))
|
||||
jit_movi_d(_F8 + _jitc->function->call.argi, u);
|
||||
else
|
||||
|
|
139
lib/jit_mips.c
139
lib/jit_mips.c
|
@ -42,6 +42,16 @@
|
|||
#else
|
||||
# define WORD_ADJUST 0
|
||||
#endif
|
||||
#define jit_arg_reg_p(i) ((i) >= 0 && (i) < NUM_WORD_ARGS)
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
# define C_DISP 0
|
||||
# define S_DISP 0
|
||||
# define I_DISP 0
|
||||
#else
|
||||
# define C_DISP STACK_SLOT - sizeof(jit_int8_t)
|
||||
# define S_DISP STACK_SLOT - sizeof(jit_int16_t)
|
||||
# define I_DISP STACK_SLOT - sizeof(jit_int32_t)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Prototypes
|
||||
|
@ -281,7 +291,7 @@ _jit_arg(jit_state_t *_jit)
|
|||
jit_int32_t offset;
|
||||
assert(_jitc->function);
|
||||
#if NEW_ABI
|
||||
if (_jitc->function->self.argi < NUM_WORD_ARGS)
|
||||
if (jit_arg_reg_p(_jitc->function->self.argi))
|
||||
offset = _jitc->function->self.argi++;
|
||||
else {
|
||||
offset = _jitc->function->self.size;
|
||||
|
@ -297,19 +307,13 @@ _jit_arg(jit_state_t *_jit)
|
|||
return (jit_new_node_w(jit_code_arg, offset));
|
||||
}
|
||||
|
||||
jit_bool_t
|
||||
_jit_arg_reg_p(jit_state_t *_jit, jit_int32_t offset)
|
||||
{
|
||||
return (offset >= 0 && offset < NUM_WORD_ARGS);
|
||||
}
|
||||
|
||||
jit_node_t *
|
||||
_jit_arg_f(jit_state_t *_jit)
|
||||
{
|
||||
jit_int32_t offset;
|
||||
assert(_jitc->function);
|
||||
#if NEW_ABI
|
||||
if (_jitc->function->self.argi < NUM_WORD_ARGS)
|
||||
if (jit_arg_reg_p(_jitc->function->self.argi))
|
||||
offset = _jitc->function->self.argi++;
|
||||
else {
|
||||
offset = _jitc->function->self.size;
|
||||
|
@ -317,7 +321,7 @@ _jit_arg_f(jit_state_t *_jit)
|
|||
}
|
||||
#else
|
||||
offset = (_jitc->function->self.size - stack_framesize) >> STACK_SHIFT;
|
||||
if (offset < 4) {
|
||||
if (offset < NUM_WORD_ARGS) {
|
||||
if (!_jitc->function->self.argi) {
|
||||
if (offset == 0)
|
||||
offset = 4;
|
||||
|
@ -334,20 +338,13 @@ _jit_arg_f(jit_state_t *_jit)
|
|||
return (jit_new_node_w(jit_code_arg_f, offset));
|
||||
}
|
||||
|
||||
jit_bool_t
|
||||
_jit_arg_f_reg_p(jit_state_t *_jit, jit_int32_t offset)
|
||||
{
|
||||
/* 0-3 integer register, 4-7 float register */
|
||||
return (offset >= 0 && offset < 8);
|
||||
}
|
||||
|
||||
jit_node_t *
|
||||
_jit_arg_d(jit_state_t *_jit)
|
||||
{
|
||||
jit_int32_t offset;
|
||||
assert(_jitc->function);
|
||||
#if NEW_ABI
|
||||
if (_jitc->function->self.argi < NUM_WORD_ARGS)
|
||||
if (jit_arg_reg_p(_jitc->function->self.argi))
|
||||
offset = _jitc->function->self.argi++;
|
||||
else {
|
||||
offset = _jitc->function->self.size;
|
||||
|
@ -359,7 +356,7 @@ _jit_arg_d(jit_state_t *_jit)
|
|||
_jitc->function->self.argi = 1;
|
||||
}
|
||||
offset = (_jitc->function->self.size - stack_framesize) >> STACK_SHIFT;
|
||||
if (offset < 4) {
|
||||
if (offset < NUM_WORD_ARGS) {
|
||||
if (!_jitc->function->self.argi)
|
||||
offset += 4;
|
||||
}
|
||||
|
@ -370,90 +367,59 @@ _jit_arg_d(jit_state_t *_jit)
|
|||
return (jit_new_node_w(jit_code_arg_d, offset));
|
||||
}
|
||||
|
||||
jit_bool_t
|
||||
_jit_arg_d_reg_p(jit_state_t *_jit, jit_int32_t offset)
|
||||
{
|
||||
return (jit_arg_f_reg_p(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 < NUM_WORD_ARGS)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_extr_c(u, _A0 - v->u.w);
|
||||
else {
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
jit_ldxi_c(u, _FP, v->u.w);
|
||||
#else
|
||||
jit_ldxi_c(u, JIT_FP, v->u.w + STACK_SLOT - sizeof(jit_int8_t));
|
||||
#endif
|
||||
}
|
||||
else
|
||||
jit_ldxi_c(u, _FP, v->u.w + C_DISP);
|
||||
}
|
||||
|
||||
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 < NUM_WORD_ARGS)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_extr_uc(u, _A0 - v->u.w);
|
||||
else {
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
jit_ldxi_uc(u, _FP, v->u.w);
|
||||
#else
|
||||
jit_ldxi_uc(u, JIT_FP, v->u.w + STACK_SLOT - sizeof(jit_uint8_t));
|
||||
#endif
|
||||
}
|
||||
else
|
||||
jit_ldxi_uc(u, _FP, v->u.w + C_DISP);
|
||||
}
|
||||
|
||||
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 < NUM_WORD_ARGS)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_extr_s(u, _A0 - v->u.w);
|
||||
else {
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
jit_ldxi_s(u, _FP, v->u.w);
|
||||
#else
|
||||
jit_ldxi_s(u, JIT_FP, v->u.w + STACK_SLOT - sizeof(jit_int16_t));
|
||||
#endif
|
||||
}
|
||||
else
|
||||
jit_ldxi_s(u, _FP, v->u.w + S_DISP);
|
||||
}
|
||||
|
||||
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 < NUM_WORD_ARGS)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_extr_us(u, _A0 - v->u.w);
|
||||
else {
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
jit_ldxi_us(u, _FP, v->u.w);
|
||||
#else
|
||||
jit_ldxi_us(u, JIT_FP, v->u.w + STACK_SLOT - sizeof(jit_uint16_t));
|
||||
#endif
|
||||
}
|
||||
else
|
||||
jit_ldxi_us(u, _FP, v->u.w + S_DISP);
|
||||
}
|
||||
|
||||
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 < NUM_WORD_ARGS) {
|
||||
if (jit_arg_reg_p(v->u.w)) {
|
||||
#if __WORDSIZE == 64
|
||||
jit_extr_i(u, _A0 - v->u.w);
|
||||
#else
|
||||
jit_movr(u, _A0 - v->u.w);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
jit_ldxi_i(u, _FP, v->u.w);
|
||||
#else
|
||||
jit_ldxi_i(u, JIT_FP, v->u.w + STACK_SLOT - sizeof(jit_int32_t));
|
||||
#endif
|
||||
}
|
||||
else
|
||||
jit_ldxi_i(u, _FP, v->u.w + I_DISP);
|
||||
}
|
||||
|
||||
#if __WORDSIZE == 64
|
||||
|
@ -461,22 +427,17 @@ 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 < NUM_WORD_ARGS)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_extr_ui(u, _A0 - v->u.w);
|
||||
else {
|
||||
# if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
jit_ldxi_ui(u, _FP, v->u.w);
|
||||
# else
|
||||
jit_ldxi_ui(u, JIT_FP, v->u.w + STACK_SLOT - sizeof(jit_uint32_t));
|
||||
# endif
|
||||
}
|
||||
else
|
||||
jit_ldxi_ui(u, _FP, v->u.w + I_DISP);
|
||||
}
|
||||
|
||||
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 < NUM_WORD_ARGS)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_movr(u, _A0 - v->u.w);
|
||||
else
|
||||
jit_ldxi_l(u, _FP, v->u.w);
|
||||
|
@ -487,7 +448,7 @@ 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 < NUM_WORD_ARGS)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_movr(_A0 - v->u.w, u);
|
||||
else
|
||||
jit_stxi(v->u.w, _FP, u);
|
||||
|
@ -498,7 +459,7 @@ _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 < NUM_WORD_ARGS)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_movi(_A0 - v->u.w, u);
|
||||
else {
|
||||
regno = jit_get_reg(jit_class_gpr);
|
||||
|
@ -513,7 +474,7 @@ _jit_getarg_f(jit_state_t *_jit, jit_int32_t u, jit_node_t *v)
|
|||
{
|
||||
assert(v->code == jit_code_arg_f);
|
||||
#if NEW_ABI
|
||||
if (v->u.w < NUM_WORD_ARGS)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_movr_f(u, _F12 - v->u.w);
|
||||
#else
|
||||
if (v->u.w < 4)
|
||||
|
@ -530,7 +491,7 @@ _jit_putargr_f(jit_state_t *_jit, jit_int32_t u, jit_node_t *v)
|
|||
{
|
||||
assert(v->code == jit_code_arg_f);
|
||||
#if NEW_ABI
|
||||
if (v->u.w < NUM_WORD_ARGS)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_movr_f(_F12 - v->u.w, u);
|
||||
#else
|
||||
if (v->u.w < 4)
|
||||
|
@ -548,7 +509,7 @@ _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 NEW_ABI
|
||||
if (v->u.w < NUM_WORD_ARGS)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_movi_f(_F12 - v->u.w, u);
|
||||
#else
|
||||
if (v->u.w < 4) {
|
||||
|
@ -573,7 +534,7 @@ _jit_getarg_d(jit_state_t *_jit, jit_int32_t u, jit_node_t *v)
|
|||
{
|
||||
assert(v->code == jit_code_arg_d);
|
||||
#if NEW_ABI
|
||||
if (v->u.w < NUM_WORD_ARGS)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_movr_d(u, _F12 - v->u.w);
|
||||
#else
|
||||
if (v->u.w < 4)
|
||||
|
@ -590,7 +551,7 @@ _jit_putargr_d(jit_state_t *_jit, jit_int32_t u, jit_node_t *v)
|
|||
{
|
||||
assert(v->code == jit_code_arg_d);
|
||||
#if NEW_ABI
|
||||
if (v->u.w < NUM_WORD_ARGS)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_movr_d(_F12 - v->u.w, u);
|
||||
#else
|
||||
if (v->u.w < 4)
|
||||
|
@ -608,7 +569,7 @@ _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 NEW_ABI
|
||||
if (v->u.w < NUM_WORD_ARGS)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_movi_d(_F12 - v->u.w, u);
|
||||
#else
|
||||
if (v->u.w < 4) {
|
||||
|
@ -633,7 +594,7 @@ _jit_pushargr(jit_state_t *_jit, jit_int32_t u)
|
|||
{
|
||||
#if NEW_ABI
|
||||
assert(_jitc->function);
|
||||
if (_jitc->function->call.argi < NUM_WORD_ARGS) {
|
||||
if (jit_arg_reg_p(_jitc->function->call.argi)) {
|
||||
jit_movr(_A0 - _jitc->function->call.argi, u);
|
||||
++_jitc->function->call.argi;
|
||||
}
|
||||
|
@ -646,7 +607,7 @@ _jit_pushargr(jit_state_t *_jit, jit_int32_t u)
|
|||
assert(_jitc->function);
|
||||
offset = _jitc->function->call.size >> STACK_SHIFT;
|
||||
_jitc->function->call.argi = 1;
|
||||
if (offset < NUM_WORD_ARGS)
|
||||
if (jit_arg_reg_p(offset))
|
||||
jit_movr(_A0 - offset, u);
|
||||
else
|
||||
jit_stxi(_jitc->function->call.size, JIT_SP, u);
|
||||
|
@ -660,7 +621,7 @@ _jit_pushargi(jit_state_t *_jit, jit_word_t u)
|
|||
#if NEW_ABI
|
||||
jit_int32_t regno;
|
||||
assert(_jitc->function);
|
||||
if (_jitc->function->call.argi < NUM_WORD_ARGS) {
|
||||
if (jit_arg_reg_p(_jitc->function->call.argi)) {
|
||||
jit_movi(_A0 - _jitc->function->call.argi, u);
|
||||
++_jitc->function->call.argi;
|
||||
}
|
||||
|
@ -677,7 +638,7 @@ _jit_pushargi(jit_state_t *_jit, jit_word_t u)
|
|||
assert(_jitc->function);
|
||||
offset = _jitc->function->call.size >> STACK_SHIFT;
|
||||
++_jitc->function->call.argi;
|
||||
if (offset < NUM_WORD_ARGS)
|
||||
if (jit_arg_reg_p(offset))
|
||||
jit_movi(_A0 - offset, u);
|
||||
else {
|
||||
regno = jit_get_reg(jit_class_gpr);
|
||||
|
@ -694,7 +655,7 @@ _jit_pushargr_f(jit_state_t *_jit, jit_int32_t u)
|
|||
{
|
||||
#if NEW_ABI
|
||||
assert(_jitc->function);
|
||||
if (_jitc->function->call.argi < NUM_WORD_ARGS) {
|
||||
if (jit_arg_reg_p(_jitc->function->call.argi)) {
|
||||
if (!(_jitc->function->call.call & jit_call_varargs))
|
||||
jit_movr_f(_F12 - _jitc->function->call.argi, u);
|
||||
else
|
||||
|
@ -729,7 +690,7 @@ _jit_pushargi_f(jit_state_t *_jit, jit_float32_t u)
|
|||
jit_int32_t regno;
|
||||
#if NEW_ABI
|
||||
assert(_jitc->function);
|
||||
if (_jitc->function->call.argi < NUM_WORD_ARGS) {
|
||||
if (jit_arg_reg_p(_jitc->function->call.argi)) {
|
||||
if (!(_jitc->function->call.call & jit_call_varargs))
|
||||
jit_movi_f(_F12 - _jitc->function->call.argi, u);
|
||||
else
|
||||
|
@ -770,7 +731,7 @@ _jit_pushargr_d(jit_state_t *_jit, jit_int32_t u)
|
|||
{
|
||||
#if NEW_ABI
|
||||
assert(_jitc->function);
|
||||
if (_jitc->function->call.argi < NUM_WORD_ARGS) {
|
||||
if (jit_arg_reg_p(_jitc->function->call.argi)) {
|
||||
if (!(_jitc->function->call.call & jit_call_varargs))
|
||||
jit_movr_d(_F12 - _jitc->function->call.argi, u);
|
||||
else
|
||||
|
@ -813,7 +774,7 @@ _jit_pushargi_d(jit_state_t *_jit, jit_float64_t u)
|
|||
jit_int32_t regno;
|
||||
#if NEW_ABI
|
||||
assert(_jitc->function);
|
||||
if (_jitc->function->call.argi < NUM_WORD_ARGS) {
|
||||
if (jit_arg_reg_p(_jitc->function->call.argi)) {
|
||||
if (!(_jitc->function->call.call & jit_call_varargs))
|
||||
jit_movi_d(_F12 - _jitc->function->call.argi, u);
|
||||
else
|
||||
|
|
186
lib/jit_ppc.c
186
lib/jit_ppc.c
|
@ -19,6 +19,19 @@
|
|||
|
||||
#define rc(value) jit_class_##value
|
||||
#define rn(reg) (jit_regno(_rvs[jit_regno(reg)].spec))
|
||||
#define jit_arg_reg_p(i) ((i) >= 0 && (i) < 8)
|
||||
#define jit_arg_f_reg_p(i) ((i) >= 0 && (i) < 13)
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
# define C_DISP 0
|
||||
# define S_DISP 0
|
||||
# define I_DISP 0
|
||||
# define F_DISP 0
|
||||
#else
|
||||
# define C_DISP (__WORDSIZE >> 3) - sizeof(jit_int8_t)
|
||||
# define S_DISP (__WORDSIZE >> 3) - sizeof(jit_int16_t)
|
||||
# define I_DISP (__WORDSIZE >> 3) - sizeof(jit_int32_t)
|
||||
# define F_DISP (__WORDSIZE >> 3) - sizeof(jit_float32_t)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Prototypes
|
||||
|
@ -257,7 +270,7 @@ _jit_arg(jit_state_t *_jit)
|
|||
{
|
||||
jit_int32_t offset;
|
||||
assert(_jitc->function);
|
||||
if (_jitc->function->self.argi < 8)
|
||||
if (jit_arg_reg_p(_jitc->function->self.argi))
|
||||
offset = _jitc->function->self.argi++;
|
||||
else
|
||||
offset = _jitc->function->self.size;
|
||||
|
@ -265,27 +278,16 @@ _jit_arg(jit_state_t *_jit)
|
|||
return (jit_new_node_w(jit_code_arg, offset));
|
||||
}
|
||||
|
||||
jit_bool_t
|
||||
_jit_arg_reg_p(jit_state_t *_jit, jit_int32_t offset)
|
||||
{
|
||||
return (offset >= 0 && offset < 8);
|
||||
}
|
||||
|
||||
jit_node_t *
|
||||
_jit_arg_f(jit_state_t *_jit)
|
||||
{
|
||||
jit_int32_t offset;
|
||||
assert(_jitc->function);
|
||||
if (_jitc->function->self.argf < 13)
|
||||
if (jit_arg_f_reg_p(_jitc->function->self.argf))
|
||||
offset = _jitc->function->self.argf++;
|
||||
else {
|
||||
#if __WORDSIZE == 32 || __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
offset = _jitc->function->self.size;
|
||||
#else
|
||||
offset = _jitc->function->self.size + 4;
|
||||
#endif
|
||||
}
|
||||
if (_jitc->function->self.argi < 8) {
|
||||
else
|
||||
offset = _jitc->function->self.size + F_DISP;
|
||||
if (jit_arg_reg_p(_jitc->function->self.argi)) {
|
||||
#if __WORDSIZE == 32
|
||||
_jitc->function->self.argi += 2;
|
||||
#else
|
||||
|
@ -296,22 +298,16 @@ _jit_arg_f(jit_state_t *_jit)
|
|||
return (jit_new_node_w(jit_code_arg_f, offset));
|
||||
}
|
||||
|
||||
jit_bool_t
|
||||
_jit_arg_f_reg_p(jit_state_t *_jit, jit_int32_t offset)
|
||||
{
|
||||
return (offset >= 0 && offset < 13);
|
||||
}
|
||||
|
||||
jit_node_t *
|
||||
_jit_arg_d(jit_state_t *_jit)
|
||||
{
|
||||
jit_int32_t offset;
|
||||
assert(_jitc->function);
|
||||
if (_jitc->function->self.argf < 13)
|
||||
if (jit_arg_f_reg_p(_jitc->function->self.argf))
|
||||
offset = _jitc->function->self.argf++;
|
||||
else
|
||||
offset = _jitc->function->self.size;
|
||||
if (_jitc->function->self.argi < 8) {
|
||||
if (jit_arg_reg_p(_jitc->function->self.argi)) {
|
||||
#if __WORDSIZE == 32
|
||||
_jitc->function->self.argi += 2;
|
||||
#else
|
||||
|
@ -322,95 +318,59 @@ _jit_arg_d(jit_state_t *_jit)
|
|||
return (jit_new_node_w(jit_code_arg_d, offset));
|
||||
}
|
||||
|
||||
jit_bool_t
|
||||
_jit_arg_d_reg_p(jit_state_t *_jit, jit_int32_t offset)
|
||||
{
|
||||
return (jit_arg_f_reg_p(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)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_extr_c(u, JIT_RA0 - v->u.w);
|
||||
else {
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
jit_ldxi_c(u, JIT_FP, v->u.w);
|
||||
#else
|
||||
jit_ldxi_c(u, JIT_FP,
|
||||
v->u.w + (__WORDSIZE >> 3) - sizeof(jit_int8_t));
|
||||
#endif
|
||||
}
|
||||
else
|
||||
jit_ldxi_c(u, JIT_FP, v->u.w + C_DISP);
|
||||
}
|
||||
|
||||
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)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_extr_uc(u, JIT_RA0 - v->u.w);
|
||||
else {
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
jit_ldxi_uc(u, JIT_FP, v->u.w);
|
||||
#else
|
||||
jit_ldxi_uc(u, JIT_FP,
|
||||
v->u.w + (__WORDSIZE >> 3) - sizeof(jit_uint8_t));
|
||||
#endif
|
||||
}
|
||||
else
|
||||
jit_ldxi_uc(u, JIT_FP, v->u.w + C_DISP);
|
||||
}
|
||||
|
||||
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)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_extr_s(u, JIT_RA0 - v->u.w);
|
||||
else {
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
jit_ldxi_s(u, JIT_FP, v->u.w);
|
||||
#else
|
||||
jit_ldxi_s(u, JIT_FP,
|
||||
v->u.w + (__WORDSIZE >> 3) - sizeof(jit_int16_t));
|
||||
#endif
|
||||
}
|
||||
else
|
||||
jit_ldxi_s(u, JIT_FP, v->u.w + S_DISP);
|
||||
}
|
||||
|
||||
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)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_extr_us(u, JIT_RA0 - v->u.w);
|
||||
else {
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
jit_ldxi_us(u, JIT_FP, v->u.w);
|
||||
#else
|
||||
jit_ldxi_us(u, JIT_FP,
|
||||
v->u.w + (__WORDSIZE >> 3) - sizeof(jit_uint16_t));
|
||||
#endif
|
||||
}
|
||||
else
|
||||
jit_ldxi_us(u, JIT_FP, v->u.w + S_DISP);
|
||||
}
|
||||
|
||||
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 (jit_arg_reg_p(v->u.w)) {
|
||||
#if __WORDSIZE == 32
|
||||
jit_movr(u, JIT_RA0 - v->u.w);
|
||||
#else
|
||||
jit_extr_i(u, JIT_RA0 - v->u.w);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
jit_ldxi_i(u, JIT_FP, v->u.w);
|
||||
#else
|
||||
jit_ldxi_i(u, JIT_FP,
|
||||
v->u.w + (__WORDSIZE >> 3) - sizeof(jit_int32_t));
|
||||
#endif
|
||||
}
|
||||
else
|
||||
jit_ldxi_i(u, JIT_FP, v->u.w + I_DISP);
|
||||
}
|
||||
|
||||
#if __WORDSIZE == 64
|
||||
|
@ -418,23 +378,17 @@ 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)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_extr_ui(u, JIT_RA0 - v->u.w);
|
||||
else {
|
||||
# if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
jit_ldxi_ui(u, JIT_FP, v->u.w);
|
||||
# else
|
||||
jit_ldxi_ui(u, JIT_FP,
|
||||
v->u.w + (__WORDSIZE >> 3) - sizeof(jit_uint32_t));
|
||||
# endif
|
||||
}
|
||||
else
|
||||
jit_ldxi_ui(u, JIT_FP, v->u.w + I_DISP);
|
||||
}
|
||||
|
||||
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)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_movr(u, JIT_RA0 - v->u.w);
|
||||
else
|
||||
jit_ldxi_l(u, JIT_FP, v->u.w);
|
||||
|
@ -445,7 +399,7 @@ 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)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_movr(JIT_RA0 - v->u.w, u);
|
||||
else
|
||||
jit_stxi(v->u.w, JIT_FP, u);
|
||||
|
@ -456,7 +410,7 @@ _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)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_movi(JIT_RA0 - v->u.w, u);
|
||||
else {
|
||||
regno = jit_get_reg(jit_class_gpr);
|
||||
|
@ -470,7 +424,7 @@ 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)
|
||||
if (jit_arg_f_reg_p(v->u.w))
|
||||
jit_movr_d(u, JIT_FA0 - v->u.w);
|
||||
else
|
||||
jit_ldxi_f(u, JIT_FP, v->u.w);
|
||||
|
@ -480,7 +434,7 @@ 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)
|
||||
if (jit_arg_f_reg_p(v->u.w))
|
||||
jit_movr_d(JIT_FA0 - v->u.w, u);
|
||||
else
|
||||
jit_stxi_f(v->u.w, JIT_FP, u);
|
||||
|
@ -491,7 +445,7 @@ _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)
|
||||
if (jit_arg_f_reg_p(v->u.w))
|
||||
jit_movi_d(JIT_FA0 - v->u.w, u);
|
||||
else {
|
||||
regno = jit_get_reg(jit_class_fpr);
|
||||
|
@ -505,7 +459,7 @@ 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)
|
||||
if (jit_arg_f_reg_p(v->u.w))
|
||||
jit_movr_d(u, JIT_FA0 - v->u.w);
|
||||
else
|
||||
jit_ldxi_d(u, JIT_FP, v->u.w);
|
||||
|
@ -515,7 +469,7 @@ 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)
|
||||
if (jit_arg_f_reg_p(v->u.w))
|
||||
jit_movr_d(JIT_FA0 - v->u.w, u);
|
||||
else
|
||||
jit_stxi_d(v->u.w, JIT_FP, u);
|
||||
|
@ -526,7 +480,7 @@ _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)
|
||||
if (jit_arg_f_reg_p(v->u.w))
|
||||
jit_movi_d(JIT_FA0 - v->u.w, u);
|
||||
else {
|
||||
regno = jit_get_reg(jit_class_fpr);
|
||||
|
@ -540,7 +494,7 @@ void
|
|||
_jit_pushargr(jit_state_t *_jit, jit_int32_t u)
|
||||
{
|
||||
assert(_jitc->function);
|
||||
if (_jitc->function->call.argi < 8) {
|
||||
if (jit_arg_reg_p(_jitc->function->call.argi)) {
|
||||
jit_movr(JIT_RA0 - _jitc->function->call.argi, u);
|
||||
++_jitc->function->call.argi;
|
||||
}
|
||||
|
@ -554,7 +508,7 @@ _jit_pushargi(jit_state_t *_jit, jit_word_t u)
|
|||
{
|
||||
jit_int32_t regno;
|
||||
assert(_jitc->function);
|
||||
if (_jitc->function->call.argi < 8) {
|
||||
if (jit_arg_reg_p(_jitc->function->call.argi)) {
|
||||
jit_movi(JIT_RA0 - _jitc->function->call.argi, u);
|
||||
++_jitc->function->call.argi;
|
||||
}
|
||||
|
@ -571,12 +525,12 @@ void
|
|||
_jit_pushargr_f(jit_state_t *_jit, jit_int32_t u)
|
||||
{
|
||||
assert(_jitc->function);
|
||||
if (_jitc->function->call.argf < 13) {
|
||||
if (jit_arg_f_reg_p(_jitc->function->call.argf)) {
|
||||
jit_movr_d(JIT_FA0 - _jitc->function->call.argf, u);
|
||||
++_jitc->function->call.argf;
|
||||
if (!(_jitc->function->call.call & jit_call_varargs)) {
|
||||
/* in case of excess arguments */
|
||||
if (_jitc->function->call.argi < 8) {
|
||||
if (jit_arg_reg_p(_jitc->function->call.argi)) {
|
||||
#if __WORDSIZE == 32
|
||||
_jitc->function->call.argi += 2;
|
||||
#else
|
||||
|
@ -587,7 +541,7 @@ _jit_pushargr_f(jit_state_t *_jit, jit_int32_t u)
|
|||
return;
|
||||
}
|
||||
}
|
||||
if (_jitc->function->call.argi < 8) {
|
||||
if (jit_arg_reg_p(_jitc->function->call.argi)) {
|
||||
/* use reserved 8 bytes area */
|
||||
jit_stxi_d(alloca_offset - 8, JIT_FP, u);
|
||||
jit_ldxi(JIT_RA0 - _jitc->function->call.argi, JIT_FP,
|
||||
|
@ -599,14 +553,9 @@ _jit_pushargr_f(jit_state_t *_jit, jit_int32_t u)
|
|||
_jitc->function->call.argi++;
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
#if __WORDSIZE == 32 || __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
jit_stxi_f(_jitc->function->call.size + params_offset, JIT_SP, u);
|
||||
#else
|
||||
jit_stxi_f(_jitc->function->call.size + params_offset + 4,
|
||||
else
|
||||
jit_stxi_f(_jitc->function->call.size + params_offset + F_DISP,
|
||||
JIT_SP, u);
|
||||
#endif
|
||||
}
|
||||
_jitc->function->call.size += sizeof(jit_word_t);
|
||||
}
|
||||
|
||||
|
@ -616,12 +565,12 @@ _jit_pushargi_f(jit_state_t *_jit, jit_float32_t u)
|
|||
jit_int32_t regno;
|
||||
|
||||
assert(_jitc->function);
|
||||
if (_jitc->function->call.argf < 13) {
|
||||
if (jit_arg_f_reg_p(_jitc->function->call.argf)) {
|
||||
jit_movi_d(JIT_FA0 - _jitc->function->call.argf, u);
|
||||
++_jitc->function->call.argf;
|
||||
if (!(_jitc->function->call.call & jit_call_varargs)) {
|
||||
/* in case of excess arguments */
|
||||
if (_jitc->function->call.argi < 8) {
|
||||
if (jit_arg_reg_p(_jitc->function->call.argi)) {
|
||||
#if __WORDSIZE == 32
|
||||
_jitc->function->call.argi += 2;
|
||||
#else
|
||||
|
@ -634,7 +583,7 @@ _jit_pushargi_f(jit_state_t *_jit, jit_float32_t u)
|
|||
}
|
||||
regno = jit_get_reg(jit_class_fpr);
|
||||
jit_movi_f(regno, u);
|
||||
if (_jitc->function->call.argi < 8) {
|
||||
if (jit_arg_reg_p(_jitc->function->call.argi)) {
|
||||
/* use reserved 8 bytes area */
|
||||
jit_stxi_d(alloca_offset - 8, JIT_FP, regno);
|
||||
jit_ldxi(JIT_RA0 - _jitc->function->call.argi, JIT_FP,
|
||||
|
@ -646,14 +595,9 @@ _jit_pushargi_f(jit_state_t *_jit, jit_float32_t u)
|
|||
_jitc->function->call.argi++;
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
#if __WORDSIZE == 32 || __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
jit_stxi_f(_jitc->function->call.size + params_offset, JIT_SP, regno);
|
||||
#else
|
||||
jit_stxi_f(_jitc->function->call.size + params_offset + 4,
|
||||
else
|
||||
jit_stxi_f(_jitc->function->call.size + params_offset + F_DISP,
|
||||
JIT_SP, regno);
|
||||
#endif
|
||||
}
|
||||
_jitc->function->call.size += sizeof(jit_word_t);
|
||||
jit_unget_reg(regno);
|
||||
}
|
||||
|
@ -662,12 +606,12 @@ void
|
|||
_jit_pushargr_d(jit_state_t *_jit, jit_int32_t u)
|
||||
{
|
||||
assert(_jitc->function);
|
||||
if (_jitc->function->call.argf < 13) {
|
||||
if (jit_arg_f_reg_p(_jitc->function->call.argf)) {
|
||||
jit_movr_d(JIT_FA0 - _jitc->function->call.argf, u);
|
||||
++_jitc->function->call.argf;
|
||||
if (!(_jitc->function->call.call & jit_call_varargs)) {
|
||||
/* in case of excess arguments */
|
||||
if (_jitc->function->call.argi < 8) {
|
||||
if (jit_arg_reg_p(_jitc->function->call.argi)) {
|
||||
#if __WORDSIZE == 32
|
||||
_jitc->function->call.argi += 2;
|
||||
#else
|
||||
|
@ -678,7 +622,7 @@ _jit_pushargr_d(jit_state_t *_jit, jit_int32_t u)
|
|||
return;
|
||||
}
|
||||
}
|
||||
if (_jitc->function->call.argi < 8) {
|
||||
if (jit_arg_reg_p(_jitc->function->call.argi)) {
|
||||
/* use reserved 8 bytes area */
|
||||
jit_stxi_d(alloca_offset - 8, JIT_FP, u);
|
||||
jit_ldxi(JIT_RA0 - _jitc->function->call.argi, JIT_FP,
|
||||
|
@ -701,12 +645,12 @@ _jit_pushargi_d(jit_state_t *_jit, jit_float64_t u)
|
|||
jit_int32_t regno;
|
||||
|
||||
assert(_jitc->function);
|
||||
if (_jitc->function->call.argf < 13) {
|
||||
if (jit_arg_f_reg_p(_jitc->function->call.argf)) {
|
||||
jit_movi_d(JIT_FA0 - _jitc->function->call.argf, u);
|
||||
++_jitc->function->call.argf;
|
||||
if (!(_jitc->function->call.call & jit_call_varargs)) {
|
||||
/* in case of excess arguments */
|
||||
if (_jitc->function->call.argi < 8) {
|
||||
if (jit_arg_reg_p(_jitc->function->call.argi)) {
|
||||
#if __WORDSIZE == 32
|
||||
_jitc->function->call.argi += 2;
|
||||
#else
|
||||
|
@ -719,7 +663,7 @@ _jit_pushargi_d(jit_state_t *_jit, jit_float64_t u)
|
|||
}
|
||||
regno = jit_get_reg(jit_class_fpr);
|
||||
jit_movi_d(regno, u);
|
||||
if (_jitc->function->call.argi < 8) {
|
||||
if (jit_arg_reg_p(_jitc->function->call.argi)) {
|
||||
/* use reserved 8 bytes area */
|
||||
jit_stxi_d(alloca_offset - 8, JIT_FP, regno);
|
||||
jit_ldxi(JIT_RA0 - _jitc->function->call.argi, JIT_FP,
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
#else
|
||||
# define NUM_FLOAT_REG_ARGS 4
|
||||
#endif
|
||||
#define jit_arg_reg_p(i) ((i) >= 0 && (i) < 5)
|
||||
#define jit_arg_f_reg_p(i) ((i) >= 0 && (i) < NUM_FLOAT_REG_ARGS)
|
||||
|
||||
/*
|
||||
* Prototypes
|
||||
|
@ -225,7 +227,7 @@ _jit_arg(jit_state_t *_jit)
|
|||
{
|
||||
jit_int32_t offset;
|
||||
assert(_jitc->function);
|
||||
if (_jitc->function->self.argi < 5)
|
||||
if (jit_arg_reg_p(_jitc->function->self.argi))
|
||||
offset = _jitc->function->self.argi++;
|
||||
else {
|
||||
offset = _jitc->function->self.size;
|
||||
|
@ -234,18 +236,12 @@ _jit_arg(jit_state_t *_jit)
|
|||
return (jit_new_node_w(jit_code_arg, offset));
|
||||
}
|
||||
|
||||
jit_bool_t
|
||||
_jit_arg_reg_p(jit_state_t *_jit, jit_int32_t offset)
|
||||
{
|
||||
return (offset >= 0 && offset < 5);
|
||||
}
|
||||
|
||||
jit_node_t *
|
||||
_jit_arg_f(jit_state_t *_jit)
|
||||
{
|
||||
jit_int32_t offset;
|
||||
assert(_jitc->function);
|
||||
if (_jitc->function->self.argf < NUM_FLOAT_REG_ARGS)
|
||||
if (jit_arg_f_reg_p(_jitc->function->self.argf))
|
||||
offset = _jitc->function->self.argf++;
|
||||
else {
|
||||
offset = _jitc->function->self.size;
|
||||
|
@ -254,18 +250,12 @@ _jit_arg_f(jit_state_t *_jit)
|
|||
return (jit_new_node_w(jit_code_arg_f, offset));
|
||||
}
|
||||
|
||||
jit_bool_t
|
||||
_jit_arg_f_reg_p(jit_state_t *_jit, jit_int32_t offset)
|
||||
{
|
||||
return (offset >= 0 && offset < NUM_FLOAT_REG_ARGS);
|
||||
}
|
||||
|
||||
jit_node_t *
|
||||
_jit_arg_d(jit_state_t *_jit)
|
||||
{
|
||||
jit_int32_t offset;
|
||||
assert(_jitc->function);
|
||||
if (_jitc->function->self.argf < NUM_FLOAT_REG_ARGS)
|
||||
if (jit_arg_f_reg_p(_jitc->function->self.argf))
|
||||
offset = _jitc->function->self.argf++;
|
||||
else {
|
||||
offset = _jitc->function->self.size;
|
||||
|
@ -274,17 +264,11 @@ _jit_arg_d(jit_state_t *_jit)
|
|||
return (jit_new_node_w(jit_code_arg_d, offset));
|
||||
}
|
||||
|
||||
jit_bool_t
|
||||
_jit_arg_d_reg_p(jit_state_t *_jit, jit_int32_t offset)
|
||||
{
|
||||
return (jit_arg_f_reg_p(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 < 5)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_extr_c(u, _R2 - v->u.w);
|
||||
else
|
||||
jit_ldxi_c(u, JIT_FP,
|
||||
|
@ -295,7 +279,7 @@ 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 < 5)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_extr_uc(u, _R2 - v->u.w);
|
||||
else
|
||||
jit_ldxi_uc(u, JIT_FP,
|
||||
|
@ -306,7 +290,7 @@ 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 < 5)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_extr_s(u, _R2 - v->u.w);
|
||||
else
|
||||
jit_ldxi_s(u, JIT_FP,
|
||||
|
@ -317,7 +301,7 @@ 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 < 5)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_extr_us(u, _R2 - v->u.w);
|
||||
else
|
||||
jit_ldxi_us(u, JIT_FP,
|
||||
|
@ -328,7 +312,7 @@ 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 < 5) {
|
||||
if (jit_arg_reg_p(v->u.w)) {
|
||||
#if __WORDSIZE == 32
|
||||
jit_movr(u, _R2 - v->u.w);
|
||||
#else
|
||||
|
@ -345,7 +329,7 @@ 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 < 5)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_extr_ui(u, _R2 - v->u.w);
|
||||
else
|
||||
jit_ldxi_ui(u, JIT_FP,
|
||||
|
@ -356,7 +340,7 @@ 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 < 5)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_movr(u, _R2 - v->u.w);
|
||||
else
|
||||
jit_ldxi_l(u, JIT_FP, v->u.w);
|
||||
|
@ -367,7 +351,7 @@ 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 < 5)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_movr(_R2 - v->u.w, u);
|
||||
else
|
||||
jit_stxi(v->u.w, JIT_FP, u);
|
||||
|
@ -378,7 +362,7 @@ _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 < 5)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_movi(_R2 - v->u.w, u);
|
||||
else {
|
||||
regno = jit_get_reg(jit_class_gpr);
|
||||
|
@ -392,7 +376,7 @@ 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 < 4)
|
||||
if (jit_arg_f_reg_p(v->u.w))
|
||||
jit_movr_f(u, _F0 - v->u.w);
|
||||
else
|
||||
jit_ldxi_f(u, JIT_FP,
|
||||
|
@ -407,7 +391,7 @@ 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 < 4)
|
||||
if (jit_arg_f_reg_p(v->u.w))
|
||||
jit_movr_f(_F0 - v->u.w, u);
|
||||
else
|
||||
jit_stxi_f(v->u.w
|
||||
|
@ -422,7 +406,7 @@ _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 < 4)
|
||||
if (jit_arg_f_reg_p(v->u.w))
|
||||
jit_movi_f(_F0 - v->u.w, u);
|
||||
else {
|
||||
regno = jit_get_reg(jit_class_fpr);
|
||||
|
@ -440,7 +424,7 @@ 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 < 4)
|
||||
if (jit_arg_f_reg_p(v->u.w))
|
||||
jit_movr_d(u, _F0 - v->u.w);
|
||||
else
|
||||
jit_ldxi_d(u, JIT_FP, v->u.w);
|
||||
|
@ -450,7 +434,7 @@ 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 < 4)
|
||||
if (jit_arg_f_reg_p(v->u.w))
|
||||
jit_movr_d(_F0 - v->u.w, u);
|
||||
else
|
||||
jit_stxi_d(v->u.w, JIT_FP, u);
|
||||
|
@ -461,7 +445,7 @@ _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 < 4)
|
||||
if (jit_arg_f_reg_p(v->u.w))
|
||||
jit_movi_d(_F0 - v->u.w, u);
|
||||
else {
|
||||
regno = jit_get_reg(jit_class_fpr);
|
||||
|
@ -475,7 +459,7 @@ void
|
|||
_jit_pushargr(jit_state_t *_jit, jit_int32_t u)
|
||||
{
|
||||
assert(_jitc->function);
|
||||
if (_jitc->function->call.argi < 5) {
|
||||
if (jit_arg_reg_p(_jitc->function->call.argi)) {
|
||||
jit_movr(_R2 - _jitc->function->call.argi, u);
|
||||
++_jitc->function->call.argi;
|
||||
}
|
||||
|
@ -490,7 +474,7 @@ _jit_pushargi(jit_state_t *_jit, jit_word_t u)
|
|||
{
|
||||
jit_int32_t regno;
|
||||
assert(_jitc->function);
|
||||
if (_jitc->function->call.argi < 5) {
|
||||
if (jit_arg_reg_p(_jitc->function->call.argi)) {
|
||||
jit_movi(_R2 - _jitc->function->call.argi, u);
|
||||
++_jitc->function->call.argi;
|
||||
}
|
||||
|
@ -507,7 +491,7 @@ void
|
|||
_jit_pushargr_f(jit_state_t *_jit, jit_int32_t u)
|
||||
{
|
||||
assert(_jitc->function);
|
||||
if (_jitc->function->call.argf < NUM_FLOAT_REG_ARGS) {
|
||||
if (jit_arg_f_reg_p(_jitc->function->call.argf)) {
|
||||
jit_movr_f(_F0 - _jitc->function->call.argf, u);
|
||||
++_jitc->function->call.argf;
|
||||
}
|
||||
|
@ -526,7 +510,7 @@ _jit_pushargi_f(jit_state_t *_jit, jit_float32_t u)
|
|||
{
|
||||
jit_int32_t regno;
|
||||
assert(_jitc->function);
|
||||
if (_jitc->function->call.argf < NUM_FLOAT_REG_ARGS) {
|
||||
if (jit_arg_f_reg_p(_jitc->function->call.argf)) {
|
||||
jit_movi_f(_F0 - _jitc->function->call.argf, u);
|
||||
++_jitc->function->call.argf;
|
||||
}
|
||||
|
@ -547,7 +531,7 @@ void
|
|||
_jit_pushargr_d(jit_state_t *_jit, jit_int32_t u)
|
||||
{
|
||||
assert(_jitc->function);
|
||||
if (_jitc->function->call.argf < NUM_FLOAT_REG_ARGS) {
|
||||
if (jit_arg_f_reg_p(_jitc->function->call.argf)) {
|
||||
jit_movr_d(_F0 - _jitc->function->call.argf, u);
|
||||
++_jitc->function->call.argf;
|
||||
}
|
||||
|
@ -562,7 +546,7 @@ _jit_pushargi_d(jit_state_t *_jit, jit_float64_t u)
|
|||
{
|
||||
jit_int32_t regno;
|
||||
assert(_jitc->function);
|
||||
if (_jitc->function->call.argf < NUM_FLOAT_REG_ARGS) {
|
||||
if (jit_arg_f_reg_p(_jitc->function->call.argf)) {
|
||||
jit_movi_d(_F0 - _jitc->function->call.argf, u);
|
||||
++_jitc->function->call.argf;
|
||||
}
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
#define rc(value) jit_class_##value
|
||||
#define rn(reg) (jit_regno(_rvs[jit_regno(reg)].spec))
|
||||
#define jit_arg_reg_p(i) ((i) >= 0 && (i) < 6)
|
||||
#define jit_arg_d_reg_p(i) ((i) >= 0 && (i) < 5)
|
||||
|
||||
/*
|
||||
* Prototypes
|
||||
|
@ -230,7 +232,7 @@ _jit_arg(jit_state_t *_jit)
|
|||
{
|
||||
jit_int32_t offset;
|
||||
assert(_jitc->function);
|
||||
if (_jitc->function->self.argi < 6)
|
||||
if (jit_arg_reg_p(_jitc->function->self.argi))
|
||||
offset = _jitc->function->self.argi++;
|
||||
else {
|
||||
offset = _jitc->function->self.size;
|
||||
|
@ -239,18 +241,12 @@ _jit_arg(jit_state_t *_jit)
|
|||
return (jit_new_node_w(jit_code_arg, offset));
|
||||
}
|
||||
|
||||
jit_bool_t
|
||||
_jit_arg_reg_p(jit_state_t *_jit, jit_int32_t offset)
|
||||
{
|
||||
return (offset >= 0 && offset < 6);
|
||||
}
|
||||
|
||||
jit_node_t *
|
||||
_jit_arg_f(jit_state_t *_jit)
|
||||
{
|
||||
jit_int32_t offset;
|
||||
assert(_jitc->function);
|
||||
if (_jitc->function->self.argi < 6)
|
||||
if (jit_arg_reg_p(_jitc->function->self.argi))
|
||||
offset = _jitc->function->self.argi++;
|
||||
else {
|
||||
offset = _jitc->function->self.size;
|
||||
|
@ -259,22 +255,16 @@ _jit_arg_f(jit_state_t *_jit)
|
|||
return (jit_new_node_w(jit_code_arg_f, offset));
|
||||
}
|
||||
|
||||
jit_bool_t
|
||||
_jit_arg_f_reg_p(jit_state_t *_jit, jit_int32_t offset)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
jit_node_t *
|
||||
_jit_arg_d(jit_state_t *_jit)
|
||||
{
|
||||
jit_int32_t offset;
|
||||
assert(_jitc->function);
|
||||
if (_jitc->function->self.argi < 5) {
|
||||
if (jit_arg_d_reg_p(_jitc->function->self.argi)) {
|
||||
offset = _jitc->function->self.argi;
|
||||
_jitc->function->self.argi += 2;
|
||||
}
|
||||
else if (_jitc->function->self.argi < 6) {
|
||||
else if (jit_arg_reg_p(_jitc->function->self.argi)) {
|
||||
offset = _jitc->function->self.argi++;
|
||||
_jitc->function->self.size += sizeof(jit_float32_t);
|
||||
}
|
||||
|
@ -285,69 +275,55 @@ _jit_arg_d(jit_state_t *_jit)
|
|||
return (jit_new_node_w(jit_code_arg_d, offset));
|
||||
}
|
||||
|
||||
jit_bool_t
|
||||
_jit_arg_d_reg_p(jit_state_t *_jit, jit_int32_t offset)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
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 < 6)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_extr_c(u, _I0 + v->u.w);
|
||||
else {
|
||||
assert(__BYTE_ORDER == __BIG_ENDIAN && __WORDSIZE == 32);
|
||||
else
|
||||
jit_ldxi_c(u, JIT_FP,
|
||||
v->u.w + (__WORDSIZE >> 3) - sizeof(jit_int8_t));
|
||||
}
|
||||
}
|
||||
|
||||
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 < 6)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_extr_uc(u, _I0 + v->u.w);
|
||||
else {
|
||||
assert(__BYTE_ORDER == __BIG_ENDIAN && __WORDSIZE == 32);
|
||||
else
|
||||
jit_ldxi_uc(u, JIT_FP,
|
||||
v->u.w + (__WORDSIZE >> 3) - sizeof(jit_uint8_t));
|
||||
}
|
||||
}
|
||||
|
||||
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 < 6)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_extr_s(u, _I0 + v->u.w);
|
||||
else {
|
||||
assert(__BYTE_ORDER == __BIG_ENDIAN && __WORDSIZE == 32);
|
||||
else
|
||||
jit_ldxi_s(u, JIT_FP,
|
||||
v->u.w + (__WORDSIZE >> 3) - sizeof(jit_int16_t));
|
||||
}
|
||||
}
|
||||
|
||||
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 < 6)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_extr_us(u, _I0 + v->u.w);
|
||||
else {
|
||||
assert(__BYTE_ORDER == __BIG_ENDIAN && __WORDSIZE == 32);
|
||||
else
|
||||
jit_ldxi_us(u, JIT_FP,
|
||||
v->u.w + (__WORDSIZE >> 3) - sizeof(jit_uint16_t));
|
||||
}
|
||||
}
|
||||
|
||||
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 < 6)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_movr(u, _I0 + v->u.w);
|
||||
else
|
||||
jit_ldxi_i(u, JIT_FP, v->u.w);
|
||||
|
@ -357,7 +333,7 @@ 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 < 6)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_movr(_I0 + v->u.w, u);
|
||||
else
|
||||
jit_stxi(v->u.w, JIT_FP, u);
|
||||
|
@ -368,7 +344,7 @@ _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 < 6)
|
||||
if (jit_arg_reg_p(v->u.w))
|
||||
jit_movi(_I0 + v->u.w, u);
|
||||
else {
|
||||
regno = jit_get_reg(jit_class_gpr);
|
||||
|
@ -383,7 +359,7 @@ _jit_getarg_f(jit_state_t *_jit, jit_int32_t u, jit_node_t *v)
|
|||
{
|
||||
assert(v->code == jit_code_arg_f);
|
||||
assert(_jitc->function);
|
||||
if (v->u.w < 6) {
|
||||
if (jit_arg_reg_p(v->u.w)) {
|
||||
jit_stxi(-4, JIT_FP, _I0 + v->u.w);
|
||||
jit_ldxi_f(u, JIT_FP, -4);
|
||||
}
|
||||
|
@ -395,7 +371,7 @@ 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 < 6) {
|
||||
if (jit_arg_reg_p(v->u.w)) {
|
||||
jit_stxi_f(-4, JIT_FP, u);
|
||||
jit_ldxi(_I0 + v->u.w, JIT_FP, -4);
|
||||
}
|
||||
|
@ -410,7 +386,7 @@ _jit_putargi_f(jit_state_t *_jit, jit_float32_t u, jit_node_t *v)
|
|||
assert(v->code == jit_code_arg_f);
|
||||
regno = jit_get_reg(jit_class_fpr);
|
||||
jit_movi_f(regno, u);
|
||||
if (v->u.w < 6) {
|
||||
if (jit_arg_reg_p(v->u.w)) {
|
||||
jit_stxi_f(-4, JIT_FP, regno);
|
||||
jit_ldxi(_I0 + v->u.w, JIT_FP, -4);
|
||||
}
|
||||
|
@ -424,12 +400,12 @@ _jit_getarg_d(jit_state_t *_jit, jit_int32_t u, jit_node_t *v)
|
|||
{
|
||||
assert(v->code == jit_code_arg_d);
|
||||
assert(_jitc->function);
|
||||
if (v->u.w < 5) {
|
||||
if (jit_arg_d_reg_p(v->u.w)) {
|
||||
jit_stxi(-8, JIT_FP, _I0 + v->u.w);
|
||||
jit_stxi(-4, JIT_FP, _I0 + v->u.w + 1);
|
||||
jit_ldxi_d(u, JIT_FP, -8);
|
||||
}
|
||||
else if (v->u.w < 6) {
|
||||
else if (jit_arg_reg_p(v->u.w)) {
|
||||
jit_stxi(-8, JIT_FP, _I0 + v->u.w);
|
||||
jit_ldxi_f(u, JIT_FP, -8);
|
||||
jit_ldxi_f(u + 1, JIT_FP, stack_framesize);
|
||||
|
@ -445,12 +421,12 @@ _jit_putargr_d(jit_state_t *_jit, jit_int32_t u, jit_node_t *v)
|
|||
{
|
||||
jit_int32_t regno;
|
||||
assert(v->code == jit_code_arg_d);
|
||||
if (v->u.w < 5) {
|
||||
if (jit_arg_d_reg_p(v->u.w)) {
|
||||
jit_stxi_d(-8, JIT_FP, u);
|
||||
jit_ldxi(_I0 + v->u.w, JIT_FP, -8);
|
||||
jit_ldxi(_I0 + v->u.w + 1, JIT_FP, -4);
|
||||
}
|
||||
if (v->u.w < 6) {
|
||||
else if (jit_arg_reg_p(v->u.w)) {
|
||||
regno = jit_get_reg(jit_class_gpr);
|
||||
jit_stxi_d(-8, JIT_FP, u);
|
||||
jit_ldxi(_I0 + v->u.w, JIT_FP, -8);
|
||||
|
@ -478,12 +454,12 @@ _jit_putargi_d(jit_state_t *_jit, jit_float64_t u, jit_node_t *v)
|
|||
assert(v->code == jit_code_arg_d);
|
||||
regno = jit_get_reg(jit_class_fpr);
|
||||
jit_movi_d(regno, u);
|
||||
if (v->u.w < 5) {
|
||||
if (jit_arg_d_reg_p(v->u.w)) {
|
||||
jit_stxi_d(-8, JIT_FP, regno);
|
||||
jit_ldxi(_I0 + v->u.w, JIT_FP, -8);
|
||||
jit_ldxi(_I0 + v->u.w + 1, JIT_FP, -4);
|
||||
}
|
||||
else if (v->u.w < 6) {
|
||||
else if (jit_arg_reg_p(v->u.w)) {
|
||||
gpr = jit_get_reg(jit_class_gpr);
|
||||
jit_stxi_d(-8, JIT_FP, regno);
|
||||
jit_ldxi(_I0 + v->u.w, JIT_FP, -8);
|
||||
|
@ -509,7 +485,7 @@ _jit_putargi_d(jit_state_t *_jit, jit_float64_t u, jit_node_t *v)
|
|||
void
|
||||
_jit_pushargr(jit_state_t *_jit, jit_int32_t u)
|
||||
{
|
||||
if (_jitc->function->call.argi < 6) {
|
||||
if (jit_arg_reg_p(_jitc->function->call.argi)) {
|
||||
jit_movr(_O0 + _jitc->function->call.argi, u);
|
||||
++_jitc->function->call.argi;
|
||||
}
|
||||
|
@ -523,7 +499,7 @@ void
|
|||
_jit_pushargi(jit_state_t *_jit, jit_word_t u)
|
||||
{
|
||||
jit_int32_t regno;
|
||||
if (_jitc->function->call.argi < 6) {
|
||||
if (jit_arg_reg_p(_jitc->function->call.argi)) {
|
||||
jit_movi(_O0 + _jitc->function->call.argi, u);
|
||||
++_jitc->function->call.argi;
|
||||
}
|
||||
|
@ -539,7 +515,7 @@ _jit_pushargi(jit_state_t *_jit, jit_word_t u)
|
|||
void
|
||||
_jit_pushargr_f(jit_state_t *_jit, jit_int32_t u)
|
||||
{
|
||||
if (_jitc->function->call.argi < 6) {
|
||||
if (jit_arg_reg_p(_jitc->function->call.argi)) {
|
||||
jit_stxi_f(-4, JIT_FP, u);
|
||||
jit_ldxi(_O0 + _jitc->function->call.argi, JIT_FP, -4);
|
||||
++_jitc->function->call.argi;
|
||||
|
@ -556,7 +532,7 @@ _jit_pushargi_f(jit_state_t *_jit, jit_float32_t u)
|
|||
jit_int32_t regno;
|
||||
regno = jit_get_reg(jit_class_fpr);
|
||||
jit_movi_f(regno, u);
|
||||
if (_jitc->function->call.argi < 6) {
|
||||
if (jit_arg_reg_p(_jitc->function->call.argi)) {
|
||||
jit_stxi_f(-4, JIT_FP, regno);
|
||||
jit_ldxi(_O0 + _jitc->function->call.argi, JIT_FP, -4);
|
||||
++_jitc->function->call.argi;
|
||||
|
@ -571,13 +547,13 @@ _jit_pushargi_f(jit_state_t *_jit, jit_float32_t u)
|
|||
void
|
||||
_jit_pushargr_d(jit_state_t *_jit, jit_int32_t u)
|
||||
{
|
||||
if (_jitc->function->call.argi < 5) {
|
||||
if (jit_arg_d_reg_p(_jitc->function->call.argi)) {
|
||||
jit_stxi_d(-8, JIT_FP, u);
|
||||
jit_ldxi(_O0 + _jitc->function->call.argi, JIT_FP, -8);
|
||||
jit_ldxi(_O0 + _jitc->function->call.argi + 1, JIT_FP, -4);
|
||||
_jitc->function->call.argi += 2;
|
||||
}
|
||||
else if (_jitc->function->call.argi < 6) {
|
||||
else if (jit_arg_reg_p(_jitc->function->call.argi)) {
|
||||
jit_stxi_f(-8, JIT_FP, u);
|
||||
jit_ldxi(_O0 + _jitc->function->call.argi, JIT_FP, -8);
|
||||
++_jitc->function->call.argi;
|
||||
|
@ -599,13 +575,13 @@ _jit_pushargi_d(jit_state_t *_jit, jit_float64_t u)
|
|||
jit_int32_t regno;
|
||||
regno = jit_get_reg(jit_class_fpr);
|
||||
jit_movi_d(regno, u);
|
||||
if (_jitc->function->call.argi < 5) {
|
||||
if (jit_arg_d_reg_p(_jitc->function->call.argi)) {
|
||||
jit_stxi_d(-8, JIT_FP, regno);
|
||||
jit_ldxi(_O0 + _jitc->function->call.argi, JIT_FP, -8);
|
||||
jit_ldxi(_O0 + _jitc->function->call.argi + 1, JIT_FP, -4);
|
||||
_jitc->function->call.argi += 2;
|
||||
}
|
||||
else if (_jitc->function->call.argi < 6) {
|
||||
else if (jit_arg_reg_p(_jitc->function->call.argi)) {
|
||||
jit_stxi_f(-8, JIT_FP, regno);
|
||||
jit_ldxi(_O0 + _jitc->function->call.argi, JIT_FP, -8);
|
||||
++_jitc->function->call.argi;
|
||||
|
|
|
@ -22,16 +22,21 @@
|
|||
|
||||
#define rc(value) jit_class_##value
|
||||
#define rn(reg) (jit_regno(_rvs[jit_regno(reg)].spec))
|
||||
|
||||
#if __X32
|
||||
# define jit_arg_reg_p(i) 0
|
||||
# define jit_arg_f_reg_p(i) 0
|
||||
# define stack_framesize 20
|
||||
# define stack_adjust 12
|
||||
# define CVT_OFFSET -12
|
||||
# define REAL_WORDSIZE 4
|
||||
#else
|
||||
# if __CYGWIN__
|
||||
# define jit_arg_reg_p(i) ((i) >= 0 && (i) < 4)
|
||||
# define jit_arg_f_reg_p(i) jit_arg_reg_p(i)
|
||||
# define stack_framesize 152
|
||||
# else
|
||||
# define jit_arg_reg_p(i) ((i) >= 0 && (i) < 6)
|
||||
# define jit_arg_f_reg_p(i) ((i) >= 0 && (i) < 8)
|
||||
# define stack_framesize 56
|
||||
# endif
|
||||
# define stack_adjust 8
|
||||
|
@ -39,7 +44,6 @@
|
|||
# define REAL_WORDSIZE 8
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Prototypes
|
||||
*/
|
||||
|
@ -490,20 +494,6 @@ _jit_arg(jit_state_t *_jit)
|
|||
return (jit_new_node_w(jit_code_arg, offset));
|
||||
}
|
||||
|
||||
jit_bool_t
|
||||
_jit_arg_reg_p(jit_state_t *_jit, jit_int32_t offset)
|
||||
{
|
||||
#if __X32
|
||||
return (0);
|
||||
#else
|
||||
# if __CYGWIN__
|
||||
return (offset >= 0 && offset < 4);
|
||||
# else
|
||||
return (offset >= 0 && offset < 6);
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
jit_node_t *
|
||||
_jit_arg_f(jit_state_t *_jit)
|
||||
{
|
||||
|
@ -529,20 +519,6 @@ _jit_arg_f(jit_state_t *_jit)
|
|||
return (jit_new_node_w(jit_code_arg_f, offset));
|
||||
}
|
||||
|
||||
jit_bool_t
|
||||
_jit_arg_f_reg_p(jit_state_t *_jit, jit_int32_t offset)
|
||||
{
|
||||
#if __X32
|
||||
return (0);
|
||||
#else
|
||||
# if __CYGWIN__
|
||||
return (offset >= 0 && offset < 4);
|
||||
# else
|
||||
return (offset >= 0 && offset < 8);
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
jit_node_t *
|
||||
_jit_arg_d(jit_state_t *_jit)
|
||||
{
|
||||
|
@ -568,12 +544,6 @@ _jit_arg_d(jit_state_t *_jit)
|
|||
return (jit_new_node_w(jit_code_arg_d, offset));
|
||||
}
|
||||
|
||||
jit_bool_t
|
||||
_jit_arg_d_reg_p(jit_state_t *_jit, jit_int32_t offset)
|
||||
{
|
||||
return (jit_arg_f_reg_p(offset));
|
||||
}
|
||||
|
||||
void
|
||||
_jit_getarg_c(jit_state_t *_jit, jit_int32_t u, jit_node_t *v)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue