Alien-LibJIT
view release on metacpan or search on metacpan
libjit/jit/jit-rules-x86-64.c view on Meta::CPAN
#define X86_64_REG_ST2 34
#define X86_64_REG_ST3 35
#define X86_64_REG_ST4 36
#define X86_64_REG_ST5 37
#define X86_64_REG_ST6 38
#define X86_64_REG_ST7 39
/*
* Determine if a pseudo register number is general, xmm or fpu.
*/
#define IS_GENERAL_REG(reg) (((reg) & ~0x0f) == 0)
#define IS_XMM_REG(reg) (((reg) & ~0x0f) == 0x10)
#define IS_FPU_REG(reg) (((reg) & ~0x0f) == 0x20)
/*
* Scratch register, that is used for calls via register and
* for loading the exception pc to the setjmp buffer.
* This register *MUST* not be used for parameter passing and
* *MUST* not be a callee saved register.
* For SysV abi R11 is perfect.
*/
#define X86_64_SCRATCH X86_64_R11
/*
* Set this definition to 1 if the OS supports the SysV red zone.
* This is a 128 byte area below the stack pointer that is guaranteed
* to be not modified by interrupts or signal handlers.
* This allows us to use a temporary area on the stack without
* having to modify the stack pointer saving us two instructions.
* TODO: Make this a configure switch.
*/
#define HAVE_RED_ZONE 1
/*
* Some declarations that should be replaced by querying the cpuinfo
* if generating code for the current cpu.
*/
/*
#define HAVE_X86_SSE_4_1 0
#define HAVE_X86_SSE_4 0
#define HAVE_X86_SSE_3 0
#define HAVE_X86_FISTTP 0
*/
#define TODO() \
do { \
fprintf(stderr, "TODO at %s, %d\n", __FILE__, (int)__LINE__); \
} while(0)
/*
* Setup or teardown the x86 code output process.
*/
#define jit_cache_setup_output(needed) \
unsigned char *inst = gen->ptr; \
_jit_gen_check_space(gen, (needed))
#define jit_cache_end_output() \
gen->ptr = inst
/*
* Set this to 1 for debugging fixups
*/
#define DEBUG_FIXUPS 0
/*
* The maximum block size copied inline
*/
#define _JIT_MAX_MEMCPY_INLINE 0x40
/*
* va_list type as specified in x86_64 sysv abi version 0.99
* Figure 3.34
*/
typedef struct
{
unsigned int gp_offset;
unsigned int fp_offset;
void *overflow_arg_area;
void *reg_save_area;
} _jit_va_list;
/* Registers used for INTEGER arguments */
static int _jit_word_arg_regs[] = {X86_64_REG_RDI, X86_64_REG_RSI,
X86_64_REG_RDX, X86_64_REG_RCX,
X86_64_REG_R8, X86_64_REG_R9};
#define _jit_num_word_regs 6
/* Registers used for float arguments */
static int _jit_float_arg_regs[] = {X86_64_REG_XMM0, X86_64_REG_XMM1,
X86_64_REG_XMM2, X86_64_REG_XMM3,
X86_64_REG_XMM4, X86_64_REG_XMM5,
X86_64_REG_XMM6, X86_64_REG_XMM7};
#define _jit_num_float_regs 8
/* Registers used for returning INTEGER values */
static int _jit_word_return_regs[] = {X86_64_REG_RAX, X86_64_REG_RDX};
#define _jit_num_word_return_regs 2
/* Registers used for returning sse values */
static int _jit_sse_return_regs[] = {X86_64_REG_XMM0, X86_64_REG_XMM1};
#define _jit_num_sse_return_regs 2
/*
* X86_64 register classes
*/
static _jit_regclass_t *x86_64_reg; /* X86_64 general purpose registers */
static _jit_regclass_t *x86_64_creg; /* X86_64 call clobbered general */
/* purpose registers */
static _jit_regclass_t *x86_64_dreg; /* general purpose registers that */
/* can be used as divisor */
/* (all but %rax and %rdx) */
static _jit_regclass_t *x86_64_rreg; /* general purpose registers not used*/
/* for returning values */
static _jit_regclass_t *x86_64_sreg; /* general purpose registers that can*/
/* be used for the value to be */
/* shifted (all but %rcx)*/
/* for returning values */
static _jit_regclass_t *x86_64_freg; /* X86_64 fpu registers */
static _jit_regclass_t *x86_64_xreg; /* X86_64 xmm registers */
void
( run in 0.810 second using v1.01-cache-2.11-cpan-02777c243ea )