guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] 247/437: Add the jit_callee_save_p interface and extra r


From: Andy Wingo
Subject: [Guile-commits] 247/437: Add the jit_callee_save_p interface and extra register definitions.
Date: Mon, 2 Jul 2018 05:14:30 -0400 (EDT)

wingo pushed a commit to branch lightning
in repository guile.

commit a62f405751f54279304de82b324de8901623e0a3
Author: pcpa <address@hidden>
Date:   Tue Sep 10 21:41:49 2013 -0300

    Add the jit_callee_save_p interface and extra register definitions.
    
        * check/self.c, check/self.ok: New files implementing simple
        consistency check assertions. At first validating some macros
        that use values from different sources agree.
    
        * check/Makefile.am: Update for the new test case.
    
        * include/lightning.h,  lib/lightning.c: Add the new
        jit_callee_save_p() call, that is intended to be used when
        writing complex code using lightning, so that one does not
        need to verify what backend is being used, or have access to
        private data, to query if a register is callee save or not;
        on several backends the scratch registers are actually callee
        save.
    
        * include/lightning/jit_aarch64.h, include/lightning/jit_arm.h,
        include/lightning/jit_hppa.h, include/lightning/jit_mips.h,
        include/lightning/jit_ppc.h, include/lightning/jit_sparc.h,
        include/lightning/jit_x86.h: Add an explicit definition for
        JIT_R3-JIT_Rn, JIT_V3-JIT_Vn and JIT_F6-JIT_Fn when applicable.
        This allows one to write code based on "#if defined(JIT_XN)"
        and therefore, not need to check what is the current backend
        or have access to private data structures. This is particularly
        useful when writing virtual machines with several specialized,
        global registers.
    
        * lib/jit_ia64.c: Properly flag the callee save general
        purpose registers as such, so that jit_callee_save_p() works
        as intended.
---
 ChangeLog                       | 31 ++++++++++++++++
 check/Makefile.am               |  7 +++-
 check/self.c                    | 69 +++++++++++++++++++++++++++++++++++
 check/self.ok                   |  1 +
 include/lightning.h             |  3 ++
 include/lightning/jit_aarch64.h | 13 +++++++
 include/lightning/jit_arm.h     |  4 +-
 include/lightning/jit_hppa.h    | 19 ++++++++--
 include/lightning/jit_mips.h    | 29 ++++++++++++++-
 include/lightning/jit_ppc.h     | 43 ++--------------------
 include/lightning/jit_sparc.h   |  7 ++++
 include/lightning/jit_x86.h     | 12 ------
 lib/jit_ia64.c                  | 81 +++++++++++++++++++++--------------------
 lib/lightning.c                 |  7 ++++
 14 files changed, 228 insertions(+), 98 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3743658..c780db0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,36 @@
 2013-09-10 Paulo Andrade <address@hidden>
 
+       * check/self.c, check/self.ok: New files implementing simple
+       consistency check assertions. At first validating some macros
+       that use values from different sources agree.
+
+       * check/Makefile.am: Update for the new test case.
+
+       * include/lightning.h,  lib/lightning.c: Add the new
+       jit_callee_save_p() call, that is intended to be used when
+       writing complex code using lightning, so that one does not
+       need to verify what backend is being used, or have access to
+       private data, to query if a register is callee save or not;
+       on several backends the scratch registers are actually callee
+       save.
+
+       * include/lightning/jit_aarch64.h, include/lightning/jit_arm.h,
+       include/lightning/jit_hppa.h, include/lightning/jit_mips.h,
+       include/lightning/jit_ppc.h, include/lightning/jit_sparc.h,
+       include/lightning/jit_x86.h: Add an explicit definition for
+       JIT_R3-JIT_Rn, JIT_V3-JIT_Vn and JIT_F6-JIT_Fn when applicable.
+       This allows one to write code based on "#if defined(JIT_XN)"
+       and therefore, not need to check what is the current backend
+       or have access to private data structures. This is particularly
+       useful when writing virtual machines with several specialized,
+       global registers.
+
+       * lib/jit_ia64.c: Properly flag the callee save general
+       purpose registers as such, so that jit_callee_save_p() works
+       as intended.
+
+2013-09-10 Paulo Andrade <address@hidden>
+
        * check/lightning.c, configure.ac: Conditionally use the
        code written to workaround a bug in the Hercules emulator,
        as isnan and isinf are not available at least on HP-UX ia64.
