mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-31 17:30:24 +02:00
Refactor some bits from x86 to lightening
This commit is contained in:
parent
f7080facb4
commit
fc9b474da6
3 changed files with 45 additions and 43 deletions
28
lightening.h
28
lightening.h
|
@ -65,6 +65,20 @@ jit_same_fprs (jit_fpr_t a, jit_fpr_t b)
|
|||
return jit_fpr_regno (a) == jit_fpr_regno (b);
|
||||
}
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
# include "lightening/x86.h"
|
||||
#elif defined(__mips__)
|
||||
# include "lightening/mips.h"
|
||||
#elif defined(__arm__)
|
||||
# include "lightening/arm.h"
|
||||
#elif defined(__ppc__) || defined(__powerpc__)
|
||||
# include "lightening/ppc.h"
|
||||
#elif defined(__aarch64__)
|
||||
# include "lightening/aarch64.h"
|
||||
#elif defined(__s390__) || defined(__s390x__)
|
||||
# include "lightening/s390.h"
|
||||
#endif
|
||||
|
||||
enum jit_reloc_kind
|
||||
{
|
||||
JIT_RELOC_ABSOLUTE,
|
||||
|
@ -87,20 +101,6 @@ typedef struct jit_reloc
|
|||
# define JIT_API extern
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
# include "lightening/x86.h"
|
||||
#elif defined(__mips__)
|
||||
# include "lightening/mips.h"
|
||||
#elif defined(__arm__)
|
||||
# include "lightening/arm.h"
|
||||
#elif defined(__ppc__) || defined(__powerpc__)
|
||||
# include "lightening/ppc.h"
|
||||
#elif defined(__aarch64__)
|
||||
# include "lightening/aarch64.h"
|
||||
#elif defined(__s390__) || defined(__s390x__)
|
||||
# include "lightening/s390.h"
|
||||
#endif
|
||||
|
||||
typedef struct jit_state jit_state_t;
|
||||
|
||||
enum jit_operand_abi
|
||||
|
|
|
@ -76,6 +76,8 @@ static void jit_try_shorten(jit_state_t *_jit, jit_reloc_t reloc,
|
|||
|
||||
struct abi_arg_iterator;
|
||||
|
||||
static jit_bool_t is_fpr_arg(enum jit_operand_abi arg);
|
||||
static jit_bool_t is_gpr_arg(enum jit_operand_abi arg);
|
||||
static void reset_abi_arg_iterator(struct abi_arg_iterator *iter, size_t argc,
|
||||
const jit_operand_t *args);
|
||||
static void next_abi_arg(struct abi_arg_iterator *iter,
|
||||
|
@ -437,6 +439,35 @@ jit_patch_there(jit_state_t* _jit, jit_reloc_t reloc, jit_pointer_t addr)
|
|||
FOR_EACH_INSTRUCTION(IMPL_INSTRUCTION)
|
||||
#undef IMPL_INSTRUCTION
|
||||
|
||||
static jit_bool_t
|
||||
is_fpr_arg(enum jit_operand_abi arg)
|
||||
{
|
||||
switch (arg)
|
||||
{
|
||||
case JIT_OPERAND_ABI_UINT8:
|
||||
case JIT_OPERAND_ABI_INT8:
|
||||
case JIT_OPERAND_ABI_UINT16:
|
||||
case JIT_OPERAND_ABI_INT16:
|
||||
case JIT_OPERAND_ABI_UINT32:
|
||||
case JIT_OPERAND_ABI_INT32:
|
||||
case JIT_OPERAND_ABI_UINT64:
|
||||
case JIT_OPERAND_ABI_INT64:
|
||||
case JIT_OPERAND_ABI_POINTER:
|
||||
return 0;
|
||||
case JIT_OPERAND_ABI_FLOAT:
|
||||
case JIT_OPERAND_ABI_DOUBLE:
|
||||
return 1;
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
static jit_bool_t
|
||||
is_gpr_arg(enum jit_operand_abi arg)
|
||||
{
|
||||
return !is_fpr_arg(arg);
|
||||
}
|
||||
|
||||
static void
|
||||
abi_imm_to_gpr(jit_state_t *_jit, enum jit_operand_abi abi, jit_gpr_t dst,
|
||||
intptr_t imm)
|
||||
|
|
|
@ -216,35 +216,6 @@ jit_init(jit_state_t *_jit)
|
|||
return jit_cpu.sse2;
|
||||
}
|
||||
|
||||
static jit_bool_t
|
||||
is_fpr_arg(enum jit_operand_abi arg)
|
||||
{
|
||||
switch (arg)
|
||||
{
|
||||
case JIT_OPERAND_ABI_UINT8:
|
||||
case JIT_OPERAND_ABI_INT8:
|
||||
case JIT_OPERAND_ABI_UINT16:
|
||||
case JIT_OPERAND_ABI_INT16:
|
||||
case JIT_OPERAND_ABI_UINT32:
|
||||
case JIT_OPERAND_ABI_INT32:
|
||||
case JIT_OPERAND_ABI_UINT64:
|
||||
case JIT_OPERAND_ABI_INT64:
|
||||
case JIT_OPERAND_ABI_POINTER:
|
||||
return 0;
|
||||
case JIT_OPERAND_ABI_FLOAT:
|
||||
case JIT_OPERAND_ABI_DOUBLE:
|
||||
return 1;
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
static jit_bool_t
|
||||
is_gpr_arg(enum jit_operand_abi arg)
|
||||
{
|
||||
return !is_fpr_arg(arg);
|
||||
}
|
||||
|
||||
static const jit_gpr_t abi_gpr_args[] = {
|
||||
#if __X32
|
||||
/* No GPRs in args. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue