1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 11:40:18 +02:00

Merge from upstream lightening

This commit is contained in:
Andy Wingo 2019-05-08 21:46:57 +02:00
commit 638846dc61
19 changed files with 1 additions and 26810 deletions

View file

@ -95,18 +95,10 @@ typedef struct jit_reloc
# include "lightening/arm.h"
#elif defined(__ppc__) || defined(__powerpc__)
# include "lightening/ppc.h"
#elif defined(__sparc__)
# include "lightening/sparc.h"
#elif defined(__ia64__)
# include "lightening/ia64.h"
#elif defined(__hppa__)
# include "lightening/hppa.h"
#elif defined(__aarch64__)
# include "lightening/aarch64.h"
#elif defined(__s390__) || defined(__s390x__)
# include "lightening/s390.h"
#elif defined(__alpha__)
# include "lightening/alpha.h"
#endif
typedef struct jit_state jit_state_t;

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,105 +0,0 @@
/*
* Copyright (C) 2014-2017 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_alpha_h
#define _jit_alpha_h
#define JIT_HASH_CONSTS 1
#define JIT_NUM_OPERANDS 3
/*
* Types
*/
#define JIT_FP _FP
typedef enum {
#define jit_r(i) (_S0 + (i))
#define jit_r_num() 3
#define jit_v(i) (_S3 + (i))
#define jit_v_num() 3
#define jit_f(i) (_F2 + (i))
#define jit_f_num() 8
/* Volatile - Assembly temporary register */
_AT,
/* Volatile - Return value register */
_V0,
/* Volatile - Temporary registers */
_T0, _T1, _T2, _T3,
_T4, _T5, _T6, _T7,
_T8, _T9, _T10, _T11,
/* FIXME Use callee save register for r0-r2 (instead of 12+ JIT_RN
* and 6 JIT_VN because division must call a function)
* FIX would be to create proper functions that do not clobber
* registers and inject/inline them in the jit */
#define JIT_R0 _S0
#define JIT_R1 _S1
#define JIT_R2 _S2
#define JIT_V0 _S3
#define JIT_V1 _S4
#define JIT_V2 _S5
/* Nonvolatile - Saved registers */
_S0, _S1, _S2, _S3,
_S4, _S5,
/* Nonvolatile - Frame pointer */
_FP,
/* Volatile - Argument registers */
_A5, _A4, _A3, _A2,
_A1, _A0,
/* Volatile - Return address register */
_RA,
/* Volatile - Temporary register */
_PV,
/* Nonvolatile - Global pointer */
_GP,
/* Nonvolatile - Stack pointer */
_SP,
/* Constant RAZ / writes ignored */
_ZERO,
#define JIT_F0 _F2
#define JIT_F1 _F3
#define JIT_F2 _F4
#define JIT_F3 _F5
#define JIT_F4 _F6
#define JIT_F5 _F7
#define JIT_F6 _F8
#define JIT_F7 _F9
/* Volatile - Return value register (real part) */
_F0,
/* Volatile - Return value register (imaginary part) */
_F1,
/* Nonvolatile - Saved registers */
_F2, _F3, _F4, _F5,
_F6, _F7, _F8, _F9,
/* Volatile - Temporary registers */
_F10, _F11, _F12, _F13,
_F14, _F15,
/* Volatile - Argument registers */
_F21, _F20, _F19, _F18,
_F17, _F16,
/* Volatile - Temporary registers */
_F22, _F23, _R24, _F25,
_F26, _F27, _F28, _F29,
_F30,
/* Constant - RAZ / writes ignored */
_F31,
/* Lightning internal invalid register identifier */
_NOREG,
#define JIT_NOREG _NOREG
} jit_reg_t;
#endif /* _jit_alpha_h */

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2012-2018 Free Software Foundation, Inc.
* Copyright (C) 2012-2019 Free Software Foundation, Inc.
*
* This file is part of GNU lightning.
*
@ -27,22 +27,11 @@
#include <string.h>
#include <stddef.h>
#if defined(__hpux) && defined(__hppa__)
# include <machine/param.h>
#endif
#if defined(__alpha__) && defined(__osf__)
# include <machine/endian.h>
#endif
#ifndef __WORDSIZE
# if defined(WORDSIZE) /* ppc darwin */
# define __WORDSIZE WORDSIZE
# elif defined(__SIZEOF_POINTER__) /* ppc aix */
# define __WORDSIZE (__SIZEOF_POINTER__ << 3)
# elif defined(_ILP32) /* hppa hp-ux */
# define __WORDSIZE 32
# elif defined(_LP64) /* ia64 hp-ux (with cc +DD64) */
# define __WORDSIZE 64
# elif defined(_MIPS_SZPTR) /* mips irix */
# if _MIPS_SZPTR == 32
# define __WORDSIZE 32
@ -81,10 +70,6 @@
# define __BYTE_ORDER BYTE_ORDER
# elif defined(__BYTE_ORDER__) /* ppc aix */
# define __BYTE_ORDER __BYTE_ORDER__
# elif defined(_BIG_ENDIAN) /* hppa hp-ux */
# define __BYTE_ORDER __BIG_ENDIAN
# elif defined(__BIG_ENDIAN__) /* ia64 hp-ux */
# define __BYTE_ORDER __BIG_ENDIAN
# elif defined(__i386__) /* 32 bit x86 solaris */
# define __BYTE_ORDER __LITTLE_ENDIAN
# elif defined(__x86_64__) /* 64 bit x86 solaris */

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,134 +0,0 @@
/*
* Copyright (C) 2013-2017 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_hppa_h
#define _jit_hppa_h
#define JIT_HASH_CONSTS 1
#define JIT_NUM_OPERANDS 3
/*
* Types
*/
typedef enum {
_R0, /* Always zero */
_R1, /* ADDIL implicit target */
_R2, /* B,L implicit target */
#define jit_r_num() 4
#define jit_r(n) ((n) < 3 ? _R4 + (n) : _R10 + (n) - 3)
#define jit_v_num() 11
#define jit_v(n) ((n) < 3 ? _R7 + (n) : _R11 + (n) - 3)
#define jit_f_num() 8
#define jit_f(n) (_F12 - (n))
#define JIT_FP _R3
#define JIT_R0 _R4
#define JIT_R1 _R5
#define JIT_R2 _R6
#define JIT_R3 _R10
#define JIT_V0 _R7
#define JIT_V1 _R8
#define JIT_V2 _R9
#define JIT_V3 _R11
#define JIT_V4 _R12
#define JIT_V5 _R13
#define JIT_V6 _R14
#define JIT_V7 _R15
#define JIT_V8 _R16
#define JIT_V9 _R17
#define JIT_V10 _R18
_R3,
_R19,
_R20,
_R21,
_R22,
_R29, /* ret1 */
_R28, /* ret0 */
_R4,
_R5,
_R6,
_R7,
_R8,
_R9,
_R10,
_R11,
_R12,
_R13,
_R14,
_R15,
_R16,
_R17,
_R18,
_R23, /* arg3 */
_R24, /* arg2 */
_R25, /* arg1 */
_R26, /* arg0 */
_R27, /* Data Pointer */
_R30, /* Stack Pointer */
_R31, /* Link register */
#define JIT_F0 _F12
#define JIT_F1 _F13
#define JIT_F2 _F14
#define JIT_F3 _F15
#define JIT_F4 _F16
#define JIT_F5 _F17
#define JIT_F6 _F18
#define JIT_F7 _F19
#define JIT_F8 _F20
#define JIT_F9 _F21
/* Caller Saves */
_F31,
_F30,
_F29,
_F28,
_F27,
_F26,
_F25,
_F24,
_F23,
_F22,
_F11,
_F10,
_F9,
_F8,
/* Arguments */
_F7, /* farg3 */
_F6, /* farg2 */
_F5, /* farg1 */
_F4, /* farg0 */
/* Callee Saves */
_F21,
_F20,
_F19,
_F18,
_F17,
_F16,
_F15,
_F14,
_F13,
_F12,
/* Floating-Pointer Status and Exception */
_F0,
_F1,
_F2,
_F3,
#define JIT_NOREG _NOREG
_NOREG,
} jit_reg_t;
#endif /* _jit_hppa */

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,120 +0,0 @@
/*
* Copyright (C) 2013-2017 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_ia64_h
#define _jit_ia64_h
#define JIT_HASH_CONSTS 1
#define JIT_NUM_OPERANDS 3
/*
* Types
*/
#define JIT_FP _R4 /* Not abi specific */
typedef enum {
#define JIT_R0 _R40
#define JIT_R1 _R41
#define JIT_R2 _R42
#define JIT_R3 _R43
#define JIT_V0 _R44
#define JIT_V1 _R45
#define JIT_V2 _R46
#define JIT_V3 _R47
#define jit_r_num() 4
#define jit_r(n) (_R40 + (n))
#define jit_v_num() 4
#define jit_v(n) (_R44 + (n))
_R0, /* constant - Always 0 */
_R1, /* special - Global Data pointer (gp) */
/* r2-r3 - scratch - Use with 22-bit immediate add - scratch */
_R2, _R3,
/* r4-r7 - preserved */
_R4, _R5, _R6, _R7,
_R8, /* scratch - Return value; structure/union return pointer */
/* r9-r11 - scratch - Return values */
_R9, _R10, _R11,
_R12, /* special - Memory stack pointer (sp) */
_R13, /* special - Reserved as a thread pointer (tp)*/
/* r14-r31 - scratch */
_R31, _R30,
_R29, _R28, _R27, _R26, _R25, _R24, _R23, _R22,
_R21, _R20, _R19, _R18, _R17, _R16, _R15, _R14,
/* r32-r39 - aka in0-in7 - Incoming register arguments */
_R32, _R33, _R34, _R35, _R36, _R37, _R38, _R39,
/* r40-r127 - loc0...locn,out0...outn */
_R40, _R41, _R42, _R43, _R44, _R45, _R46, _R47,
_R48, _R49, _R50, _R51, _R52, _R53, _R54, _R55,
_R56, _R57, _R58, _R59, _R60, _R61, _R62, _R63,
_R64, _R65, _R66, _R67, _R68, _R69, _R70, _R71,
_R72, _R73, _R74, _R75, _R76, _R77, _R78, _R79,
_R80, _R81, _R82, _R83, _R84, _R85, _R86, _R87,
_R88, _R89, _R90, _R91, _R92, _R93, _R94, _R95,
_R96, _R97, _R98, _R99, _R100, _R101, _R102, _R103,
_R104, _R105, _R106, _R107, _R108, _R109, _R110, _R111,
_R112, _R113, _R114, _R115, _R116, _R117, _R118, _R119,
_R120, _R121, _R122, _R123, _R124, _R125, _R126, _R127,
#define JIT_F0 _F16
#define JIT_F1 _F17
#define JIT_F2 _F18
#define JIT_F3 _F19
#define JIT_F4 _F20
#define JIT_F5 _F21
#define jit_f_num() 6
#define jit_f(n) (_F16 + (n))
_F0, /* constant - Always 0.0 */
_F1, /* constant - Always 1.0 */
/* f2-f5 - preserved */
_F2, _F3, _F4, _F5,
/* f6-f7 - scratch */
_F6, _F7,
/* f8-f15 - scratch - Argument/return registers */
_F8, _F9, _F10, _F11, _F12, _F13, _F14, _F15,
/* f16-f31 - preserved */
_F16, _F17, _F18, _F19, _F20, _F21, _F22, _F23,
_F24, _F25, _F26, _F27, _F28, _F29, _F30, _F31,
/* f32-f127 - scratch - Rotating registers or scratch */
_F32, _F33, _F34, _F35, _F36, _F37, _F38, _F39,
_F40, _F41, _F42, _F43, _F44, _F45, _F46, _F47,
_F48, _F49, _F50, _F51, _F52, _F53, _F54, _F55,
_F56, _F57, _F58, _F59, _F60, _F61, _F62, _F63,
_F64, _F65, _F66, _F67, _F68, _F69, _F70, _F71,
_F72, _F73, _F74, _F75, _F76, _F77, _F78, _F79,
_F80, _F81, _F82, _F83, _F84, _F85, _F86, _F87,
_F88, _F89, _F90, _F91, _F92, _F93, _F94, _F95,
_F96, _F97, _F98, _F99, _F100, _F101, _F102, _F103,
_F104, _F105, _F106, _F107, _F108, _F109, _F110, _F111,
_F112, _F113, _F114, _F115, _F116, _F117, _F118, _F119,
#if 0
/* Do not list these to not need an unique identifier larger
* than 255 for jit_regset_t */
_F120, _F121, _F122, _F123, _F124, _F125, _F126, _F127,
#endif
/* Fake registers. Required because while "in" parameters start at r32,
* "out" parameters start *after* registers allocated for temporaries,
* and that are supposed to kept alive (what is desirable, that is, to
* not spill/reload them in memory) */
_OUT0, _OUT1, _OUT2, _OUT3, _OUT4, _OUT5, _OUT6, _OUT7,
#define JIT_NOREG _NOREG
_NOREG,
} jit_reg_t;
#endif /* _jit_ia64_h */