diff --git a/check/Makefile.am b/check/Makefile.am
index 79522f7..3684041 100644
--- a/check/Makefile.am
+++ b/check/Makefile.am
@@ -16,7 +16,7 @@
 
 AM_CFLAGS = -I$(top_srcdir)/include -D_GNU_SOURCE
 
-check_PROGRAMS = lightning ccall
+check_PROGRAMS = lightning ccall self
 
 lightning_LDADD = $(top_builddir)/lib/liblightning.la -lm $(SHLIB)
 lightning_SOURCES = lightning.c
@@ -24,6 +24,9 @@ lightning_SOURCES = lightning.c
 ccall_LDADD = $(top_builddir)/lib/liblightning.la -lm $(SHLIB)
 ccall_SOURCES = ccall.c
 
+self_LDADD = $(top_builddir)/lib/liblightning.la -lm $(SHLIB)
+self_SOURCES = ccall.c
+
 $(top_builddir)/lib/liblightning.la:
        cd $(top_builddir)/lib; $(MAKE) $(AM_MAKEFLAGS) liblightning.la
 
@@ -175,7 +178,7 @@ $(swf_TESTS):       check.swf.sh
 TESTS += $(swf_TESTS)
 endif
 
-TESTS += ccall
+TESTS += ccall self
 CLEANFILES = $(TESTS)
 
 #TESTS_ENVIRONMENT=$(srcdir)/run-test;
