mirror of
https://github.com/simple64/simple64.git
synced 2026-11-16 19:43:15 +01:00
update parallel rsp
This commit is contained in:
1 parent
14673b1b61
commit
6f90f88201
136 files changed
+23411
-5700
No files matched your search
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright 2000, 2001, 2002, 2012-2019 Free Software Foundation, Inc.
|
||||
# Copyright 2000, 2001, 2002, 2012-2023 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is part of GNU lightning.
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2019 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2012-2023 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of GNU lightning.
|
||||
*
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#if defined(__hpux) && defined(__hppa__)
|
||||
# include <machine/param.h>
|
||||
@@ -123,6 +124,11 @@ typedef jit_int32_t jit_bool_t;
|
||||
typedef jit_int32_t jit_gpr_t;
|
||||
typedef jit_int32_t jit_fpr_t;
|
||||
|
||||
#if !defined(__powerpc__) && \
|
||||
(defined(__POWERPC__) || defined(__ppc__) || defined(__PPC__))
|
||||
#define __powerpc__ 1
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
# include <lightning/jit_x86.h>
|
||||
#elif defined(__mips__)
|
||||
@@ -145,6 +151,8 @@ typedef jit_int32_t jit_fpr_t;
|
||||
# include <lightning/jit_alpha.h>
|
||||
#elif defined(__riscv)
|
||||
# include <lightning/jit_riscv.h>
|
||||
#elif defined(__loongarch__)
|
||||
# include <lightning/jit_loongarch.h>
|
||||
#endif
|
||||
|
||||
#define jit_flag_node 0x0001 /* patch node not absolute */
|
||||
@@ -182,6 +190,8 @@ typedef enum {
|
||||
#define jit_align(u) jit_new_node_w(jit_code_align, u)
|
||||
jit_code_live, jit_code_align,
|
||||
jit_code_save, jit_code_load,
|
||||
#define jit_skip(u) jit_new_node_w(jit_code_skip, u)
|
||||
jit_code_skip,
|
||||
#define jit_name(u) _jit_name(_jit,u)
|
||||
jit_code_name,
|
||||
#define jit_note(u, v) _jit_note(_jit, u, v)
|
||||
@@ -202,27 +212,80 @@ typedef enum {
|
||||
#define jit_allocar(u, v) _jit_allocar(_jit,u,v)
|
||||
jit_code_allocai, jit_code_allocar,
|
||||
|
||||
#define jit_arg() _jit_arg(_jit)
|
||||
jit_code_arg,
|
||||
#define jit_arg_c() _jit_arg(_jit, jit_code_arg_c)
|
||||
#define jit_arg_s() _jit_arg(_jit, jit_code_arg_s)
|
||||
#define jit_arg_i() _jit_arg(_jit, jit_code_arg_i)
|
||||
# if __WORDSIZE == 32
|
||||
# define jit_arg() jit_arg_i()
|
||||
#else
|
||||
# define jit_arg_l() _jit_arg(_jit, jit_code_arg_l)
|
||||
# define jit_arg() jit_arg_l()
|
||||
#endif
|
||||
jit_code_arg_c, jit_code_arg_s,
|
||||
jit_code_arg_i, jit_code_arg_l,
|
||||
#if __WORDSIZE == 32
|
||||
# define jit_code_arg jit_code_arg_i
|
||||
#else
|
||||
# define jit_code_arg jit_code_arg_l
|
||||
#endif
|
||||
|
||||
#define jit_getarg_c(u,v) _jit_getarg_c(_jit,u,v)
|
||||
#define jit_getarg_uc(u,v) _jit_getarg_uc(_jit,u,v)
|
||||
jit_code_getarg_c, jit_code_getarg_uc,
|
||||
#define jit_getarg_s(u,v) _jit_getarg_s(_jit,u,v)
|
||||
#define jit_getarg_us(u,v) _jit_getarg_us(_jit,u,v)
|
||||
jit_code_getarg_s, jit_code_getarg_us,
|
||||
#define jit_getarg_i(u,v) _jit_getarg_i(_jit,u,v)
|
||||
#if __WORDSIZE == 32
|
||||
# define jit_getarg(u,v) jit_getarg_i(u,v)
|
||||
#else
|
||||
# define jit_getarg(u,v) jit_getarg_l(u,v)
|
||||
# define jit_getarg_ui(u,v) _jit_getarg_ui(_jit,u,v)
|
||||
# define jit_getarg_l(u,v) _jit_getarg_l(_jit,u,v)
|
||||
# define jit_getarg(u,v) jit_getarg_l(u,v)
|
||||
#endif
|
||||
jit_code_getarg_c, jit_code_getarg_uc,
|
||||
jit_code_getarg_s, jit_code_getarg_us,
|
||||
jit_code_getarg_i, jit_code_getarg_ui,
|
||||
jit_code_getarg_l,
|
||||
# define jit_putargr(u,v) _jit_putargr(_jit,u,v)
|
||||
# define jit_putargi(u,v) _jit_putargi(_jit,u,v)
|
||||
jit_code_putargr, jit_code_putargi,
|
||||
#if __WORDSIZE == 32
|
||||
# define jit_code_getarg jit_code_getarg_i
|
||||
#else
|
||||
# define jit_code_getarg jit_code_getarg_l
|
||||
#endif
|
||||
|
||||
#define jit_putargr_c(u,v) _jit_putargr(_jit,u,v,jit_code_putargr_c)
|
||||
#define jit_putargi_c(u,v) _jit_putargi(_jit,u,v,jit_code_putargi_c)
|
||||
#define jit_putargr_uc(u,v) _jit_putargr(_jit,u,v,jit_code_putargr_uc)
|
||||
#define jit_putargi_uc(u,v) _jit_putargi(_jit,u,v,jit_code_putargi_uc)
|
||||
#define jit_putargr_s(u,v) _jit_putargr(_jit,u,v,jit_code_putargr_s)
|
||||
#define jit_putargi_s(u,v) _jit_putargi(_jit,u,v,jit_code_putargi_s)
|
||||
#define jit_putargr_us(u,v) _jit_putargr(_jit,u,v,jit_code_putargr_us)
|
||||
#define jit_putargi_us(u,v) _jit_putargi(_jit,u,v,jit_code_putargi_us)
|
||||
#define jit_putargr_i(u,v) _jit_putargr(_jit,u,v,jit_code_putargr_i)
|
||||
#define jit_putargi_i(u,v) _jit_putargi(_jit,u,v,jit_code_putargi_i)
|
||||
#if __WORDSIZE == 32
|
||||
# define jit_putargr(u,v) jit_putargr_i(u,v)
|
||||
# define jit_putargi(u,v) jit_putargi_i(u,v)
|
||||
#else
|
||||
# define jit_putargr_ui(u,v) _jit_putargr(_jit,u,v,jit_code_putargr_ui)
|
||||
# define jit_putargi_ui(u,v) _jit_putargi(_jit,u,v,jit_code_putargi_ui)
|
||||
# define jit_putargr_l(u,v) _jit_putargr(_jit,u,v,jit_code_putargr_l)
|
||||
# define jit_putargi_l(u,v) _jit_putargi(_jit,u,v,jit_code_putargi_l)
|
||||
# define jit_putargr(u,v) jit_putargr_l(u,v)
|
||||
# define jit_putargi(u,v) jit_putargi_l(u,v)
|
||||
#endif
|
||||
jit_code_putargr_c, jit_code_putargi_c,
|
||||
jit_code_putargr_uc, jit_code_putargi_uc,
|
||||
jit_code_putargr_s, jit_code_putargi_s,
|
||||
jit_code_putargr_us, jit_code_putargi_us,
|
||||
jit_code_putargr_i, jit_code_putargi_i,
|
||||
jit_code_putargr_ui, jit_code_putargi_ui,
|
||||
jit_code_putargr_l, jit_code_putargi_l,
|
||||
#if __WORDSIZE == 32
|
||||
# define jit_code_putargr jit_code_putargr_i
|
||||
# define jit_code_putargi jit_code_putargi_i
|
||||
#else
|
||||
# define jit_code_putargr jit_code_putargr_l
|
||||
# define jit_code_putargi jit_code_putargi_l
|
||||
#endif
|
||||
|
||||
#define jit_va_start(u) jit_new_node_w(jit_code_va_start, u)
|
||||
jit_code_va_start,
|
||||
@@ -339,6 +402,15 @@ typedef enum {
|
||||
#define jit_movr(u,v) jit_new_node_ww(jit_code_movr,u,v)
|
||||
#define jit_movi(u,v) jit_new_node_ww(jit_code_movi,u,v)
|
||||
jit_code_movr, jit_code_movi,
|
||||
|
||||
#define jit_movnr(u,v,w) jit_new_node_www(jit_code_movnr,u,v,w)
|
||||
#define jit_movzr(u,v,w) jit_new_node_www(jit_code_movzr,u,v,w)
|
||||
jit_code_movnr, jit_code_movzr,
|
||||
|
||||
jit_code_casr, jit_code_casi,
|
||||
#define jit_casr(u, v, w, x) jit_new_node_wwq(jit_code_casr, u, v, w, x)
|
||||
#define jit_casi(u, v, w, x) jit_new_node_wwq(jit_code_casi, u, v, w, x)
|
||||
|
||||
#define jit_extr_c(u,v) jit_new_node_ww(jit_code_extr_c,u,v)
|
||||
#define jit_extr_uc(u,v) jit_new_node_ww(jit_code_extr_uc,u,v)
|
||||
jit_code_extr_c, jit_code_extr_uc,
|
||||
@@ -351,6 +423,18 @@ typedef enum {
|
||||
#endif
|
||||
jit_code_extr_i, jit_code_extr_ui,
|
||||
|
||||
#define jit_bswapr_us(u,v) jit_new_node_ww(jit_code_bswapr_us,u,v)
|
||||
jit_code_bswapr_us,
|
||||
#define jit_bswapr_ui(u,v) jit_new_node_ww(jit_code_bswapr_ui,u,v)
|
||||
jit_code_bswapr_ui,
|
||||
#define jit_bswapr_ul(u,v) jit_new_node_ww(jit_code_bswapr_ul,u,v)
|
||||
jit_code_bswapr_ul,
|
||||
#if __WORDSIZE == 32
|
||||
#define jit_bswapr(u,v) jit_new_node_ww(jit_code_bswapr_ui,u,v)
|
||||
#else
|
||||
#define jit_bswapr(u,v) jit_new_node_ww(jit_code_bswapr_ul,u,v)
|
||||
#endif
|
||||
|
||||
#define jit_htonr_us(u,v) jit_new_node_ww(jit_code_htonr_us,u,v)
|
||||
#define jit_ntohr_us(u,v) jit_new_node_ww(jit_code_htonr_us,u,v)
|
||||
jit_code_htonr_us,
|
||||
@@ -537,33 +621,106 @@ typedef enum {
|
||||
|
||||
#define jit_prepare() _jit_prepare(_jit)
|
||||
jit_code_prepare,
|
||||
#define jit_pushargr(u) _jit_pushargr(_jit,u)
|
||||
#define jit_pushargi(u) _jit_pushargi(_jit,u)
|
||||
jit_code_pushargr, jit_code_pushargi,
|
||||
|
||||
#define jit_pushargr_c(u) _jit_pushargr(_jit,u,jit_code_pushargr_c)
|
||||
#define jit_pushargi_c(u) _jit_pushargi(_jit,u,jit_code_pushargi_c)
|
||||
#define jit_pushargr_uc(u) _jit_pushargr(_jit,u,jit_code_pushargr_uc)
|
||||
#define jit_pushargi_uc(u) _jit_pushargi(_jit,u,jit_code_pushargi_uc)
|
||||
#define jit_pushargr_s(u) _jit_pushargr(_jit,u,jit_code_pushargr_s)
|
||||
#define jit_pushargi_s(u) _jit_pushargi(_jit,u,jit_code_pushargi_s)
|
||||
#define jit_pushargr_us(u) _jit_pushargr(_jit,u,jit_code_pushargr_us)
|
||||
#define jit_pushargi_us(u) _jit_pushargi(_jit,u,jit_code_pushargi_us)
|
||||
#define jit_pushargr_i(u) _jit_pushargr(_jit,u,jit_code_pushargr_i)
|
||||
#define jit_pushargi_i(u) _jit_pushargi(_jit,u,jit_code_pushargi_i)
|
||||
#if __WORDSIZE == 32
|
||||
# define jit_pushargr(u) jit_pushargr_i(u)
|
||||
# define jit_pushargi(u) jit_pushargi_i(u)
|
||||
#else
|
||||
# define jit_pushargr_ui(u) _jit_pushargr(_jit,u,jit_code_pushargr_ui)
|
||||
# define jit_pushargi_ui(u) _jit_pushargi(_jit,u,jit_code_pushargi_ui)
|
||||
# define jit_pushargr_l(u) _jit_pushargr(_jit,u,jit_code_pushargr_l)
|
||||
# define jit_pushargi_l(u) _jit_pushargi(_jit,u,jit_code_pushargi_l)
|
||||
# define jit_pushargr(u) jit_pushargr_l(u)
|
||||
# define jit_pushargi(u) jit_pushargi_l(u)
|
||||
#endif
|
||||
jit_code_pushargr_c, jit_code_pushargi_c,
|
||||
jit_code_pushargr_uc, jit_code_pushargi_uc,
|
||||
jit_code_pushargr_s, jit_code_pushargi_s,
|
||||
jit_code_pushargr_us, jit_code_pushargi_us,
|
||||
jit_code_pushargr_i, jit_code_pushargi_i,
|
||||
jit_code_pushargr_ui, jit_code_pushargi_ui,
|
||||
jit_code_pushargr_l, jit_code_pushargi_l,
|
||||
#if __WORDSIZE == 32
|
||||
# define jit_code_pushargr jit_code_pushargr_i
|
||||
# define jit_code_pushargi jit_code_pushargi_i
|
||||
#else
|
||||
# define jit_code_pushargr jit_code_pushargr_l
|
||||
# define jit_code_pushargi jit_code_pushargi_l
|
||||
#endif
|
||||
|
||||
#define jit_finishr(u) _jit_finishr(_jit,u)
|
||||
#define jit_finishi(u) _jit_finishi(_jit,u)
|
||||
jit_code_finishr, jit_code_finishi,
|
||||
#define jit_ret() _jit_ret(_jit)
|
||||
jit_code_ret,
|
||||
#define jit_retr(u) _jit_retr(_jit,u)
|
||||
#define jit_reti(u) _jit_reti(_jit,u)
|
||||
jit_code_retr, jit_code_reti,
|
||||
|
||||
#define jit_retr_c(u) _jit_retr(_jit,u,jit_code_retr_c)
|
||||
#define jit_reti_c(u) _jit_reti(_jit,u,jit_code_reti_c)
|
||||
#define jit_retr_uc(u) _jit_retr(_jit,u,jit_code_retr_uc)
|
||||
#define jit_reti_uc(u) _jit_reti(_jit,u,jit_code_reti_uc)
|
||||
#define jit_retr_s(u) _jit_retr(_jit,u,jit_code_retr_s)
|
||||
#define jit_reti_s(u) _jit_reti(_jit,u,jit_code_reti_s)
|
||||
#define jit_retr_us(u) _jit_retr(_jit,u,jit_code_retr_us)
|
||||
#define jit_reti_us(u) _jit_reti(_jit,u,jit_code_reti_us)
|
||||
#define jit_retr_i(u) _jit_retr(_jit,u,jit_code_retr_i)
|
||||
#define jit_reti_i(u) _jit_reti(_jit,u,jit_code_reti_i)
|
||||
#if __WORDSIZE == 32
|
||||
# define jit_retr(u) jit_retr_i(u)
|
||||
# define jit_reti(u) jit_reti_i(u)
|
||||
#else
|
||||
# define jit_retr_ui(u) _jit_retr(_jit,u,jit_code_retr_ui)
|
||||
# define jit_reti_ui(u) _jit_reti(_jit,u,jit_code_reti_ui)
|
||||
# define jit_retr_l(u) _jit_retr(_jit,u,jit_code_retr_l)
|
||||
# define jit_reti_l(u) _jit_reti(_jit,u,jit_code_reti_l)
|
||||
# define jit_retr(u) jit_retr_l(u)
|
||||
# define jit_reti(u) jit_reti_l(u)
|
||||
#endif
|
||||
jit_code_retr_c, jit_code_reti_c,
|
||||
jit_code_retr_uc, jit_code_reti_uc,
|
||||
jit_code_retr_s, jit_code_reti_s,
|
||||
jit_code_retr_us, jit_code_reti_us,
|
||||
jit_code_retr_i, jit_code_reti_i,
|
||||
jit_code_retr_ui, jit_code_reti_ui,
|
||||
jit_code_retr_l, jit_code_reti_l,
|
||||
#if __WORDSIZE == 32
|
||||
# define jit_code_retr jit_code_retr_i
|
||||
# define jit_code_reti jit_code_reti_i
|
||||
#else
|
||||
# define jit_code_retr jit_code_retr_l
|
||||
# define jit_code_reti jit_code_reti_l
|
||||
#endif
|
||||
|
||||
#define jit_retval_c(u) _jit_retval_c(_jit,u)
|
||||
#define jit_retval_uc(u) _jit_retval_uc(_jit,u)
|
||||
jit_code_retval_c, jit_code_retval_uc,
|
||||
#define jit_retval_s(u) _jit_retval_s(_jit,u)
|
||||
#define jit_retval_us(u) _jit_retval_us(_jit,u)
|
||||
jit_code_retval_s, jit_code_retval_us,
|
||||
#define jit_retval_i(u) _jit_retval_i(_jit,u)
|
||||
#if __WORDSIZE == 32
|
||||
# define jit_retval(u) jit_retval_i(u)
|
||||
#else
|
||||
# define jit_retval(u) jit_retval_l(u)
|
||||
# define jit_retval_ui(u) _jit_retval_ui(_jit,u)
|
||||
# define jit_retval_l(u) _jit_retval_l(_jit,u)
|
||||
# define jit_retval(u) jit_retval_l(u)
|
||||
#endif
|
||||
jit_code_retval_c, jit_code_retval_uc,
|
||||
jit_code_retval_s, jit_code_retval_us,
|
||||
jit_code_retval_i, jit_code_retval_ui,
|
||||
jit_code_retval_l,
|
||||
#if __WORDSIZE == 32
|
||||
# define jit_code_retval jit_code_retval_i
|
||||
#else
|
||||
# define jit_code_retval jit_code_retval_l
|
||||
#endif
|
||||
|
||||
#define jit_epilog() _jit_epilog(_jit)
|
||||
jit_code_epilog,
|
||||
@@ -891,6 +1048,14 @@ typedef enum {
|
||||
#define jit_movr_d_w(u, v) jit_new_node_ww(jit_code_movr_d_w, u, v)
|
||||
#define jit_movi_d_w(u, v) jit_new_node_wd(jit_code_movi_d_w, u, v)
|
||||
|
||||
#define jit_clor(u,v) jit_new_node_ww(jit_code_clor,u,v)
|
||||
#define jit_clzr(u,v) jit_new_node_ww(jit_code_clzr,u,v)
|
||||
jit_code_clor, jit_code_clzr,
|
||||
|
||||
#define jit_ctor(u,v) jit_new_node_ww(jit_code_ctor,u,v)
|
||||
#define jit_ctzr(u,v) jit_new_node_ww(jit_code_ctzr,u,v)
|
||||
jit_code_ctor, jit_code_ctzr,
|
||||
|
||||
jit_code_last_code
|
||||
} jit_code_t;
|
||||
|
||||
@@ -931,7 +1096,8 @@ extern jit_int32_t _jit_allocai(jit_state_t*, jit_int32_t);
|
||||
extern void _jit_allocar(jit_state_t*, jit_int32_t, jit_int32_t);
|
||||
extern void _jit_ellipsis(jit_state_t*);
|
||||
|
||||
extern jit_node_t *_jit_arg(jit_state_t*);
|
||||
extern jit_node_t *_jit_arg(jit_state_t*, jit_code_t);
|
||||
|
||||
extern void _jit_getarg_c(jit_state_t*, jit_gpr_t, jit_node_t*);
|
||||
extern void _jit_getarg_uc(jit_state_t*, jit_gpr_t, jit_node_t*);
|
||||
extern void _jit_getarg_s(jit_state_t*, jit_gpr_t, jit_node_t*);
|
||||
@@ -941,19 +1107,24 @@ extern void _jit_getarg_i(jit_state_t*, jit_gpr_t, jit_node_t*);
|
||||
extern void _jit_getarg_ui(jit_state_t*, jit_gpr_t, jit_node_t*);
|
||||
extern void _jit_getarg_l(jit_state_t*, jit_gpr_t, jit_node_t*);
|
||||
#endif
|
||||
extern void _jit_putargr(jit_state_t*, jit_gpr_t, jit_node_t*);
|
||||
extern void _jit_putargi(jit_state_t*, jit_word_t, jit_node_t*);
|
||||
|
||||
extern void _jit_putargr(jit_state_t*, jit_gpr_t, jit_node_t*, jit_code_t);
|
||||
extern void _jit_putargi(jit_state_t*, jit_word_t, jit_node_t*, jit_code_t);
|
||||
|
||||
extern void _jit_prepare(jit_state_t*);
|
||||
extern void _jit_ellipsis(jit_state_t*);
|
||||
extern void _jit_va_push(jit_state_t*, jit_gpr_t);
|
||||
extern void _jit_pushargr(jit_state_t*, jit_gpr_t);
|
||||
extern void _jit_pushargi(jit_state_t*, jit_word_t);
|
||||
|
||||
extern void _jit_pushargr(jit_state_t*, jit_gpr_t, jit_code_t);
|
||||
extern void _jit_pushargi(jit_state_t*, jit_word_t, jit_code_t);
|
||||
|
||||
extern void _jit_finishr(jit_state_t*, jit_gpr_t);
|
||||
extern jit_node_t *_jit_finishi(jit_state_t*, jit_pointer_t);
|
||||
extern void _jit_ret(jit_state_t*);
|
||||
extern void _jit_retr(jit_state_t*, jit_gpr_t);
|
||||
extern void _jit_reti(jit_state_t*, jit_word_t);
|
||||
|
||||
extern void _jit_retr(jit_state_t*, jit_gpr_t, jit_code_t);
|
||||
extern void _jit_reti(jit_state_t*, jit_word_t, jit_code_t);
|
||||
|
||||
extern void _jit_retval_c(jit_state_t*, jit_gpr_t);
|
||||
extern void _jit_retval_uc(jit_state_t*, jit_gpr_t);
|
||||
extern void _jit_retval_s(jit_state_t*, jit_gpr_t);
|
||||
@@ -963,6 +1134,7 @@ extern void _jit_retval_i(jit_state_t*, jit_gpr_t);
|
||||
extern void _jit_retval_ui(jit_state_t*, jit_gpr_t);
|
||||
extern void _jit_retval_l(jit_state_t*, jit_gpr_t);
|
||||
#endif
|
||||
|
||||
extern void _jit_epilog(jit_state_t*);
|
||||
|
||||
#define jit_patch(u) _jit_patch(_jit,u)
|
||||
@@ -987,6 +1159,10 @@ extern void _jit_frame(jit_state_t*, jit_int32_t);
|
||||
extern void _jit_tramp(jit_state_t*, jit_int32_t);
|
||||
#define jit_emit() _jit_emit(_jit)
|
||||
extern jit_pointer_t _jit_emit(jit_state_t*);
|
||||
#define jit_unprotect() _jit_unprotect(_jit)
|
||||
extern void _jit_unprotect(jit_state_t*);
|
||||
#define jit_protect() _jit_protect(_jit)
|
||||
extern void _jit_protect(jit_state_t*);
|
||||
|
||||
#define jit_print() _jit_print(_jit)
|
||||
extern void _jit_print(jit_state_t*);
|
||||
@@ -1011,6 +1187,12 @@ extern void _jit_retr_d(jit_state_t*, jit_fpr_t);
|
||||
extern void _jit_reti_d(jit_state_t*, jit_float64_t);
|
||||
extern void _jit_retval_d(jit_state_t*, jit_fpr_t);
|
||||
|
||||
#define jit_get_reg(s) _jit_get_reg(_jit,s)
|
||||
extern jit_int32_t _jit_get_reg(jit_state_t*, jit_int32_t);
|
||||
|
||||
#define jit_unget_reg(r) _jit_unget_reg(_jit,r)
|
||||
extern void _jit_unget_reg(jit_state_t*, jit_int32_t);
|
||||
|
||||
#define jit_new_node(c) _jit_new_node(_jit,c)
|
||||
extern jit_node_t *_jit_new_node(jit_state_t*, jit_code_t);
|
||||
#define jit_new_node_w(c,u) _jit_new_node_w(_jit,c,u)
|
||||
@@ -1053,6 +1235,10 @@ extern jit_node_t *_jit_new_node_www(jit_state_t*, jit_code_t,
|
||||
extern jit_node_t *_jit_new_node_qww(jit_state_t*, jit_code_t,
|
||||
jit_int32_t, jit_int32_t,
|
||||
jit_word_t, jit_word_t);
|
||||
#define jit_new_node_wwq(c,u,v,l,h) _jit_new_node_wwq(_jit,c,u,v,l,h)
|
||||
extern jit_node_t *_jit_new_node_wwq(jit_state_t*, jit_code_t,
|
||||
jit_word_t, jit_word_t,
|
||||
jit_int32_t, jit_int32_t);
|
||||
#define jit_new_node_wwf(c,u,v,w) _jit_new_node_wwf(_jit,c,u,v,w)
|
||||
extern jit_node_t *_jit_new_node_wwf(jit_state_t*, jit_code_t,
|
||||
jit_word_t, jit_word_t, jit_float32_t);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2019 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2012-2023 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of GNU lightning.
|
||||
*
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <stdlib.h>
|
||||
@MAYBE_INCLUDE_STDINT_H@
|
||||
#include <string.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#if defined(__hpux) && defined(__hppa__)
|
||||
# include <machine/param.h>
|
||||
@@ -123,6 +124,11 @@ typedef jit_int32_t jit_bool_t;
|
||||
typedef jit_int32_t jit_gpr_t;
|
||||
typedef jit_int32_t jit_fpr_t;
|
||||
|
||||
#if !defined(__powerpc__) && \
|
||||
(defined(__POWERPC__) || defined(__ppc__) || defined(__PPC__))
|
||||
#define __powerpc__ 1
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
# include <lightning/jit_x86.h>
|
||||
#elif defined(__mips__)
|
||||
@@ -145,6 +151,8 @@ typedef jit_int32_t jit_fpr_t;
|
||||
# include <lightning/jit_alpha.h>
|
||||
#elif defined(__riscv)
|
||||
# include <lightning/jit_riscv.h>
|
||||
#elif defined(__loongarch__)
|
||||
# include <lightning/jit_loongarch.h>
|
||||
#endif
|
||||
|
||||
#define jit_flag_node 0x0001 /* patch node not absolute */
|
||||
@@ -182,6 +190,8 @@ typedef enum {
|
||||
#define jit_align(u) jit_new_node_w(jit_code_align, u)
|
||||
jit_code_live, jit_code_align,
|
||||
jit_code_save, jit_code_load,
|
||||
#define jit_skip(u) jit_new_node_w(jit_code_skip, u)
|
||||
jit_code_skip,
|
||||
#define jit_name(u) _jit_name(_jit,u)
|
||||
jit_code_name,
|
||||
#define jit_note(u, v) _jit_note(_jit, u, v)
|
||||
@@ -202,27 +212,80 @@ typedef enum {
|
||||
#define jit_allocar(u, v) _jit_allocar(_jit,u,v)
|
||||
jit_code_allocai, jit_code_allocar,
|
||||
|
||||
#define jit_arg() _jit_arg(_jit)
|
||||
jit_code_arg,
|
||||
#define jit_arg_c() _jit_arg(_jit, jit_code_arg_c)
|
||||
#define jit_arg_s() _jit_arg(_jit, jit_code_arg_s)
|
||||
#define jit_arg_i() _jit_arg(_jit, jit_code_arg_i)
|
||||
# if __WORDSIZE == 32
|
||||
# define jit_arg() jit_arg_i()
|
||||
#else
|
||||
# define jit_arg_l() _jit_arg(_jit, jit_code_arg_l)
|
||||
# define jit_arg() jit_arg_l()
|
||||
#endif
|
||||
jit_code_arg_c, jit_code_arg_s,
|
||||
jit_code_arg_i, jit_code_arg_l,
|
||||
#if __WORDSIZE == 32
|
||||
# define jit_code_arg jit_code_arg_i
|
||||
#else
|
||||
# define jit_code_arg jit_code_arg_l
|
||||
#endif
|
||||
|
||||
#define jit_getarg_c(u,v) _jit_getarg_c(_jit,u,v)
|
||||
#define jit_getarg_uc(u,v) _jit_getarg_uc(_jit,u,v)
|
||||
jit_code_getarg_c, jit_code_getarg_uc,
|
||||
#define jit_getarg_s(u,v) _jit_getarg_s(_jit,u,v)
|
||||
#define jit_getarg_us(u,v) _jit_getarg_us(_jit,u,v)
|
||||
jit_code_getarg_s, jit_code_getarg_us,
|
||||
#define jit_getarg_i(u,v) _jit_getarg_i(_jit,u,v)
|
||||
#if __WORDSIZE == 32
|
||||
# define jit_getarg(u,v) jit_getarg_i(u,v)
|
||||
#else
|
||||
# define jit_getarg(u,v) jit_getarg_l(u,v)
|
||||
# define jit_getarg_ui(u,v) _jit_getarg_ui(_jit,u,v)
|
||||
# define jit_getarg_l(u,v) _jit_getarg_l(_jit,u,v)
|
||||
# define jit_getarg(u,v) jit_getarg_l(u,v)
|
||||
#endif
|
||||
jit_code_getarg_c, jit_code_getarg_uc,
|
||||
jit_code_getarg_s, jit_code_getarg_us,
|
||||
jit_code_getarg_i, jit_code_getarg_ui,
|
||||
jit_code_getarg_l,
|
||||
# define jit_putargr(u,v) _jit_putargr(_jit,u,v)
|
||||
# define jit_putargi(u,v) _jit_putargi(_jit,u,v)
|
||||
jit_code_putargr, jit_code_putargi,
|
||||
#if __WORDSIZE == 32
|
||||
# define jit_code_getarg jit_code_getarg_i
|
||||
#else
|
||||
# define jit_code_getarg jit_code_getarg_l
|
||||
#endif
|
||||
|
||||
#define jit_putargr_c(u,v) _jit_putargr(_jit,u,v,jit_code_putargr_c)
|
||||
#define jit_putargi_c(u,v) _jit_putargi(_jit,u,v,jit_code_putargi_c)
|
||||
#define jit_putargr_uc(u,v) _jit_putargr(_jit,u,v,jit_code_putargr_uc)
|
||||
#define jit_putargi_uc(u,v) _jit_putargi(_jit,u,v,jit_code_putargi_uc)
|
||||
#define jit_putargr_s(u,v) _jit_putargr(_jit,u,v,jit_code_putargr_s)
|
||||
#define jit_putargi_s(u,v) _jit_putargi(_jit,u,v,jit_code_putargi_s)
|
||||
#define jit_putargr_us(u,v) _jit_putargr(_jit,u,v,jit_code_putargr_us)
|
||||
#define jit_putargi_us(u,v) _jit_putargi(_jit,u,v,jit_code_putargi_us)
|
||||
#define jit_putargr_i(u,v) _jit_putargr(_jit,u,v,jit_code_putargr_i)
|
||||
#define jit_putargi_i(u,v) _jit_putargi(_jit,u,v,jit_code_putargi_i)
|
||||
#if __WORDSIZE == 32
|
||||
# define jit_putargr(u,v) jit_putargr_i(u,v)
|
||||
# define jit_putargi(u,v) jit_putargi_i(u,v)
|
||||
#else
|
||||
# define jit_putargr_ui(u,v) _jit_putargr(_jit,u,v,jit_code_putargr_ui)
|
||||
# define jit_putargi_ui(u,v) _jit_putargi(_jit,u,v,jit_code_putargi_ui)
|
||||
# define jit_putargr_l(u,v) _jit_putargr(_jit,u,v,jit_code_putargr_l)
|
||||
# define jit_putargi_l(u,v) _jit_putargi(_jit,u,v,jit_code_putargi_l)
|
||||
# define jit_putargr(u,v) jit_putargr_l(u,v)
|
||||
# define jit_putargi(u,v) jit_putargi_l(u,v)
|
||||
#endif
|
||||
jit_code_putargr_c, jit_code_putargi_c,
|
||||
jit_code_putargr_uc, jit_code_putargi_uc,
|
||||
jit_code_putargr_s, jit_code_putargi_s,
|
||||
jit_code_putargr_us, jit_code_putargi_us,
|
||||
jit_code_putargr_i, jit_code_putargi_i,
|
||||
jit_code_putargr_ui, jit_code_putargi_ui,
|
||||
jit_code_putargr_l, jit_code_putargi_l,
|
||||
#if __WORDSIZE == 32
|
||||
# define jit_code_putargr jit_code_putargr_i
|
||||
# define jit_code_putargi jit_code_putargi_i
|
||||
#else
|
||||
# define jit_code_putargr jit_code_putargr_l
|
||||
# define jit_code_putargi jit_code_putargi_l
|
||||
#endif
|
||||
|
||||
#define jit_va_start(u) jit_new_node_w(jit_code_va_start, u)
|
||||
jit_code_va_start,
|
||||
@@ -339,6 +402,15 @@ typedef enum {
|
||||
#define jit_movr(u,v) jit_new_node_ww(jit_code_movr,u,v)
|
||||
#define jit_movi(u,v) jit_new_node_ww(jit_code_movi,u,v)
|
||||
jit_code_movr, jit_code_movi,
|
||||
|
||||
#define jit_movnr(u,v,w) jit_new_node_www(jit_code_movnr,u,v,w)
|
||||
#define jit_movzr(u,v,w) jit_new_node_www(jit_code_movzr,u,v,w)
|
||||
jit_code_movnr, jit_code_movzr,
|
||||
|
||||
jit_code_casr, jit_code_casi,
|
||||
#define jit_casr(u, v, w, x) jit_new_node_wwq(jit_code_casr, u, v, w, x)
|
||||
#define jit_casi(u, v, w, x) jit_new_node_wwq(jit_code_casi, u, v, w, x)
|
||||
|
||||
#define jit_extr_c(u,v) jit_new_node_ww(jit_code_extr_c,u,v)
|
||||
#define jit_extr_uc(u,v) jit_new_node_ww(jit_code_extr_uc,u,v)
|
||||
jit_code_extr_c, jit_code_extr_uc,
|
||||
@@ -351,6 +423,18 @@ typedef enum {
|
||||
#endif
|
||||
jit_code_extr_i, jit_code_extr_ui,
|
||||
|
||||
#define jit_bswapr_us(u,v) jit_new_node_ww(jit_code_bswapr_us,u,v)
|
||||
jit_code_bswapr_us,
|
||||
#define jit_bswapr_ui(u,v) jit_new_node_ww(jit_code_bswapr_ui,u,v)
|
||||
jit_code_bswapr_ui,
|
||||
#define jit_bswapr_ul(u,v) jit_new_node_ww(jit_code_bswapr_ul,u,v)
|
||||
jit_code_bswapr_ul,
|
||||
#if __WORDSIZE == 32
|
||||
#define jit_bswapr(u,v) jit_new_node_ww(jit_code_bswapr_ui,u,v)
|
||||
#else
|
||||
#define jit_bswapr(u,v) jit_new_node_ww(jit_code_bswapr_ul,u,v)
|
||||
#endif
|
||||
|
||||
#define jit_htonr_us(u,v) jit_new_node_ww(jit_code_htonr_us,u,v)
|
||||
#define jit_ntohr_us(u,v) jit_new_node_ww(jit_code_htonr_us,u,v)
|
||||
jit_code_htonr_us,
|
||||
@@ -537,33 +621,106 @@ typedef enum {
|
||||
|
||||
#define jit_prepare() _jit_prepare(_jit)
|
||||
jit_code_prepare,
|
||||
#define jit_pushargr(u) _jit_pushargr(_jit,u)
|
||||
#define jit_pushargi(u) _jit_pushargi(_jit,u)
|
||||
jit_code_pushargr, jit_code_pushargi,
|
||||
|
||||
#define jit_pushargr_c(u) _jit_pushargr(_jit,u,jit_code_pushargr_c)
|
||||
#define jit_pushargi_c(u) _jit_pushargi(_jit,u,jit_code_pushargi_c)
|
||||
#define jit_pushargr_uc(u) _jit_pushargr(_jit,u,jit_code_pushargr_uc)
|
||||
#define jit_pushargi_uc(u) _jit_pushargi(_jit,u,jit_code_pushargi_uc)
|
||||
#define jit_pushargr_s(u) _jit_pushargr(_jit,u,jit_code_pushargr_s)
|
||||
#define jit_pushargi_s(u) _jit_pushargi(_jit,u,jit_code_pushargi_s)
|
||||
#define jit_pushargr_us(u) _jit_pushargr(_jit,u,jit_code_pushargr_us)
|
||||
#define jit_pushargi_us(u) _jit_pushargi(_jit,u,jit_code_pushargi_us)
|
||||
#define jit_pushargr_i(u) _jit_pushargr(_jit,u,jit_code_pushargr_i)
|
||||
#define jit_pushargi_i(u) _jit_pushargi(_jit,u,jit_code_pushargi_i)
|
||||
#if __WORDSIZE == 32
|
||||
# define jit_pushargr(u) jit_pushargr_i(u)
|
||||
# define jit_pushargi(u) jit_pushargi_i(u)
|
||||
#else
|
||||
# define jit_pushargr_ui(u) _jit_pushargr(_jit,u,jit_code_pushargr_ui)
|
||||
# define jit_pushargi_ui(u) _jit_pushargi(_jit,u,jit_code_pushargi_ui)
|
||||
# define jit_pushargr_l(u) _jit_pushargr(_jit,u,jit_code_pushargr_l)
|
||||
# define jit_pushargi_l(u) _jit_pushargi(_jit,u,jit_code_pushargi_l)
|
||||
# define jit_pushargr(u) jit_pushargr_l(u)
|
||||
# define jit_pushargi(u) jit_pushargi_l(u)
|
||||
#endif
|
||||
jit_code_pushargr_c, jit_code_pushargi_c,
|
||||
jit_code_pushargr_uc, jit_code_pushargi_uc,
|
||||
jit_code_pushargr_s, jit_code_pushargi_s,
|
||||
jit_code_pushargr_us, jit_code_pushargi_us,
|
||||
jit_code_pushargr_i, jit_code_pushargi_i,
|
||||
jit_code_pushargr_ui, jit_code_pushargi_ui,
|
||||
jit_code_pushargr_l, jit_code_pushargi_l,
|
||||
#if __WORDSIZE == 32
|
||||
# define jit_code_pushargr jit_code_pushargr_i
|
||||
# define jit_code_pushargi jit_code_pushargi_i
|
||||
#else
|
||||
# define jit_code_pushargr jit_code_pushargr_l
|
||||
# define jit_code_pushargi jit_code_pushargi_l
|
||||
#endif
|
||||
|
||||
#define jit_finishr(u) _jit_finishr(_jit,u)
|
||||
#define jit_finishi(u) _jit_finishi(_jit,u)
|
||||
jit_code_finishr, jit_code_finishi,
|
||||
#define jit_ret() _jit_ret(_jit)
|
||||
jit_code_ret,
|
||||
#define jit_retr(u) _jit_retr(_jit,u)
|
||||
#define jit_reti(u) _jit_reti(_jit,u)
|
||||
jit_code_retr, jit_code_reti,
|
||||
|
||||
#define jit_retr_c(u) _jit_retr(_jit,u,jit_code_retr_c)
|
||||
#define jit_reti_c(u) _jit_reti(_jit,u,jit_code_reti_c)
|
||||
#define jit_retr_uc(u) _jit_retr(_jit,u,jit_code_retr_uc)
|
||||
#define jit_reti_uc(u) _jit_reti(_jit,u,jit_code_reti_uc)
|
||||
#define jit_retr_s(u) _jit_retr(_jit,u,jit_code_retr_s)
|
||||
#define jit_reti_s(u) _jit_reti(_jit,u,jit_code_reti_s)
|
||||
#define jit_retr_us(u) _jit_retr(_jit,u,jit_code_retr_us)
|
||||
#define jit_reti_us(u) _jit_reti(_jit,u,jit_code_reti_us)
|
||||
#define jit_retr_i(u) _jit_retr(_jit,u,jit_code_retr_i)
|
||||
#define jit_reti_i(u) _jit_reti(_jit,u,jit_code_reti_i)
|
||||
#if __WORDSIZE == 32
|
||||
# define jit_retr(u) jit_retr_i(u)
|
||||
# define jit_reti(u) jit_reti_i(u)
|
||||
#else
|
||||
# define jit_retr_ui(u) _jit_retr(_jit,u,jit_code_retr_ui)
|
||||
# define jit_reti_ui(u) _jit_reti(_jit,u,jit_code_reti_ui)
|
||||
# define jit_retr_l(u) _jit_retr(_jit,u,jit_code_retr_l)
|
||||
# define jit_reti_l(u) _jit_reti(_jit,u,jit_code_reti_l)
|
||||
# define jit_retr(u) jit_retr_l(u)
|
||||
# define jit_reti(u) jit_reti_l(u)
|
||||
#endif
|
||||
jit_code_retr_c, jit_code_reti_c,
|
||||
jit_code_retr_uc, jit_code_reti_uc,
|
||||
jit_code_retr_s, jit_code_reti_s,
|
||||
jit_code_retr_us, jit_code_reti_us,
|
||||
jit_code_retr_i, jit_code_reti_i,
|
||||
jit_code_retr_ui, jit_code_reti_ui,
|
||||
jit_code_retr_l, jit_code_reti_l,
|
||||
#if __WORDSIZE == 32
|
||||
# define jit_code_retr jit_code_retr_i
|
||||
# define jit_code_reti jit_code_reti_i
|
||||
#else
|
||||
# define jit_code_retr jit_code_retr_l
|
||||
# define jit_code_reti jit_code_reti_l
|
||||
#endif
|
||||
|
||||
#define jit_retval_c(u) _jit_retval_c(_jit,u)
|
||||
#define jit_retval_uc(u) _jit_retval_uc(_jit,u)
|
||||
jit_code_retval_c, jit_code_retval_uc,
|
||||
#define jit_retval_s(u) _jit_retval_s(_jit,u)
|
||||
#define jit_retval_us(u) _jit_retval_us(_jit,u)
|
||||
jit_code_retval_s, jit_code_retval_us,
|
||||
#define jit_retval_i(u) _jit_retval_i(_jit,u)
|
||||
#if __WORDSIZE == 32
|
||||
# define jit_retval(u) jit_retval_i(u)
|
||||
#else
|
||||
# define jit_retval(u) jit_retval_l(u)
|
||||
# define jit_retval_ui(u) _jit_retval_ui(_jit,u)
|
||||
# define jit_retval_l(u) _jit_retval_l(_jit,u)
|
||||
# define jit_retval(u) jit_retval_l(u)
|
||||
#endif
|
||||
jit_code_retval_c, jit_code_retval_uc,
|
||||
jit_code_retval_s, jit_code_retval_us,
|
||||
jit_code_retval_i, jit_code_retval_ui,
|
||||
jit_code_retval_l,
|
||||
#if __WORDSIZE == 32
|
||||
# define jit_code_retval jit_code_retval_i
|
||||
#else
|
||||
# define jit_code_retval jit_code_retval_l
|
||||
#endif
|
||||
|
||||
#define jit_epilog() _jit_epilog(_jit)
|
||||
jit_code_epilog,
|
||||
@@ -891,6 +1048,14 @@ typedef enum {
|
||||
#define jit_movr_d_w(u, v) jit_new_node_ww(jit_code_movr_d_w, u, v)
|
||||
#define jit_movi_d_w(u, v) jit_new_node_wd(jit_code_movi_d_w, u, v)
|
||||
|
||||
#define jit_clor(u,v) jit_new_node_ww(jit_code_clor,u,v)
|
||||
#define jit_clzr(u,v) jit_new_node_ww(jit_code_clzr,u,v)
|
||||
jit_code_clor, jit_code_clzr,
|
||||
|
||||
#define jit_ctor(u,v) jit_new_node_ww(jit_code_ctor,u,v)
|
||||
#define jit_ctzr(u,v) jit_new_node_ww(jit_code_ctzr,u,v)
|
||||
jit_code_ctor, jit_code_ctzr,
|
||||
|
||||
jit_code_last_code
|
||||
} jit_code_t;
|
||||
|
||||
@@ -931,7 +1096,8 @@ extern jit_int32_t _jit_allocai(jit_state_t*, jit_int32_t);
|
||||
extern void _jit_allocar(jit_state_t*, jit_int32_t, jit_int32_t);
|
||||
extern void _jit_ellipsis(jit_state_t*);
|
||||
|
||||
extern jit_node_t *_jit_arg(jit_state_t*);
|
||||
extern jit_node_t *_jit_arg(jit_state_t*, jit_code_t);
|
||||
|
||||
extern void _jit_getarg_c(jit_state_t*, jit_gpr_t, jit_node_t*);
|
||||
extern void _jit_getarg_uc(jit_state_t*, jit_gpr_t, jit_node_t*);
|
||||
extern void _jit_getarg_s(jit_state_t*, jit_gpr_t, jit_node_t*);
|
||||
@@ -941,19 +1107,24 @@ extern void _jit_getarg_i(jit_state_t*, jit_gpr_t, jit_node_t*);
|
||||
extern void _jit_getarg_ui(jit_state_t*, jit_gpr_t, jit_node_t*);
|
||||
extern void _jit_getarg_l(jit_state_t*, jit_gpr_t, jit_node_t*);
|
||||
#endif
|
||||
extern void _jit_putargr(jit_state_t*, jit_gpr_t, jit_node_t*);
|
||||
extern void _jit_putargi(jit_state_t*, jit_word_t, jit_node_t*);
|
||||
|
||||
extern void _jit_putargr(jit_state_t*, jit_gpr_t, jit_node_t*, jit_code_t);
|
||||
extern void _jit_putargi(jit_state_t*, jit_word_t, jit_node_t*, jit_code_t);
|
||||
|
||||
extern void _jit_prepare(jit_state_t*);
|
||||
extern void _jit_ellipsis(jit_state_t*);
|
||||
extern void _jit_va_push(jit_state_t*, jit_gpr_t);
|
||||
extern void _jit_pushargr(jit_state_t*, jit_gpr_t);
|
||||
extern void _jit_pushargi(jit_state_t*, jit_word_t);
|
||||
|
||||
extern void _jit_pushargr(jit_state_t*, jit_gpr_t, jit_code_t);
|
||||
extern void _jit_pushargi(jit_state_t*, jit_word_t, jit_code_t);
|
||||
|
||||
extern void _jit_finishr(jit_state_t*, jit_gpr_t);
|
||||
extern jit_node_t *_jit_finishi(jit_state_t*, jit_pointer_t);
|
||||
extern void _jit_ret(jit_state_t*);
|
||||
extern void _jit_retr(jit_state_t*, jit_gpr_t);
|
||||
extern void _jit_reti(jit_state_t*, jit_word_t);
|
||||
|
||||
extern void _jit_retr(jit_state_t*, jit_gpr_t, jit_code_t);
|
||||
extern void _jit_reti(jit_state_t*, jit_word_t, jit_code_t);
|
||||
|
||||
extern void _jit_retval_c(jit_state_t*, jit_gpr_t);
|
||||
extern void _jit_retval_uc(jit_state_t*, jit_gpr_t);
|
||||
extern void _jit_retval_s(jit_state_t*, jit_gpr_t);
|
||||
@@ -963,6 +1134,7 @@ extern void _jit_retval_i(jit_state_t*, jit_gpr_t);
|
||||
extern void _jit_retval_ui(jit_state_t*, jit_gpr_t);
|
||||
extern void _jit_retval_l(jit_state_t*, jit_gpr_t);
|
||||
#endif
|
||||
|
||||
extern void _jit_epilog(jit_state_t*);
|
||||
|
||||
#define jit_patch(u) _jit_patch(_jit,u)
|
||||
@@ -987,6 +1159,10 @@ extern void _jit_frame(jit_state_t*, jit_int32_t);
|
||||
extern void _jit_tramp(jit_state_t*, jit_int32_t);
|
||||
#define jit_emit() _jit_emit(_jit)
|
||||
extern jit_pointer_t _jit_emit(jit_state_t*);
|
||||
#define jit_unprotect() _jit_unprotect(_jit)
|
||||
extern void _jit_unprotect(jit_state_t*);
|
||||
#define jit_protect() _jit_protect(_jit)
|
||||
extern void _jit_protect(jit_state_t*);
|
||||
|
||||
#define jit_print() _jit_print(_jit)
|
||||
extern void _jit_print(jit_state_t*);
|
||||
@@ -1011,6 +1187,12 @@ extern void _jit_retr_d(jit_state_t*, jit_fpr_t);
|
||||
extern void _jit_reti_d(jit_state_t*, jit_float64_t);
|
||||
extern void _jit_retval_d(jit_state_t*, jit_fpr_t);
|
||||
|
||||
#define jit_get_reg(s) _jit_get_reg(_jit,s)
|
||||
extern jit_int32_t _jit_get_reg(jit_state_t*, jit_int32_t);
|
||||
|
||||
#define jit_unget_reg(r) _jit_unget_reg(_jit,r)
|
||||
extern void _jit_unget_reg(jit_state_t*, jit_int32_t);
|
||||
|
||||
#define jit_new_node(c) _jit_new_node(_jit,c)
|
||||
extern jit_node_t *_jit_new_node(jit_state_t*, jit_code_t);
|
||||
#define jit_new_node_w(c,u) _jit_new_node_w(_jit,c,u)
|
||||
@@ -1053,6 +1235,10 @@ extern jit_node_t *_jit_new_node_www(jit_state_t*, jit_code_t,
|
||||
extern jit_node_t *_jit_new_node_qww(jit_state_t*, jit_code_t,
|
||||
jit_int32_t, jit_int32_t,
|
||||
jit_word_t, jit_word_t);
|
||||
#define jit_new_node_wwq(c,u,v,l,h) _jit_new_node_wwq(_jit,c,u,v,l,h)
|
||||
extern jit_node_t *_jit_new_node_wwq(jit_state_t*, jit_code_t,
|
||||
jit_word_t, jit_word_t,
|
||||
jit_int32_t, jit_int32_t);
|
||||
#define jit_new_node_wwf(c,u,v,w) _jit_new_node_wwf(_jit,c,u,v,w)
|
||||
extern jit_node_t *_jit_new_node_wwf(jit_state_t*, jit_code_t,
|
||||
jit_word_t, jit_word_t, jit_float32_t);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright 2000, 2001, 2002, 2012-2019 Free Software Foundation, Inc.
|
||||
# Copyright 2000, 2001, 2002, 2012-2022 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is part of GNU lightning.
|
||||
#
|
||||
@@ -63,3 +63,7 @@ if cpu_riscv
|
||||
lightning_include_HEADERS = \
|
||||
jit_riscv.h
|
||||
endif
|
||||
if cpu_loongarch
|
||||
lightning_include_HEADERS = \
|
||||
jit_loongarch.h
|
||||
endif
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2013-2019 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2013-2023 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of GNU lightning.
|
||||
*
|
||||
@@ -23,6 +23,10 @@
|
||||
#define JIT_HASH_CONSTS 0
|
||||
#define JIT_NUM_OPERANDS 3
|
||||
|
||||
#if __APPLE__
|
||||
# define PACKED_STACK 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Types
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2014-2019 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2014-2023 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of GNU lightning.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2019 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2012-2023 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of GNU lightning.
|
||||
*
|
||||
@@ -106,6 +106,9 @@ typedef enum {
|
||||
|
||||
typedef struct {
|
||||
jit_uint32_t version : 4;
|
||||
/* this field originally was only used for the 'e' in armv5te.
|
||||
* it can also be used to force hardware division, if setting
|
||||
* version to 7, telling it is armv7r or better. */
|
||||
jit_uint32_t extend : 1;
|
||||
/* only generate thumb instructions for thumb2 */
|
||||
jit_uint32_t thumb : 1;
|
||||
@@ -117,6 +120,12 @@ typedef struct {
|
||||
* due to some memory ordering constraint not being respected, so,
|
||||
* disable by default */
|
||||
jit_uint32_t ldrt_strt : 1;
|
||||
/* assume functions called never match jit instruction set?
|
||||
* that is libc, gmp, mpfr, etc functions are in thumb mode and jit
|
||||
* is in arm mode, or the reverse, what may cause a crash upon return
|
||||
* of that function if generating jit for a relative jump.
|
||||
*/
|
||||
jit_uint32_t exchange : 1;
|
||||
} jit_cpu_t;
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2013-2019 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2013-2023 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of GNU lightning.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2013-2019 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2013-2023 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of GNU lightning.
|
||||
*
|
||||
@@ -117,4 +117,13 @@ typedef enum {
|
||||
_NOREG,
|
||||
} jit_reg_t;
|
||||
|
||||
typedef struct {
|
||||
jit_uint32_t clz : 1;
|
||||
} jit_cpu_t;
|
||||
|
||||
/*
|
||||
* Initialization
|
||||
*/
|
||||
extern jit_cpu_t jit_cpu;
|
||||
|
||||
#endif /* _jit_ia64_h */
|
||||
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of GNU lightning.
|
||||
*
|
||||
* GNU lightning is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published
|
||||
* by the Free Software Foundation; either version 3, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* GNU lightning is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||
* License for more details.
|
||||
*
|
||||
* Authors:
|
||||
* Paulo Cesar Pereira de Andrade
|
||||
*/
|
||||
|
||||
#ifndef _jit_loongarch_h
|
||||
#define _jit_loongarch_h
|
||||
|
||||
/*
|
||||
* Types
|
||||
*/
|
||||
#define JIT_FP _FP
|
||||
typedef enum {
|
||||
#define jit_r_num() 9
|
||||
#define jit_r(i) (_T0 - (i))
|
||||
#define JIT_R0 _T0
|
||||
#define JIT_R1 _T1
|
||||
#define JIT_R2 _T2
|
||||
#define JIT_R3 _T3
|
||||
#define JIT_R4 _T4
|
||||
#define JIT_R5 _T5
|
||||
#define JIT_R6 _T6
|
||||
#define JIT_R7 _T7
|
||||
#define JIT_R8 _T8
|
||||
_T8, _T7, _T6, _T5, _T4, _T3, _T2, _T1, _T0,
|
||||
#define jit_v_num() 9
|
||||
#define jit_v(i) (_S0 - (i))
|
||||
#define JIT_V0 _S0
|
||||
#define JIT_V1 _S1
|
||||
#define JIT_V2 _S2
|
||||
#define JIT_V3 _S3
|
||||
#define JIT_V4 _S4
|
||||
#define JIT_V5 _S5
|
||||
#define JIT_V6 _S6
|
||||
#define JIT_V7 _S7
|
||||
#define JIT_V8 _S8
|
||||
_S8, _S7, _S6, _S5, _S4, _S3, _S2, _S1, _S0,
|
||||
_A7, _A6, _A5, _A4, _A3, _A2, _A1, _A0,
|
||||
_FP,
|
||||
_R21,
|
||||
_ZERO,
|
||||
_RA,
|
||||
_TP,
|
||||
_SP,
|
||||
_FT0, _FT1, _FT2, _FT3, _FT4, _FT5, _FT6, _FT7,
|
||||
_FT8, _FT9, _FT10, _FT11, _FT12, _FT13, _FT14, _FT15,
|
||||
_FA7, _FA6, _FA5, _FA4, FA3, _FA2, _FA1, _FA0,
|
||||
#define jit_f_num() 8
|
||||
#define jit_f(i) (_FS0 - (i))
|
||||
#define JIT_F0 _FS0
|
||||
#define JIT_F1 _FS1
|
||||
#define JIT_F2 _FS2
|
||||
#define JIT_F3 _FS3
|
||||
#define JIT_F4 _FS4
|
||||
#define JIT_F5 _FS5
|
||||
#define JIT_F6 _FS6
|
||||
#define JIT_F7 _FS7
|
||||
_FS7, _FS6, _FS5, _FS4, _FS3, _FS2, _FS1, _FS0,
|
||||
#define JIT_NOREG _NOREG
|
||||
_NOREG,
|
||||
} jit_reg_t;
|
||||
|
||||
#endif /* _jit_loongarch_h */
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2019 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2012-2023 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of GNU lightning.
|
||||
*
|
||||
@@ -34,9 +34,9 @@
|
||||
typedef enum {
|
||||
#define jit_r(i) (_V0 + (i))
|
||||
#if NEW_ABI
|
||||
# define jit_r_num() 7
|
||||
# define jit_r_num() 8
|
||||
#else
|
||||
# define jit_r_num() 11
|
||||
# define jit_r_num() 12
|
||||
#endif
|
||||
#define jit_v(i) (_S0 + (i))
|
||||
#define jit_v_num() 8
|
||||
@@ -55,6 +55,7 @@ typedef enum {
|
||||
# define JIT_R4 _T6
|
||||
# define JIT_R5 _T7
|
||||
# define JIT_R6 _T8
|
||||
# define JIT_R7 _T9
|
||||
#else
|
||||
# define JIT_R2 _T0
|
||||
# define JIT_R3 _T1
|
||||
@@ -65,6 +66,7 @@ typedef enum {
|
||||
# define JIT_R8 _T6
|
||||
# define JIT_R9 _T7
|
||||
# define JIT_R10 _T8
|
||||
# define JIT_R11 _T9
|
||||
#endif
|
||||
_V0, _V1,
|
||||
#if !NEW_ABI
|
||||
@@ -112,4 +114,13 @@ typedef enum {
|
||||
_NOREG,
|
||||
} jit_reg_t;
|
||||
|
||||
typedef struct {
|
||||
jit_uint32_t release : 4;
|
||||
} jit_cpu_t;
|
||||
|
||||
/*
|
||||
* Initialization
|
||||
*/
|
||||
extern jit_cpu_t jit_cpu;
|
||||
|
||||
#endif /* _jit_mips_h */
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2019 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2012-2023 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of GNU lightning.
|
||||
*
|
||||
@@ -22,6 +22,9 @@
|
||||
|
||||
#define JIT_HASH_CONSTS 1
|
||||
#define JIT_NUM_OPERANDS 3
|
||||
#if defined(_AIX) && !defined(_CALL_AIX) && !defined(_CALL_LINUX)
|
||||
# define _CALL_AIXDESC 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Types
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2019 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2012-2023 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of GNU lightning.
|
||||
*
|
||||
@@ -55,6 +55,26 @@
|
||||
# define HIDDEN /**/
|
||||
#endif
|
||||
|
||||
#if PACKED_STACK || STRONG_TYPE_CHECKING
|
||||
# define assert_arg_type(code, expect) \
|
||||
do assert((code) == (expect)); while (0)
|
||||
# define assert_putarg_type(code, expect) \
|
||||
do \
|
||||
assert((((code) - jit_code_putargr_c) >> 2) == \
|
||||
((expect) - jit_code_arg_c)); \
|
||||
while (0)
|
||||
#else
|
||||
# define assert_arg_type(code, expect) \
|
||||
do assert((int)(code) == (int)(expect) || \
|
||||
(code) == jit_code_arg); while (0)
|
||||
# define assert_putarg_type(code, expect) \
|
||||
do \
|
||||
assert(((((code) - jit_code_putargr_c) >> 2) == \
|
||||
((expect) - jit_code_arg_c)) || \
|
||||
((code) == jit_code_arg)); \
|
||||
while (0)
|
||||
#endif
|
||||
|
||||
#define rc(value) jit_class_##value
|
||||
#define rn(reg) (jit_regno(_rvs[jit_regno(reg)].spec))
|
||||
|
||||
@@ -150,6 +170,13 @@ typedef jit_uint64_t jit_regset_t;
|
||||
# define JIT_RET _A0
|
||||
# define JIT_FRET _FA0
|
||||
typedef jit_uint64_t jit_regset_t;
|
||||
#elif defined(__loongarch__)
|
||||
# define JIT_RA0 _A0
|
||||
# define JIT_FA0 _FA0
|
||||
# define JIT_SP _SP
|
||||
# define JIT_RET _A0
|
||||
# define JIT_FRET _FA0
|
||||
typedef jit_uint64_t jit_regset_t;
|
||||
#endif
|
||||
|
||||
#define jit_data(u,v,w) _jit_data(_jit,u,v,w)
|
||||
@@ -167,48 +194,80 @@ extern jit_node_t *_jit_data(jit_state_t*, const void*,
|
||||
(!jit_regset_tstbit(&_jitc->regarg, regno) && \
|
||||
!jit_regset_tstbit(&_jitc->regsav, regno))
|
||||
|
||||
#define jit_inc_synth(code) \
|
||||
#define jit_code_inc_synth(code) \
|
||||
do { \
|
||||
(void)jit_new_node(jit_code_##code); \
|
||||
(void)jit_new_node(code); \
|
||||
jit_synth_inc(); \
|
||||
} while (0)
|
||||
#define jit_inc_synth_w(code, u) \
|
||||
#define jit_inc_synth(name) \
|
||||
jit_code_inc_synth(jit_code_##name)
|
||||
#define jit_code_inc_synth_w(code, u) \
|
||||
do { \
|
||||
(void)jit_new_node_w(jit_code_##code, u); \
|
||||
(void)jit_new_node_w(code, u); \
|
||||
jit_synth_inc(); \
|
||||
} while (0)
|
||||
#define jit_inc_synth_f(code, u) \
|
||||
#define jit_inc_synth_w(name, u) \
|
||||
jit_code_inc_synth_w(jit_code_##name, u)
|
||||
#define jit_code_inc_synth_f(code, u) \
|
||||
do { \
|
||||
(void)jit_new_node_f(jit_code_##code, u); \
|
||||
(void)jit_new_node_f(code, u); \
|
||||
jit_synth_inc(); \
|
||||
} while (0)
|
||||
#define jit_inc_synth_d(code, u) \
|
||||
#define jit_inc_synth_f(name, u) \
|
||||
jit_code_inc_synth_f(jit_code_##name, u)
|
||||
#define jit_code_inc_synth_d(code, u) \
|
||||
do { \
|
||||
(void)jit_new_node_d(jit_code_##code, u); \
|
||||
(void)jit_new_node_d(code, u); \
|
||||
jit_synth_inc(); \
|
||||
} while (0)
|
||||
#define jit_inc_synth_ww(code, u, v) \
|
||||
#define jit_inc_synth_d(name, u) \
|
||||
jit_code_inc_synth_d(jit_code_##name, u)
|
||||
#define jit_code_inc_synth_ww(code, u, v) \
|
||||
do { \
|
||||
(void)jit_new_node_ww(jit_code_##code, u, v); \
|
||||
(void)jit_new_node_ww(code, u, v); \
|
||||
jit_synth_inc(); \
|
||||
} while (0)
|
||||
#define jit_inc_synth_wp(code, u, v) \
|
||||
#define jit_inc_synth_ww(name, u, v) \
|
||||
jit_code_inc_synth_ww(jit_code_##name, u, v)
|
||||
#define jit_code_inc_synth_wp(code, u, v) \
|
||||
do { \
|
||||
(void)jit_new_node_wp(jit_code_##code, u, v); \
|
||||
(void)jit_new_node_wp(code, u, v); \
|
||||
jit_synth_inc(); \
|
||||
} while (0)
|
||||
#define jit_inc_synth_fp(code, u, v) \
|
||||
#define jit_inc_synth_wp(name, u, v) \
|
||||
jit_code_inc_synth_wp(jit_code_##name, u, v)
|
||||
#define jit_code_inc_synth_fp(code, u, v) \
|
||||
do { \
|
||||
(void)jit_new_node_fp(jit_code_##code, u, v); \
|
||||
(void)jit_new_node_fp(code, u, v); \
|
||||
jit_synth_inc(); \
|
||||
} while (0)
|
||||
#define jit_inc_synth_dp(code, u, v) \
|
||||
#define jit_inc_synth_fp(name, u, v) \
|
||||
jit_code_inc_synth_fp(jit_code_##name, u, v)
|
||||
#define jit_code_inc_synth_dp(code, u, v) \
|
||||
do { \
|
||||
(void)jit_new_node_dp(jit_code_##code, u, v); \
|
||||
(void)jit_new_node_dp(code, u, v); \
|
||||
jit_synth_inc(); \
|
||||
} while (0)
|
||||
#define jit_inc_synth_dp(name, u, v) \
|
||||
jit_code_inc_synth_dp(jit_code_##name, u, v)
|
||||
#define jit_dec_synth() jit_synth_dec()
|
||||
|
||||
#define jit_link_alist(node) \
|
||||
do { \
|
||||
node->link = _jitc->function->alist; \
|
||||
_jitc->function->alist = node; \
|
||||
} while (0)
|
||||
#define jit_check_frame() \
|
||||
do { \
|
||||
if (!_jitc->function->need_frame) { \
|
||||
_jitc->again = 1; \
|
||||
_jitc->function->need_frame = 1; \
|
||||
} \
|
||||
} while (0)
|
||||
#define jit_diffsize() (stack_framesize - _jitc->framesize)
|
||||
#define jit_framesize() (stack_framesize - jit_diffsize())
|
||||
#define jit_selfsize() (_jitc->function->self.size - jit_diffsize())
|
||||
|
||||
#define jit_link_prolog() \
|
||||
do { \
|
||||
_jitc->tail->link = _jitc->function->prolog->link; \
|
||||
@@ -241,8 +300,8 @@ extern jit_node_t *_jit_data(jit_state_t*, const void*,
|
||||
#define jit_class_xpr 0x80000000 /* float / vector */
|
||||
/* Used on sparc64 where %f0-%f31 can be encode for single float
|
||||
* but %f32 to %f62 only as double precision */
|
||||
#define jit_class_sng 0x10000000 /* Single precision float */
|
||||
#define jit_class_dbl 0x20000000 /* Only double precision float */
|
||||
#define jit_class_sng 0x00010000 /* Single precision float */
|
||||
#define jit_class_dbl 0x00020000 /* Only double precision float */
|
||||
#define jit_regno_patch 0x00008000 /* this is a register
|
||||
* returned by a "user" call
|
||||
* to jit_get_reg() */
|
||||
@@ -264,8 +323,9 @@ extern jit_node_t *_jit_data(jit_state_t*, const void*,
|
||||
#define jit_cc_a0_flt 0x00000020 /* arg0 is immediate float */
|
||||
#define jit_cc_a0_dbl 0x00000040 /* arg0 is immediate double */
|
||||
#define jit_cc_a0_arg 0x00000080 /* arg1 is an argument int id */
|
||||
#define jit_cc_a1_reg 0x00000100 /* arg1 is a register */
|
||||
#define jit_cc_a1_chg 0x00000200 /* arg1 is modified */
|
||||
#define jit_cc_a0_cnd 0x00000100 /* arg1 is a conditinally set register */
|
||||
#define jit_cc_a1_reg 0x00000200 /* arg1 is a register */
|
||||
#define jit_cc_a1_chg 0x00000400 /* arg1 is modified */
|
||||
#define jit_cc_a1_int 0x00001000 /* arg1 is immediate word */
|
||||
#define jit_cc_a1_flt 0x00002000 /* arg1 is immediate float */
|
||||
#define jit_cc_a1_dbl 0x00004000 /* arg1 is immediate double */
|
||||
@@ -275,6 +335,7 @@ extern jit_node_t *_jit_data(jit_state_t*, const void*,
|
||||
#define jit_cc_a2_int 0x00100000 /* arg2 is immediate word */
|
||||
#define jit_cc_a2_flt 0x00200000 /* arg2 is immediate float */
|
||||
#define jit_cc_a2_dbl 0x00400000 /* arg2 is immediate double */
|
||||
#define jit_cc_a2_rlh 0x00800000 /* arg2 is a register pair */
|
||||
|
||||
#if __ia64__ || (__sparc__ && __WORDSIZE == 64)
|
||||
extern void
|
||||
@@ -363,6 +424,8 @@ typedef struct jit_register jit_register_t;
|
||||
# if DISASSEMBLER
|
||||
typedef struct jit_data_info jit_data_info_t;
|
||||
# endif
|
||||
#elif __riscv
|
||||
typedef struct jit_const jit_const_t;
|
||||
#endif
|
||||
|
||||
union jit_data {
|
||||
@@ -412,6 +475,9 @@ struct jit_block {
|
||||
jit_node_t *label;
|
||||
jit_regset_t reglive;
|
||||
jit_regset_t regmask;
|
||||
jit_bool_t again; /* Flag need to rebuild regset masks
|
||||
* due to changes in live and unknown
|
||||
* state. */
|
||||
};
|
||||
|
||||
struct jit_value {
|
||||
@@ -434,6 +500,12 @@ struct jit_data_info {
|
||||
jit_uword_t code; /* pointer in code buffer */
|
||||
jit_word_t length; /* length of constant vector */
|
||||
};
|
||||
#elif __riscv && __WORDSIZE == 64
|
||||
struct jit_const {
|
||||
jit_word_t value;
|
||||
jit_word_t address;
|
||||
jit_const_t *next;
|
||||
};
|
||||
#endif
|
||||
|
||||
struct jit_function {
|
||||
@@ -454,9 +526,14 @@ struct jit_function {
|
||||
} call;
|
||||
jit_node_t *prolog;
|
||||
jit_node_t *epilog;
|
||||
jit_node_t *alist;
|
||||
jit_int32_t *regoff;
|
||||
jit_regset_t regset;
|
||||
jit_int32_t stack;
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
jit_int32_t cvt_offset; /* allocai'd offset for x87<->xmm or
|
||||
* fpr<->gpr transfer using the stack */
|
||||
#endif
|
||||
|
||||
/* Helper for common jit generation pattern, used in GNU Smalltalk
|
||||
* and possibly others, where a static frame layout is required or
|
||||
@@ -465,11 +542,25 @@ struct jit_function {
|
||||
jit_uint32_t define_frame : 1;
|
||||
jit_uint32_t assume_frame : 1;
|
||||
|
||||
jit_uint32_t need_frame : 1; /* need frame pointer? */
|
||||
jit_uint32_t need_stack : 1; /* need stack pointer? */
|
||||
jit_uint32_t need_return : 1; /* not a leaf function */
|
||||
|
||||
/* alloca offset offset */
|
||||
jit_int32_t aoffoff;
|
||||
/* uses allocar flag */
|
||||
jit_uint32_t allocar : 1;
|
||||
|
||||
#if __arm__
|
||||
/* If will, or might use float registers and vfp is not available.
|
||||
* Use the first 64 bytes always, as the access to the virtual float
|
||||
* registers use hardcoded instructions that can only reach 64 byte
|
||||
* displacements, and to keep code simpler, do not use temporaries. */
|
||||
jit_uint32_t swf_offset : 1;
|
||||
/* If need to call C functions for some operation, or variadic function */
|
||||
jit_uint32_t save_reg_args : 1;
|
||||
#endif
|
||||
|
||||
/* varargs state offsets */
|
||||
jit_int32_t vaoff; /* offset of jit_va_list */
|
||||
jit_int32_t vagp; /* first gp va argument */
|
||||
@@ -490,7 +581,7 @@ struct jit_compiler {
|
||||
jit_int32_t breg; /* base register for prolog/epilog */
|
||||
#endif
|
||||
#if __mips__ || __ia64__ || __alpha__ || \
|
||||
(__sparc__ && __WORDSIZE == 64) || __riscv
|
||||
(__sparc__ && __WORDSIZE == 64) || __riscv || __loongarch__
|
||||
jit_int32_t carry;
|
||||
#define jit_carry _jitc->carry
|
||||
#endif
|
||||
@@ -508,11 +599,14 @@ struct jit_compiler {
|
||||
#endif
|
||||
jit_uint32_t no_data : 1;
|
||||
jit_uint32_t no_note : 1;
|
||||
jit_int32_t framesize; /* space for callee save registers,
|
||||
* frame pointer and return address */
|
||||
jit_int32_t reglen; /* number of registers */
|
||||
jit_regset_t regarg; /* cannot allocate */
|
||||
jit_regset_t regsav; /* automatic spill only once */
|
||||
jit_regset_t reglive; /* known live registers at some point */
|
||||
jit_regset_t regmask; /* register mask to update reglive */
|
||||
jit_regset_t explive; /* explicitly marked as live */
|
||||
struct {
|
||||
jit_uint8_t *end;
|
||||
} code;
|
||||
@@ -593,6 +687,27 @@ struct jit_compiler {
|
||||
jit_word_t length;
|
||||
} prolog;
|
||||
jit_bool_t jump;
|
||||
#elif __riscv && __WORDSIZE == 64
|
||||
struct {
|
||||
/* Hash table for constants to be resolved and patched */
|
||||
struct {
|
||||
jit_const_t **table; /* very simple hash table */
|
||||
jit_word_t size; /* number of vectors in table */
|
||||
jit_word_t count; /* number of distinct entries */
|
||||
} hash;
|
||||
struct {
|
||||
jit_const_t **ptr; /* keep a single pointer */
|
||||
jit_const_t *list; /* free list */
|
||||
jit_word_t length; /* length of pool */
|
||||
} pool;
|
||||
/* Linear list for constants that cannot be encoded easily */
|
||||
struct {
|
||||
jit_word_t *instrs; /* list of direct movi instructions */
|
||||
jit_word_t *values; /* list of direct movi constants */
|
||||
jit_word_t offset; /* offset in instrs/values vector */
|
||||
jit_word_t length; /* length of instrs/values vector */
|
||||
} vector;
|
||||
} consts;
|
||||
#endif
|
||||
#if GET_JIT_SIZE
|
||||
/* Temporary storage to calculate instructions length */
|
||||
@@ -616,6 +731,8 @@ struct jit_state {
|
||||
struct {
|
||||
jit_uint8_t *ptr;
|
||||
jit_word_t length;
|
||||
/* PROTECTED bytes starting at PTR are mprotect'd. */
|
||||
jit_word_t protected;
|
||||
} code;
|
||||
struct {
|
||||
jit_uint8_t *ptr;
|
||||
@@ -672,14 +789,6 @@ _jit_regarg_set(jit_state_t*, jit_node_t*, jit_int32_t);
|
||||
extern void
|
||||
_jit_regarg_clr(jit_state_t*, jit_node_t*, jit_int32_t);
|
||||
|
||||
#define jit_get_reg(s) _jit_get_reg(_jit,s)
|
||||
extern jit_int32_t
|
||||
_jit_get_reg(jit_state_t*, jit_int32_t);
|
||||
|
||||
#define jit_unget_reg(r) _jit_unget_reg(_jit,r)
|
||||
extern void
|
||||
_jit_unget_reg(jit_state_t*, jit_int32_t);
|
||||
|
||||
#define jit_save(reg) _jit_save(_jit, reg)
|
||||
extern void
|
||||
_jit_save(jit_state_t*, jit_int32_t);
|
||||
@@ -726,6 +835,7 @@ _emit_ldxi_d(jit_state_t*, jit_int32_t, jit_int32_t, jit_word_t);
|
||||
extern void
|
||||
_emit_stxi_d(jit_state_t*, jit_word_t, jit_int32_t, jit_int32_t);
|
||||
|
||||
extern void jit_init_print(void);
|
||||
extern void jit_init_debug(const char*);
|
||||
extern void jit_finish_debug(void);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2019-2023 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of GNU lightning.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2013-2019 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2013-2023 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of GNU lightning.
|
||||
*
|
||||
@@ -65,4 +65,13 @@ typedef enum {
|
||||
#define JIT_NOREG _NOREG
|
||||
} jit_reg_t;
|
||||
|
||||
typedef struct {
|
||||
jit_uint32_t flogr : 1;
|
||||
} jit_cpu_t;
|
||||
|
||||
/*
|
||||
* Initialization
|
||||
*/
|
||||
extern jit_cpu_t jit_cpu;
|
||||
|
||||
#endif /* _jit_s390_h */
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2013-2019 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2013-2023 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of GNU lightning.
|
||||
*
|
||||
@@ -99,4 +99,13 @@ typedef enum {
|
||||
_NOREG,
|
||||
} jit_reg_t;
|
||||
|
||||
typedef struct {
|
||||
jit_uint32_t lzcnt : 1;
|
||||
} jit_cpu_t;
|
||||
|
||||
/*
|
||||
* Initialization
|
||||
*/
|
||||
extern jit_cpu_t jit_cpu;
|
||||
|
||||
#endif /* _jit_sparc_h */
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2019 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2012-2023 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of GNU lightning.
|
||||
*
|
||||
@@ -189,6 +189,10 @@ typedef struct {
|
||||
jit_uint32_t avx : 1;
|
||||
/* lahf/sahf available in 64 bits mode */
|
||||
jit_uint32_t lahf : 1;
|
||||
/* lzcnt and tzcnt? */
|
||||
jit_uint32_t abm : 1;
|
||||
/* adcx and adox instructions available? */
|
||||
jit_uint32_t adx : 1;
|
||||
} jit_cpu_t;
|
||||
|
||||
/*
|
||||
|
||||
Reference in new issue
Block a user