View file

@ -322,18 +322,10 @@ jit_patch_there(jit_state_t* _jit, jit_reloc_t reloc, jit_pointer_t addr)
# include "arm.c"
#elif defined(__ppc__) || defined(__powerpc__)
# include "ppc.c"
#elif defined(__sparc__)
# include "sparc.c"
#elif defined(__ia64__)
# include "ia64.c"
#elif defined(__hppa__)
# include "hppa.c"
#elif defined(__aarch64__)
# include "aarch64.c"
#elif defined(__s390__) || defined(__s390x__)
# include "s390.c"
#elif defined(__alpha__)
# include "alpha.c"
#endif
#define JIT_IMPL_0(stem, ret) \

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,102 +0,0 @@
/*
* Copyright (C) 2013-2017 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_sparc_h
#define _jit_sparc_h
#define JIT_HASH_CONSTS 1
#define JIT_NUM_OPERANDS 3
/*
* Types
*/
#define JIT_FP _FP
typedef enum {
#define jit_r(i) (_G2 + (i))
#define jit_r_num() 3
#define jit_v(i) (_L0 + (i))
#define jit_v_num() 8
#if __WORDSIZE == 32
# define jit_f(i) (_F0 + ((i) << 1))
# define jit_f_num() 8
#else
# define jit_f(i) (_F32 - (i))
# define jit_f_num() 16
#endif
#define JIT_R0 _G2
#define JIT_R1 _G3
#define JIT_R2 _G4
#define JIT_V0 _L0
#define JIT_V1 _L1
#define JIT_V2 _L2
#define JIT_V3 _L3
#define JIT_V4 _L4
#define JIT_V5 _L5
#define JIT_V6 _L6
#define JIT_V7 _L7
_G0, _G1, _G2, _G3, _G4, _G5, _G6, _G7,
_O0, _O1, _O2, _O3, _O4, _O5, _SP, _O7,
_L0, _L1, _L2, _L3, _L4, _L5, _L6, _L7,
_I0, _I1, _I2, _I3, _I4, _I5, _FP, _I7,
#if __WORDSIZE == 32
# define JIT_F0 _F0
# define JIT_F1 _F2
# define JIT_F2 _F4
# define JIT_F3 _F6
# define JIT_F4 _F8
# define JIT_F5 _F10
# define JIT_F6 _F12
# define JIT_F7 _F14
_F0, _F1, _F2, _F3, _F4, _F5, _F6, _F7,
_F8, _F9, _F10, _F11, _F12, _F13, _F14, _F15,
#else
/* All single precision operations have a high cost due to being
* stored on registers only encodable as double precision.
* The cost is due to needing to move values to a register with
* value <= 31.
* This is a limitation due to using fixed named registers in
* lightning. */
# define JIT_F0 _F32
# define JIT_F1 _F34
# define JIT_F2 _F36
# define JIT_F3 _F38
# define JIT_F4 _F40
# define JIT_F5 _F42
# define JIT_F6 _F44
# define JIT_F7 _F46
# define JIT_F8 _F48
# define JIT_F9 _F50
# define JIT_F10 _F52
# define JIT_F11 _F54
# define JIT_F12 _F56
# define JIT_F13 _F58
# define JIT_F14 _F60
# define JIT_F15 _F62
_F62, _F60, _F58, _F56, _F54, _F52, _F50, _F48,
_F46, _F44, _F42, _F40, _F38, _F36, _F34, _F32,
_F31, _F30, _F29, _F28, _F27, _F26, _F25, _F24,
_F23, _F22, _F21, _F20, _F19, _F18, _F17, _F16,
_F15, _F14, _F13, _F12, _F11, _F10, _F9, _F8,
_F7, _F6, _F5, _F4, _F3, _F2, _F1, _F0,
#endif
#define JIT_NOREG _NOREG
_NOREG,
} jit_reg_t;
#endif /* _jit_sparc_h */