diff --git a/check/self.c b/check/self.c
new file mode 100644
index 0000000..4275825
--- /dev/null
+++ b/check/self.c
@@ -0,0 +1,69 @@
+#include <lightning.h>
+#include <stdio.h>
+#include <assert.h>
+
+int
+main(int argc, char *argv[])
+{
+    /* Same JIT_XY are not constants */
+    init_jit(argv[0]);
+
+    assert(JIT_R0 == jit_r(0));
+    assert(JIT_R1 == jit_r(1));
+    assert(JIT_R2 == jit_r(2));
+#if defined(JIT_R3)
+    assert(JIT_R3 == jit_r(3));
+#  if defined(JIT_R4)
+    assert(JIT_R4 == jit_r(4));
+#    if defined(JIT_R5)
+    assert(JIT_R5 == jit_r(5));
+#      if defined(JIT_R6)
+    assert(JIT_R6 == jit_r(6));
+#        if defined(JIT_R7)
+    assert(JIT_R7 == jit_r(7));
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+    assert(JIT_V0 == jit_v(0));
+    assert(JIT_V1 == jit_v(1));
+    assert(JIT_V2 == jit_v(2));
+#if defined(JIT_V3)
+    assert(JIT_V3 == jit_v(3));
+#  if defined(JIT_V4)
+    assert(JIT_V4 == jit_v(4));
+#    if defined(JIT_V5)
+    assert(JIT_V5 == jit_v(5));
+#      if defined(JIT_V6)
+    assert(JIT_V6 == jit_v(6));
+#        if defined(JIT_V7)
+    assert(JIT_V7 == jit_v(7));
+#          if defined(JIT_V8)
+    assert(JIT_V8 == jit_v(8));
+#            if defined(JIT_V9)
+    assert(JIT_V9 == jit_v(9));
+#            endif
+#          endif
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+    assert(JIT_F0 == jit_f(0));
+    assert(JIT_F1 == jit_f(1));
+    assert(JIT_F2 == jit_f(2));
+    assert(JIT_F3 == jit_f(3));
+    assert(JIT_F4 == jit_f(4));
+    assert(JIT_F5 == jit_f(5));
+#if defined(JIT_F6)
+    assert(JIT_F6 == jit_f(6));
+#  if defined(JIT_F7)
+    assert(JIT_F7 == jit_f(7));
+#  endif
+#endif
+
+    finish_jit();
+
+    return (0);
+}
diff --git a/check/self.ok b/check/self.ok
new file mode 100644
index 0000000..9766475
--- /dev/null
+++ b/check/self.ok
@@ -0,0 +1 @@
+ok
diff --git a/include/lightning.h b/include/lightning.h
index 87de1d1..f1fb1f9 100644
--- a/include/lightning.h
+++ b/include/lightning.h
@@ -951,6 +951,9 @@ extern jit_node_t *_jit_new_node_pwf(jit_state_t*, 
jit_code_t,
 extern jit_node_t *_jit_new_node_pwd(jit_state_t*, jit_code_t,
                                     jit_pointer_t, jit_word_t, jit_float64_t);
 
+#define jit_callee_save_p(u)           _jit_callee_save_p(_jit,u)
+extern jit_bool_t _jit_callee_save_p(jit_state_t*, jit_int32_t);
+
 #define jit_disassemble()              _jit_disassemble(_jit)
 extern void _jit_disassemble(jit_state_t*);
 
diff --git a/include/lightning/jit_aarch64.h b/include/lightning/jit_aarch64.h
index 1a7256c..b42f709 100644
--- a/include/lightning/jit_aarch64.h
+++ b/include/lightning/jit_aarch64.h
@@ -39,6 +39,10 @@ typedef enum {
 #define JIT_R0                 _R9
 #define JIT_R1                 _R10
 #define JIT_R2                 _R11
+#define JIT_R3                 _R12
+#define JIT_R4                 _R13
+#define JIT_R5                 _R14
+#define JIT_R6                 _R15
     _R8,                               /* indirect result */
     _R18,                              /* platform register */
     _R17,                              /* IP1 */
@@ -48,6 +52,13 @@ typedef enum {
 #define JIT_V0                 _R19
 #define JIT_V1                 _R20
 #define JIT_V2                 _R21
+#define JIT_V3                 _R22
+#define JIT_V4                 _R23
+#define JIT_V5                 _R24
+#define JIT_V6                 _R25
+#define JIT_V7                 _R26
+#define JIT_V8                 _R27
+#define JIT_V9                 _R28
     _R19,      _R20,   _R21,   _R22,   /* callee save */
     _R23,      _R24,   _R25,   _R26,
     _R27,      _R28,
@@ -63,6 +74,8 @@ typedef enum {
 #define JIT_F3                 _V11
 #define JIT_F4                 _V12
 #define JIT_F5                 _V13
+#define JIT_F6                 _V14
+#define JIT_F7                 _V15
     _V31,      _V30,   _V29,   _V28,   /* temporaries */
     _V27,      _V26,   _V25,   _V24,
     _V23,      _V22,   _V21,   _V20,
diff --git a/include/lightning/jit_arm.h b/include/lightning/jit_arm.h
index 1b143b5..f3f7d19 100644
--- a/include/lightning/jit_arm.h
+++ b/include/lightning/jit_arm.h
@@ -38,7 +38,7 @@ typedef enum {
 #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) : _D7 + (i))
-#define jit_f_num()            (jit_cpu.vfp ? 16 : 8)
+#define jit_f_num()            8
     _R12,                      /* ip - temporary */
 #define JIT_R0                 _R4
 #define JIT_R1                 _R5
@@ -68,6 +68,8 @@ typedef enum {
 #define JIT_F3                 (jit_hardfp_p() ? _D11 : _D3)
 #define JIT_F4                 (jit_hardfp_p() ? _D12 : _D4)
 #define JIT_F5                 (jit_hardfp_p() ? _D13 : _D5)
+#define JIT_F6                 (jit_hardfp_p() ? _D14 : _D6)
+#define JIT_F7                 (jit_hardfp_p() ? _D15 : _D7)
     _S16,      _D8 = _S16,     _Q4 = _D8,
     _S17,
     _S18,      _D9 = _S18,
diff --git a/include/lightning/jit_hppa.h b/include/lightning/jit_hppa.h
index 72169e8..e7c5fe4 100644
--- a/include/lightning/jit_hppa.h
+++ b/include/lightning/jit_hppa.h
@@ -33,18 +33,27 @@ typedef enum {
     _R1,                       /* ADDIL implicit target */
     _R2,                       /* B,L implicit target */
 #define jit_r_num()            4
-#define jit_r(n)               ((n) < 4 ? _R4 + (n) : _R10 + (n))
-#define jit_v_num()            4
-#define jit_v(n)               ((n) < 4 ? _R7 + (n) : _R11 + (n))
+#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,
@@ -80,6 +89,10 @@ typedef enum {
 #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,
diff --git a/include/lightning/jit_mips.h b/include/lightning/jit_mips.h
index be636b8..a936f36 100644
--- a/include/lightning/jit_mips.h
+++ b/include/lightning/jit_mips.h
@@ -44,14 +44,32 @@ typedef enum {
 #define jit_v_num()            8
 #define jit_arg_f_reg_p(i)     ((i) >= 0 && (i) < 4)
 #define jit_f(i)               (_F0 + (i))
-#define jit_f_num()            14
+#if NEW_ABI
+#  define jit_f_num()          6
+#else
+#  define jit_f_num()          8
+#endif
     _AT,
 #define JIT_R0                 _V0
 #define JIT_R1                 _V1
 #if NEW_ABI
 #  define JIT_R2               _T4
+#  define JIT_R3               _T5
+#  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
+#  define JIT_R4               _T2
+#  define JIT_R5               _T3
+#  define JIT_R6               _T4
+#  define JIT_R7               _T5
+#  define JIT_R8               _T6
+#  define JIT_R9               _T7
+#  define JIT_R10              _T8
+#  define JIT_R11              _T9
 #endif
     _V0, _V1,
 #if !NEW_ABI
@@ -61,6 +79,11 @@ typedef enum {
 #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
     _S0, _S1, _S2, _S3, _S4, _S5, _S6, _S7,
     _ZERO, _K0, _K1, _RA,
     _GP,
@@ -76,6 +99,10 @@ typedef enum {
 #define JIT_F3                 _F6
 #define JIT_F4                 _F8
 #define JIT_F5                 _F10
+#if !NEW_ABI
+#  define JIT_F6               _F16
+#  define JIT_F7               _F18
+#endif
     _F0, _F2, _F4, _F6, _F8, _F10,
     /* callee save float registers */
 #if !NEW_ABI
diff --git a/include/lightning/jit_ppc.h b/include/lightning/jit_ppc.h
index da782a0..9976b09 100644
--- a/include/lightning/jit_ppc.h
+++ b/include/lightning/jit_ppc.h
@@ -39,7 +39,7 @@ typedef enum {
 #endif
 #define jit_arg_f_reg_p(i)     ((i) >= 0 && (i) < 13)
 #define jit_f(i)               (_F14 + (i))
-#define jit_f_num()            6
+#define jit_f_num()            8
     _R0,
 #if __ppc__
 #  define JIT_R0               _R11
@@ -77,33 +77,8 @@ typedef enum {
 #define JIT_FP                 _R31
     _R31,
 #define JIT_RA0                        _R3
-#define JIT_RA1                        _R4
-#define JIT_RA2                        _R5
-#define JIT_RA3                        _R6
-#define JIT_RA4                        _R7
-#define JIT_RA5                        _R8
-#define JIT_RA6                        _R9
-#define JIT_RA7                        _R10
     _R10,      _R9,    _R8,    _R7,    _R6,    _R5,    _R4,    _R3,
     _F0,
-#define JIT_FS0                        _F14
-#define JIT_FS1                        _F15
-#define JIT_FS2                        _F16
-#define JIT_FS3                        _F17
-#define JIT_FS4                        _F18
-#define JIT_FS5                        _F19
-#define JIT_FS6                        _F20
-#define JIT_FS7                        _F21
-#define JIT_FS8                        _F22
-#define JIT_FS9                        _F23
-#define JIT_FS10               _F24
-#define JIT_FS11               _F25
-#define JIT_FS12               _F26
-#define JIT_FS13               _F27
-#define JIT_FS14               _F28
-#define JIT_FS15               _F29
-#define JIT_FS16               _F30
-#define JIT_FS17               _F31
     _F14,      _F15,   _F16,   _F17,   _F18,   _F19,   _F20,   _F21,
 #define JIT_F0                 _F14
 #define JIT_F1                 _F15
@@ -111,23 +86,13 @@ typedef enum {
 #define JIT_F3                 _F17
 #define JIT_F4                 _F18
 #define JIT_F5                 _F19
-    /* FIXME _F20-_F31 not (easily) accesible and only _F14-_F21
+#define JIT_F6                 _F20
+#define JIT_F7                 _F21
+    /* FIXME _F20-_F31 not (easily) accessible and only _F14-_F21
      * saved/restored (if used) */
     _F22,      _F23,   _F24,   _F25,   _F26,   _F27,   _F28,   _F29,
     _F30,      _F31,
 #define JIT_FA0                        _F1
-#define JIT_FA1                        _F2
-#define JIT_FA2                        _F3
-#define JIT_FA3                        _F4
-#define JIT_FA4                        _F5
-#define JIT_FA5                        _F6
-#define JIT_FA6                        _F7
-#define JIT_FA7                        _F8
-#define JIT_FA8                        _F9
-#define JIT_FA9                        _F10
-#define JIT_FA10               _F11
-#define JIT_FA11               _F12
-#define JIT_FA12               _F13
     _F13,      _F12,   _F11,   _F10,   _F9,    _F8,    _F7,    _F6,
     _F5,       _F4,    _F3,    _F2,    _F1,
     _NOREG,
diff --git a/include/lightning/jit_sparc.h b/include/lightning/jit_sparc.h
index 99d6a95..946d382 100644
--- a/include/lightning/jit_sparc.h
+++ b/include/lightning/jit_sparc.h
@@ -42,6 +42,11 @@ typedef enum {
 #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,
@@ -52,6 +57,8 @@ typedef enum {
 #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,
 #define JIT_NOREG              _NOREG
diff --git a/include/lightning/jit_x86.h b/include/lightning/jit_x86.h
index 7f95e28..76718eb 100644
--- a/include/lightning/jit_x86.h
+++ b/include/lightning/jit_x86.h
@@ -79,11 +79,6 @@ typedef enum {
 #  define JIT_V3               _R15
     _RBX,      _R13,   _R14,   _R15,
 #  define JIT_RA0              _RDI
-#  define JIT_RA1              _RSI
-#  define JIT_RA2              _RDX
-#  define JIT_RA3              _RCX
-#  define JIT_RA4              _R8
-#  define JIT_RA5              _R9
     _R9,       _R8,    _RCX,   _RDX,   _RSI,   _RDI,
     _RSP,      _RBP,
 #  define JIT_F0               _XMM8
@@ -96,13 +91,6 @@ typedef enum {
 #  define JIT_F7               _XMM15
     _XMM8,     _XMM9,  _XMM10, _XMM11, _XMM12, _XMM13, _XMM14, _XMM15,
 #  define JIT_FA0              _XMM0
-#  define JIT_FA1              _XMM1
-#  define JIT_FA2              _XMM2
-#  define JIT_FA3              _XMM3
-#  define JIT_FA4              _XMM4
-#  define JIT_FA5              _XMM5
-#  define JIT_FA6              _XMM6
-#  define JIT_FA7              _XMM7
     _XMM7,     _XMM6,  _XMM5,  _XMM4,  _XMM3,  _XMM2,  _XMM1,  _XMM0,
 #  define jit_sse_reg_p(reg)   ((reg) >= _XMM8 && (reg) <= _XMM0)
 #endif
diff --git a/lib/jit_ia64.c b/lib/jit_ia64.c
index b123bdf..eabc5cb 100644
--- a/lib/jit_ia64.c
+++ b/lib/jit_ia64.c
@@ -83,47 +83,48 @@ jit_register_t              _rvs[] = {
     { rc(arg)|36,       "r36" },       { rc(arg)|37,           "r37" },
     { rc(arg)|38,       "r38" },       { rc(arg)|39,           "r39" },
     /* JIT_R0-JIT_V3 */
-    { rc(gpr)|40,       "r40" },       { rc(gpr)|41,           "r41" },
-    { rc(gpr)|42,       "r42" },       { rc(gpr)|43,           "r43" },
-    { rc(gpr)|44,       "r44" },       { rc(gpr)|45,           "r45" },
-    { rc(gpr)|46,       "r46" },       { rc(gpr)|47,           "r47" },
+    { rc(gpr)|rc(sav)|40, "r40" },     { rc(gpr)|rc(sav)|41,   "r41" },
+    { rc(gpr)|rc(sav)|42, "r42" },     { rc(gpr)|rc(sav)|43,   "r43" },
+    { rc(gpr)|rc(sav)|44, "r44" },     { rc(gpr)|rc(sav)|45,   "r45" },
+    { rc(gpr)|rc(sav)|46, "r46" },     { rc(gpr)|rc(sav)|47,   "r47" },
     /* Temporaries/locals */
-    { rc(gpr)|48,       "r48" },       { rc(gpr)|49,           "r49" },
-    { rc(gpr)|50,       "r50" },       { rc(gpr)|51,           "r51" },
-    { rc(gpr)|52,       "r52" },       { rc(gpr)|53,           "r53" },
-    { rc(gpr)|54,       "r54" },       { rc(gpr)|55,           "r55" },
-    { rc(gpr)|56,       "r56" },       { rc(gpr)|57,           "r57" },
-    { rc(gpr)|58,       "r58" },       { rc(gpr)|59,           "r59" },
-    { rc(gpr)|60,       "r60" },       { rc(gpr)|61,           "r61" },
-    { rc(gpr)|62,       "r62" },       { rc(gpr)|63,           "r63" },
-    { rc(gpr)|64,       "r64" },       { rc(gpr)|65,           "r65" },
-    { rc(gpr)|66,       "r66" },       { rc(gpr)|67,           "r67" },
-    { rc(gpr)|68,       "r68" },       { rc(gpr)|69,           "r69" },
-    { rc(gpr)|70,       "r70" },       { rc(gpr)|71,           "r71" },
-    { rc(gpr)|72,       "r72" },       { rc(gpr)|73,           "r73" },
-    { rc(gpr)|74,       "r74" },       { rc(gpr)|75,           "r75" },
-    { rc(gpr)|76,       "r76" },       { rc(gpr)|77,           "r77" },
-    { rc(gpr)|78,       "r78" },       { rc(gpr)|79,           "r79" },
-    { rc(gpr)|80,       "r80" },       { rc(gpr)|81,           "r81" },
-    { rc(gpr)|82,       "r82" },       { rc(gpr)|83,           "r83" },
-    { rc(gpr)|84,       "r84" },       { rc(gpr)|85,           "r85" },
-    { rc(gpr)|86,       "r86" },       { rc(gpr)|87,           "r87" },
-    { rc(gpr)|88,       "r88" },       { rc(gpr)|89,           "r89" },
-    { rc(gpr)|90,       "r90" },       { rc(gpr)|91,           "r91" },
-    { rc(gpr)|92,       "r92" },       { rc(gpr)|93,           "r93" },
-    { rc(gpr)|94,       "r94" },       { rc(gpr)|95,           "r95" },
-    { rc(gpr)|96,       "r96" },       { rc(gpr)|97,           "r97" },
-    { rc(gpr)|98,       "r98" },       { rc(gpr)|99,           "r99" },
-    { rc(gpr)|100,      "r100"},       { rc(gpr)|101,          "r101"},
-    { rc(gpr)|102,      "r102"},       { rc(gpr)|103,          "r103"},
-    { rc(gpr)|104,      "r104"},       { rc(gpr)|105,          "r105"},
-    { rc(gpr)|106,      "r106"},       { rc(gpr)|107,          "r107"},
-    { rc(gpr)|108,      "r108"},       { rc(gpr)|109,          "r109"},
-    { rc(gpr)|110,      "r110"},       { rc(gpr)|111,          "r111"},
-    { rc(gpr)|112,      "r112"},       { rc(gpr)|113,          "r113"},
-    { rc(gpr)|114,      "r114"},       { rc(gpr)|115,          "r115"},
-    /* Do not enable these because no matter what, want 12 free registers,
-     * 4 for prolog and epilog and 8 for outgoing arguments */
+    { rc(gpr)|rc(sav)|48, "r48" },     { rc(gpr)|rc(sav)|49,   "r49" },
+    { rc(gpr)|rc(sav)|50, "r50" },     { rc(gpr)|rc(sav)|51,   "r51" },
+    { rc(gpr)|rc(sav)|52, "r52" },     { rc(gpr)|rc(sav)|53,   "r53" },
+    { rc(gpr)|rc(sav)|54, "r54" },     { rc(gpr)|rc(sav)|55,   "r55" },
+    { rc(gpr)|rc(sav)|56, "r56" },     { rc(gpr)|rc(sav)|57,   "r57" },
+    { rc(gpr)|rc(sav)|58, "r58" },     { rc(gpr)|rc(sav)|59,   "r59" },
+    { rc(gpr)|rc(sav)|60, "r60" },     { rc(gpr)|rc(sav)|61,   "r61" },
+    { rc(gpr)|rc(sav)|62, "r62" },     { rc(gpr)|rc(sav)|63,   "r63" },
+    { rc(gpr)|rc(sav)|64, "r64" },     { rc(gpr)|rc(sav)|65,   "r65" },
+    { rc(gpr)|rc(sav)|66, "r66" },     { rc(gpr)|rc(sav)|67,   "r67" },
+    { rc(gpr)|rc(sav)|68, "r68" },     { rc(gpr)|rc(sav)|69,   "r69" },
+    { rc(gpr)|rc(sav)|70, "r70" },     { rc(gpr)|rc(sav)|71,   "r71" },
+    { rc(gpr)|rc(sav)|72, "r72" },     { rc(gpr)|rc(sav)|73,   "r73" },
+    { rc(gpr)|rc(sav)|74, "r74" },     { rc(gpr)|rc(sav)|75,   "r75" },
+    { rc(gpr)|rc(sav)|76, "r76" },     { rc(gpr)|rc(sav)|77,   "r77" },
+    { rc(gpr)|rc(sav)|78, "r78" },     { rc(gpr)|rc(sav)|79,   "r79" },
+    { rc(gpr)|rc(sav)|80, "r80" },     { rc(gpr)|rc(sav)|81,   "r81" },
+    { rc(gpr)|rc(sav)|82, "r82" },     { rc(gpr)|rc(sav)|83,   "r83" },
+    { rc(gpr)|rc(sav)|84, "r84" },     { rc(gpr)|rc(sav)|85,   "r85" },
+    { rc(gpr)|rc(sav)|86, "r86" },     { rc(gpr)|rc(sav)|87,   "r87" },
+    { rc(gpr)|rc(sav)|88, "r88" },     { rc(gpr)|rc(sav)|89,   "r89" },
+    { rc(gpr)|rc(sav)|90, "r90" },     { rc(gpr)|rc(sav)|91,   "r91" },
+    { rc(gpr)|rc(sav)|92, "r92" },     { rc(gpr)|rc(sav)|93,   "r93" },
+    { rc(gpr)|rc(sav)|94, "r94" },     { rc(gpr)|rc(sav)|95,   "r95" },
+    { rc(gpr)|rc(sav)|96, "r96" },     { rc(gpr)|rc(sav)|97,   "r97" },
+    { rc(gpr)|rc(sav)|98, "r98" },     { rc(gpr)|rc(sav)|99,   "r99" },
+    { rc(gpr)|rc(sav)|100,"r100"},     { rc(gpr)|rc(sav)|101,  "r101"},
+    { rc(gpr)|rc(sav)|102,"r102"},     { rc(gpr)|rc(sav)|103,  "r103"},
+    { rc(gpr)|rc(sav)|104,"r104"},     { rc(gpr)|rc(sav)|105,  "r105"},
+    { rc(gpr)|rc(sav)|106,"r106"},     { rc(gpr)|rc(sav)|107,  "r107"},
+    { rc(gpr)|rc(sav)|108,"r108"},     { rc(gpr)|rc(sav)|109,  "r109"},
+    { rc(gpr)|rc(sav)|110,"r110"},     { rc(gpr)|rc(sav)|111,  "r111"},
+    { rc(gpr)|rc(sav)|112,"r112"},     { rc(gpr)|rc(sav)|113,  "r113"},
+    { rc(gpr)|rc(sav)|114,"r114"},
+    /* Do not enable these because no matter what, want 13 free registers,
+     * 5 for prolog and epilog and 8 for outgoing arguments */
+    { 115,              "r115"},
     { 116,              "r116"},       { 117,                  "r117"},
     { 118,              "r118"},       { 119,                  "r119"},
     { 120,              "r120"},       { 121,                  "r121"},
diff --git a/lib/lightning.c b/lib/lightning.c
index 84ce4da..58e7130 100644
--- a/lib/lightning.c
+++ b/lib/lightning.c
@@ -330,6 +330,13 @@ _jit_unget_reg(jit_state_t *_jit, jit_int32_t regno)
     jit_regset_clrbit(&_jitc->regarg, regno);
 }
 
+jit_bool_t
+_jit_callee_save_p(jit_state_t *_jit, jit_int32_t regno)
+{
+    assert(regno >= 0 && regno < JIT_NOREG);
+    return (!!(_rvs[regno].spec & jit_class_sav));
+}
+
 #if __ia64__
 void
 jit_regset_com(jit_regset_t *u, jit_regset_t *v)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]