[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 354/437: Implement the jit_arg_register_p predicate.
From: |
Andy Wingo |
Subject: |
[Guile-commits] 354/437: Implement the jit_arg_register_p predicate. |
Date: |
Mon, 2 Jul 2018 05:14:53 -0400 (EDT) |
wingo pushed a commit to branch lightning
in repository guile.
commit c8b6c36971888bbb856d09bfb2a80271a4a47ec2
Author: pcpa <address@hidden>
Date: Sun Jan 18 11:24:25 2015 -0200
Implement the jit_arg_register_p predicate.
* include/lightning.h, lib/jit_aarch64.c,
lib/jit_alpha.c, lib/jit_arm-vfp.c, lib/jit_arm.c,
lib/jit_hppa.c, lib/jit_ia64.c, lib/jit_mips.c,
lib/jit_ppc.c, lib/jit_s390.c, lib/jit_sparc.c,
lib/jit_x86.c: Add the new jit_arg_register_p predicate.
The predicate is expected to be used to know if an
argument is in a register, what would need special
handling if code that can overwrite non callee save
registers is executed.
* check/carg.c: New test case to check consistency and
expected usage of jit_arg_register_p.
* check/Makefile.am: Update for new test case.
---
ChangeLog | 17 ++
check/Makefile.am | 7 +-
check/carg.c | 538 ++++++++++++++++++++++++++++++++++++++++++++++++++++
include/lightning.h | 2 +
lib/jit_aarch64.c | 9 +
lib/jit_alpha.c | 9 +
lib/jit_arm-vfp.c | 7 +-
lib/jit_arm.c | 17 ++
lib/jit_hppa.c | 8 +
lib/jit_ia64.c | 8 +
lib/jit_mips.c | 13 ++
lib/jit_ppc.c | 9 +
lib/jit_s390.c | 9 +
lib/jit_sparc.c | 9 +
lib/jit_x86.c | 9 +
15 files changed, 667 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index c4a5d15..5595a99 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,22 @@
2015-01-17 Paulo Andrade <address@hidden>
+ * include/lightning.h, lib/jit_aarch64.c,
+ lib/jit_alpha.c, lib/jit_arm-vfp.c, lib/jit_arm.c,
+ lib/jit_hppa.c, lib/jit_ia64.c, lib/jit_mips.c,
+ lib/jit_ppc.c, lib/jit_s390.c, lib/jit_sparc.c,
+ lib/jit_x86.c: Add the new jit_arg_register_p predicate.
+ The predicate is expected to be used to know if an
+ argument is in a register, what would need special
+ handling if code that can overwrite non callee save
+ registers is executed.
+
+ * check/carg.c: New test case to check consistency and
+ expected usage of jit_arg_register_p.
+
+ * check/Makefile.am: Update for new test case.
+
+2015-01-17 Paulo Andrade <address@hidden>
+
* include/lightning/jit_aarch64.h,
include/lightning/jit_alpha.h,
include/lightning/jit_arm.h,
diff --git a/check/Makefile.am b/check/Makefile.am
index c295711..de11b81 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 self setcode nodata ctramp
+check_PROGRAMS = lightning ccall self setcode nodata ctramp carg
lightning_LDADD = $(top_builddir)/lib/liblightning.la -lm $(SHLIB)
lightning_SOURCES = lightning.c
@@ -36,6 +36,9 @@ nodata_SOURCES = nodata.c
ctramp_LDADD = $(top_builddir)/lib/liblightning.la -lm $(SHLIB)
ctramp_SOURCES = ctramp.c
+carg_LDADD = $(top_builddir)/lib/liblightning.la -lm $(SHLIB)
+carg_SOURCES = carg.c
+
$(top_builddir)/lib/liblightning.la:
cd $(top_builddir)/lib; $(MAKE) $(AM_MAKEFLAGS) liblightning.la
@@ -294,7 +297,7 @@ $(nodata_TESTS): check.nodata.sh
TESTS += $(nodata_TESTS)
endif
-TESTS += ccall self setcode nodata ctramp
+TESTS += ccall self setcode nodata ctramp carg
CLEANFILES = $(TESTS)
#TESTS_ENVIRONMENT=$(srcdir)/run-test;
diff --git a/check/carg.c b/check/carg.c
new file mode 100644
index 0000000..35b897e
--- /dev/null
+++ b/check/carg.c
@@ -0,0 +1,538 @@
+#include <lightning.h>
+#include <stdio.h>
+
+/* Simple test for arguments handling, that also shows how to use
+ * arguments to store values.
+ * Register arguments, if available, are very fast, but are also
+ * very volatile on some ports, because some ports will do C calls
+ * to implement division, remainder, sometimes multiplication, or
+ * some float operations.
+ * Arguments in registers should be fetched in the prolog of the
+ * function, and if they must be saved, they should be saved in
+ * the prolog.
+ * The predicate macro "jit_arg_register_p(arg)" allows knowing if
+ * an argument lives in a register, where it is known for being a very
+ * fast to read/write temporary storage.
+ */
+
+#define W jit_word_t
+#define F jit_float32_t
+#define D jit_float64_t
+
+jit_state_t *_jit;
+
+void
+cw(W a1, W a2, W a3, W a4, W a5, W a6, W a7, W a8,
+ W a9, W a10, W a11, W a12, W a13, W a14, W a15, W a16)
+{
+ if ( a1 != 1 || a2 != 2 || a3 != 3 || a4 != 4 ||
+ a5 != 5 || a6 != 6 || a7 != 7 || a8 != 8 ||
+ a9 != 9 || a10 != 10 || a11 != 11 || a12 != 12 ||
+ a13 != 13 || a14 != 14 || a15 != 15 || a16 != 16)
+ abort();
+}
+
+void
+cf(F a1, F a2, F a3, F a4, F a5, F a6, F a7, F a8,
+ F a9, F a10, F a11, F a12, F a13, F a14, F a15, F a16)
+{
+ if ( a1 != 1 || a2 != 2 || a3 != 3 || a4 != 4 ||
+ a5 != 5 || a6 != 6 || a7 != 7 || a8 != 8 ||
+ a9 != 9 || a10 != 10 || a11 != 11 || a12 != 12 ||
+ a13 != 13 || a14 != 14 || a15 != 15 || a16 != 16)
+ abort();
+}
+
+void
+cd(D a1, D a2, D a3, D a4, D a5, D a6, D a7, D a8,
+ D a9, D a10, D a11, D a12, D a13, D a14, D a15, D a16)
+{
+ if ( a1 != 1 || a2 != 2 || a3 != 3 || a4 != 4 ||
+ a5 != 5 || a6 != 6 || a7 != 7 || a8 != 8 ||
+ a9 != 9 || a10 != 10 || a11 != 11 || a12 != 12 ||
+ a13 != 13 || a14 != 14 || a15 != 15 || a16 != 16)
+ abort();
+}
+
+int
+main(int argc, char *argv[])
+{
+ void (*code)(void);
+ jit_node_t *jmp, *pass;
+ jit_node_t *jw, *jf, *jd;
+ jit_int32_t s1, s2, s3, s4, s5, s6, s7, s8,
+ s9, s10, s11, s12, s13, s14, s15, s16;
+ jit_node_t *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8,
+ *a9, *a10, *a11, *a12, *a13, *a14, *a15, *a16;
+
+ init_jit(argv[0]);
+ _jit = jit_new_state();
+
+ /* jump to "main" label */
+ jmp = jit_jmpi();
+
+ /* Create jit function that
+ * o Receives 16 word arguments
+ * o Save in the stack any register argument. Also force register
+ * arguments to be clobbered to properly make the test
+ * o Calls a C function that receives 16 word arguments, with
+ * values different from the ones received by this function
+ * o Reload from stack any register argument
+ * o Validated all arguments were not modified in the known
+ * cases it could have been clobbered
+ */
+ jw = jit_label();
+ jit_name("jw");
+ jit_note(__FILE__, __LINE__);
+ jit_prolog();
+ a1 = jit_arg();
+ a2 = jit_arg();
+ a3 = jit_arg();
+ a4 = jit_arg();
+ a5 = jit_arg();
+ a6 = jit_arg();
+ a7 = jit_arg();
+ a8 = jit_arg();
+ a9 = jit_arg();
+ a10 = jit_arg();
+ a11 = jit_arg();
+ a12 = jit_arg();
+ a13 = jit_arg();
+ a14 = jit_arg();
+ a15 = jit_arg();
+ a16 = jit_arg();
+#define SAVE_ARG(N) \
+ do { \
+ if (jit_arg_register_p(a##N)) { \
+ s##N = jit_allocai(sizeof(W)); \
+ jit_getarg(JIT_R0, a##N); \
+ jit_stxi(s##N, JIT_FP, JIT_R0); \
+ jit_putargi(-1, a##N); \
+ } \
+ } while (0)
+ SAVE_ARG(1);
+ SAVE_ARG(2);
+ SAVE_ARG(3);
+ SAVE_ARG(4);
+ SAVE_ARG(5);
+ SAVE_ARG(6);
+ SAVE_ARG(7);
+ SAVE_ARG(8);
+ SAVE_ARG(9);
+ SAVE_ARG(10);
+ SAVE_ARG(11);
+ SAVE_ARG(12);
+ SAVE_ARG(13);
+ SAVE_ARG(14);
+ SAVE_ARG(15);
+ SAVE_ARG(16);
+#undef SAVE_ARG
+ jit_prepare();
+ {
+ jit_pushargi(1);
+ jit_pushargi(2);
+ jit_pushargi(3);
+ jit_pushargi(4);
+ jit_pushargi(5);
+ jit_pushargi(6);
+ jit_pushargi(7);
+ jit_pushargi(8);
+ jit_pushargi(9);
+ jit_pushargi(10);
+ jit_pushargi(11);
+ jit_pushargi(12);
+ jit_pushargi(13);
+ jit_pushargi(14);
+ jit_pushargi(15);
+ jit_pushargi(16);
+ }
+ jit_finishi(cw);
+#define LOAD_ARG(N) \
+ do { \
+ if (jit_arg_register_p(a##N)) { \
+ jit_ldxi(JIT_R0, JIT_FP, s##N); \
+ jit_putargr(JIT_R0, a##N); \
+ } \
+ } while (0)
+ LOAD_ARG(1);
+ LOAD_ARG(2);
+ LOAD_ARG(3);
+ LOAD_ARG(4);
+ LOAD_ARG(5);
+ LOAD_ARG(6);
+ LOAD_ARG(7);
+ LOAD_ARG(8);
+ LOAD_ARG(9);
+ LOAD_ARG(10);
+ LOAD_ARG(11);
+ LOAD_ARG(12);
+ LOAD_ARG(13);
+ LOAD_ARG(14);
+ LOAD_ARG(15);
+ LOAD_ARG(16);
+#undef LOAD_ARG
+ pass = jit_forward();
+#define CHECK_ARG(N) \
+ do { \
+ jit_getarg(JIT_R0, a##N); \
+ jit_patch_at(jit_beqi(JIT_R0, 17 - N), pass); \
+ } while (0)
+ CHECK_ARG(1);
+ CHECK_ARG(2);
+ CHECK_ARG(3);
+ CHECK_ARG(4);
+ CHECK_ARG(5);
+ CHECK_ARG(6);
+ CHECK_ARG(7);
+ CHECK_ARG(8);
+ CHECK_ARG(9);
+ CHECK_ARG(10);
+ CHECK_ARG(11);
+ CHECK_ARG(12);
+ CHECK_ARG(13);
+ CHECK_ARG(14);
+ CHECK_ARG(15);
+ CHECK_ARG(16);
+#undef CHECK_ARG
+ jit_calli(abort);
+ jit_link(pass);
+ jit_ret();
+ jit_epilog();
+
+ /* Create jit function that
+ * o Receives 16 float arguments
+ * o Save in the stack any register argument. Also force register
+ * arguments to be clobbered to properly make the test
+ * o Calls a C function that receives 16 float arguments, with
+ * values different from the ones received by this function
+ * o Reload from stack any register argument
+ * o Validated all arguments were not modified in the known
+ * cases it could have been clobbered
+ */
+ jf = jit_label();
+ jit_name("jf");
+ jit_note(__FILE__, __LINE__);
+ jit_prolog();
+ a1 = jit_arg_f();
+ a2 = jit_arg_f();
+ a3 = jit_arg_f();
+ a4 = jit_arg_f();
+ a5 = jit_arg_f();
+ a6 = jit_arg_f();
+ a7 = jit_arg_f();
+ a8 = jit_arg_f();
+ a9 = jit_arg_f();
+ a10 = jit_arg_f();
+ a11 = jit_arg_f();
+ a12 = jit_arg_f();
+ a13 = jit_arg_f();
+ a14 = jit_arg_f();
+ a15 = jit_arg_f();
+ a16 = jit_arg_f();
+#define SAVE_ARG(N) \
+ do { \
+ if (jit_arg_register_p(a##N)) { \
+ s##N = jit_allocai(sizeof(F)); \
+ jit_getarg_f(JIT_F0, a##N); \
+ jit_stxi_f(s##N, JIT_FP, JIT_F0); \
+ jit_putargi_f(-1, a##N); \
+ } \
+ } while (0)
+ SAVE_ARG(1);
+ SAVE_ARG(2);
+ SAVE_ARG(3);
+ SAVE_ARG(4);
+ SAVE_ARG(5);
+ SAVE_ARG(6);
+ SAVE_ARG(7);
+ SAVE_ARG(8);
+ SAVE_ARG(9);
+ SAVE_ARG(10);
+ SAVE_ARG(11);
+ SAVE_ARG(12);
+ SAVE_ARG(13);
+ SAVE_ARG(14);
+ SAVE_ARG(15);
+ SAVE_ARG(16);
+#undef SAVE_ARG
+ jit_prepare();
+ {
+ jit_pushargi_f(1);
+ jit_pushargi_f(2);
+ jit_pushargi_f(3);
+ jit_pushargi_f(4);
+ jit_pushargi_f(5);
+ jit_pushargi_f(6);
+ jit_pushargi_f(7);
+ jit_pushargi_f(8);
+ jit_pushargi_f(9);
+ jit_pushargi_f(10);
+ jit_pushargi_f(11);
+ jit_pushargi_f(12);
+ jit_pushargi_f(13);
+ jit_pushargi_f(14);
+ jit_pushargi_f(15);
+ jit_pushargi_f(16);
+ }
+ jit_finishi(cf);
+#define LOAD_ARG(N) \
+ do { \
+ if (jit_arg_register_p(a##N)) { \
+ jit_ldxi_f(JIT_F0, JIT_FP, s##N); \
+ jit_putargr_f(JIT_F0, a##N); \
+ } \
+ } while (0)
+ LOAD_ARG(1);
+ LOAD_ARG(2);
+ LOAD_ARG(3);
+ LOAD_ARG(4);
+ LOAD_ARG(5);
+ LOAD_ARG(6);
+ LOAD_ARG(7);
+ LOAD_ARG(8);
+ LOAD_ARG(9);
+ LOAD_ARG(10);
+ LOAD_ARG(11);
+ LOAD_ARG(12);
+ LOAD_ARG(13);
+ LOAD_ARG(14);
+ LOAD_ARG(15);
+ LOAD_ARG(16);
+#undef LOAD_ARG
+ pass = jit_forward();
+#define CHECK_ARG(N) \
+ do { \
+ jit_getarg_f(JIT_F0, a##N); \
+ jit_patch_at(jit_beqi_f(JIT_F0, 17 - N), pass); \
+ } while (0)
+ CHECK_ARG(1);
+ CHECK_ARG(2);
+ CHECK_ARG(3);
+ CHECK_ARG(4);
+ CHECK_ARG(5);
+ CHECK_ARG(6);
+ CHECK_ARG(7);
+ CHECK_ARG(8);
+ CHECK_ARG(9);
+ CHECK_ARG(10);
+ CHECK_ARG(11);
+ CHECK_ARG(12);
+ CHECK_ARG(13);
+ CHECK_ARG(14);
+ CHECK_ARG(15);
+ CHECK_ARG(16);
+#undef CHECK_ARG
+ jit_calli(abort);
+ jit_link(pass);
+ jit_ret();
+ jit_epilog();
+
+ /* Create jit function that
+ * o Receives 16 double arguments
+ * o Save in the stack any register argument. Also force register
+ * arguments to be clobbered to properly make the test
+ * o Calls a C function that receives 16 double arguments, with
+ * values different from the ones received by this function
+ * o Reload from stack any register argument
+ * o Validated all arguments were not modified in the known
+ * cases it could have been clobbered
+ */
+ jd = jit_label();
+ jit_name("jd");
+ jit_note(__FILE__, __LINE__);
+ jit_prolog();
+ a1 = jit_arg_d();
+ a2 = jit_arg_d();
+ a3 = jit_arg_d();
+ a4 = jit_arg_d();
+ a5 = jit_arg_d();
+ a6 = jit_arg_d();
+ a7 = jit_arg_d();
+ a8 = jit_arg_d();
+ a9 = jit_arg_d();
+ a10 = jit_arg_d();
+ a11 = jit_arg_d();
+ a12 = jit_arg_d();
+ a13 = jit_arg_d();
+ a14 = jit_arg_d();
+ a15 = jit_arg_d();
+ a16 = jit_arg_d();
+#define SAVE_ARG(N) \
+ do { \
+ if (jit_arg_register_p(a##N)) { \
+ s##N = jit_allocai(sizeof(D)); \
+ jit_getarg_d(JIT_F0, a##N); \
+ jit_stxi_d(s##N, JIT_FP, JIT_F0); \
+ jit_putargi_d(-1, a##N); \
+ } \
+ } while (0)
+ SAVE_ARG(1);
+ SAVE_ARG(2);
+ SAVE_ARG(3);
+ SAVE_ARG(4);
+ SAVE_ARG(5);
+ SAVE_ARG(6);
+ SAVE_ARG(7);
+ SAVE_ARG(8);
+ SAVE_ARG(9);
+ SAVE_ARG(10);
+ SAVE_ARG(11);
+ SAVE_ARG(12);
+ SAVE_ARG(13);
+ SAVE_ARG(14);
+ SAVE_ARG(15);
+ SAVE_ARG(16);
+#undef SAVE_ARG
+ jit_prepare();
+ {
+ jit_pushargi_d(1);
+ jit_pushargi_d(2);
+ jit_pushargi_d(3);
+ jit_pushargi_d(4);
+ jit_pushargi_d(5);
+ jit_pushargi_d(6);
+ jit_pushargi_d(7);
+ jit_pushargi_d(8);
+ jit_pushargi_d(9);
+ jit_pushargi_d(10);
+ jit_pushargi_d(11);
+ jit_pushargi_d(12);
+ jit_pushargi_d(13);
+ jit_pushargi_d(14);
+ jit_pushargi_d(15);
+ jit_pushargi_d(16);
+ }
+ jit_finishi(cd);
+#define LOAD_ARG(N) \
+ do { \
+ if (jit_arg_register_p(a##N)) { \
+ jit_ldxi_d(JIT_F0, JIT_FP, s##N); \
+ jit_putargr_d(JIT_F0, a##N); \
+ } \
+ } while (0)
+ LOAD_ARG(1);
+ LOAD_ARG(2);
+ LOAD_ARG(3);
+ LOAD_ARG(4);
+ LOAD_ARG(5);
+ LOAD_ARG(6);
+ LOAD_ARG(7);
+ LOAD_ARG(8);
+ LOAD_ARG(9);
+ LOAD_ARG(10);
+ LOAD_ARG(11);
+ LOAD_ARG(12);
+ LOAD_ARG(13);
+ LOAD_ARG(14);
+ LOAD_ARG(15);
+ LOAD_ARG(16);
+#undef LOAD_ARG
+ pass = jit_forward();
+#define CHECK_ARG(N) \
+ do { \
+ jit_getarg_d(JIT_F0, a##N); \
+ jit_patch_at(jit_beqi_d(JIT_F0, 17 - N), pass); \
+ } while (0)
+ CHECK_ARG(1);
+ CHECK_ARG(2);
+ CHECK_ARG(3);
+ CHECK_ARG(4);
+ CHECK_ARG(5);
+ CHECK_ARG(6);
+ CHECK_ARG(7);
+ CHECK_ARG(8);
+ CHECK_ARG(9);
+ CHECK_ARG(10);
+ CHECK_ARG(11);
+ CHECK_ARG(12);
+ CHECK_ARG(13);
+ CHECK_ARG(14);
+ CHECK_ARG(15);
+ CHECK_ARG(16);
+#undef CHECK_ARG
+ jit_calli(abort);
+ jit_link(pass);
+ jit_ret();
+ jit_epilog();
+
+ /* Create a jit function that calls the 3 previous ones.
+ * o First call the function that receives 16 word arguments
+ * o Then call the function that receives 16 float arguments
+ * o Finally call the function that receives 16 double arguments
+ */
+ jit_patch(jmp);
+ jit_name("main");
+ jit_note(__FILE__, __LINE__);
+ jit_prolog();
+ jit_prepare();
+ {
+ jit_pushargi(16);
+ jit_pushargi(15);
+ jit_pushargi(14);
+ jit_pushargi(13);
+ jit_pushargi(12);
+ jit_pushargi(11);
+ jit_pushargi(10);
+ jit_pushargi(9);
+ jit_pushargi(8);
+ jit_pushargi(7);
+ jit_pushargi(6);
+ jit_pushargi(5);
+ jit_pushargi(4);
+ jit_pushargi(3);
+ jit_pushargi(2);
+ jit_pushargi(1);
+ }
+ jit_patch_at(jit_finishi(NULL), jw);
+ jit_prepare();
+ {
+ jit_pushargi_f(16);
+ jit_pushargi_f(15);
+ jit_pushargi_f(14);
+ jit_pushargi_f(13);
+ jit_pushargi_f(12);
+ jit_pushargi_f(11);
+ jit_pushargi_f(10);
+ jit_pushargi_f(9);
+ jit_pushargi_f(8);
+ jit_pushargi_f(7);
+ jit_pushargi_f(6);
+ jit_pushargi_f(5);
+ jit_pushargi_f(4);
+ jit_pushargi_f(3);
+ jit_pushargi_f(2);
+ jit_pushargi_f(1);
+ }
+ jit_patch_at(jit_finishi(NULL), jf);
+ jit_prepare();
+ {
+ jit_pushargi_d(16);
+ jit_pushargi_d(15);
+ jit_pushargi_d(14);
+ jit_pushargi_d(13);
+ jit_pushargi_d(12);
+ jit_pushargi_d(11);
+ jit_pushargi_d(10);
+ jit_pushargi_d(9);
+ jit_pushargi_d(8);
+ jit_pushargi_d(7);
+ jit_pushargi_d(6);
+ jit_pushargi_d(5);
+ jit_pushargi_d(4);
+ jit_pushargi_d(3);
+ jit_pushargi_d(2);
+ jit_pushargi_d(1);
+ }
+ jit_patch_at(jit_finishi(NULL), jd);
+ jit_ret();
+ jit_epilog();
+
+ code = jit_emit();
+ jit_clear_state();
+
+ (*code)();
+
+ jit_destroy_state();
+ finish_jit();
+ return (0);
+}
diff --git a/include/lightning.h b/include/lightning.h
index d4e86bc..0379a2f 100644
--- a/include/lightning.h
+++ b/include/lightning.h
@@ -1017,6 +1017,8 @@ 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_arg_register_p(u) _jit_arg_register_p(_jit,u)
+extern jit_bool_t _jit_arg_register_p(jit_state_t*, jit_node_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_pointer_p(u) _jit_pointer_p(_jit,u)
diff --git a/lib/jit_aarch64.c b/lib/jit_aarch64.c
index 4d670a6..7da15a5 100644
--- a/lib/jit_aarch64.c
+++ b/lib/jit_aarch64.c
@@ -245,6 +245,15 @@ _jit_epilog(jit_state_t *_jit)
_jitc->function = NULL;
}
+jit_bool_t
+_jit_arg_register_p(jit_state_t *_jit, jit_node_t *u)
+{
+ if (u->code == jit_code_arg)
+ return (jit_arg_reg_p(u->u.w));
+ assert(u->code == jit_code_arg_f || u->code == jit_code_arg_d);
+ return (jit_arg_f_reg_p(u->u.w));
+}
+
jit_node_t *
_jit_arg(jit_state_t *_jit)
{
diff --git a/lib/jit_alpha.c b/lib/jit_alpha.c
index 36512f2..e3c78ca 100644
--- a/lib/jit_alpha.c
+++ b/lib/jit_alpha.c
@@ -254,6 +254,15 @@ _jit_epilog(jit_state_t *_jit)
_jitc->function = NULL;
}
+jit_bool_t
+_jit_arg_register_p(jit_state_t *_jit, jit_node_t *u)
+{
+ if (u->code == jit_code_arg)
+ return (jit_arg_reg_p(u->u.w));
+ assert(u->code == jit_code_arg_f || u->code == jit_code_arg_d);
+ return (jit_arg_f_reg_p(u->u.w));
+}
+
jit_node_t *
_jit_arg(jit_state_t *_jit)
{
diff --git a/lib/jit_arm-vfp.c b/lib/jit_arm-vfp.c
index 27e0ccf..0691946 100644
--- a/lib/jit_arm-vfp.c
+++ b/lib/jit_arm-vfp.c
@@ -1251,8 +1251,11 @@ _vfp_movi_f(jit_state_t *_jit, jit_int32_t r0,
jit_float32_t i0)
jit_int32_t code;
u.f = i0;
if (jit_fpr_p(r0)) {
- if ((code = encode_vfp_double(1, 0, u.i, u.i)) != -1 ||
- (code = encode_vfp_double(1, 1, ~u.i, ~u.i)) != -1)
+ /* float arguments are packed, for others,
+ * lightning only address even registers */
+ if (!(r0 & 1) && (r0 - 16) >= 0 &&
+ ((code = encode_vfp_double(1, 0, u.i, u.i)) != -1 ||
+ (code = encode_vfp_double(1, 1, ~u.i, ~u.i)) != -1))
VIMM(code, r0);
else {
reg = jit_get_reg(jit_class_gpr);
diff --git a/lib/jit_arm.c b/lib/jit_arm.c
index 6303f87..e0e680f 100644
--- a/lib/jit_arm.c
+++ b/lib/jit_arm.c
@@ -366,6 +366,23 @@ _jit_epilog(jit_state_t *_jit)
_jitc->function = NULL;
}
+jit_bool_t
+_jit_arg_register_p(jit_state_t *_jit, jit_node_t *u)
+{
+ if (u->code != jit_code_arg) {
+ if (u->code == jit_code_arg_f) {
+ if (jit_cpu.abi)
+ return (jit_arg_f_reg_p(u->u.w));
+ }
+ else {
+ assert(u->code == jit_code_arg_d);
+ if (jit_cpu.abi)
+ return (jit_arg_d_reg_p(u->u.w));
+ }
+ }
+ return (jit_arg_reg_p(u->u.w));
+}
+
jit_node_t *
_jit_arg(jit_state_t *_jit)
{
diff --git a/lib/jit_hppa.c b/lib/jit_hppa.c
index e1e7091..37f3650 100644
--- a/lib/jit_hppa.c
+++ b/lib/jit_hppa.c
@@ -259,6 +259,14 @@ _jit_epilog(jit_state_t *_jit)
_jitc->function = NULL;
}
+jit_bool_t
+_jit_arg_register_p(jit_state_t *_jit, jit_node_t *u)
+{
+ assert(u->code == jit_code_arg ||
+ u->code == jit_code_arg_f || u->code == jit_code_arg_d);
+ return (jit_arg_reg_p(u->u.w));
+}
+
jit_node_t *
_jit_arg(jit_state_t *_jit)
{
diff --git a/lib/jit_ia64.c b/lib/jit_ia64.c
index f024bf2..86fea13 100644
--- a/lib/jit_ia64.c
+++ b/lib/jit_ia64.c
@@ -362,6 +362,14 @@ _jit_epilog(jit_state_t *_jit)
_jitc->function = NULL;
}
+jit_bool_t
+_jit_arg_register_p(jit_state_t *_jit, jit_node_t *u)
+{
+ assert(u->code == jit_code_arg ||
+ u->code == jit_code_arg_f || u->code == jit_code_arg_d);
+ return (jit_arg_reg_p(u->u.w));
+}
+
jit_node_t *
_jit_arg(jit_state_t *_jit)
{
diff --git a/lib/jit_mips.c b/lib/jit_mips.c
index 358084e..60ec598 100644
--- a/lib/jit_mips.c
+++ b/lib/jit_mips.c
@@ -285,6 +285,19 @@ _jit_epilog(jit_state_t *_jit)
_jitc->function = NULL;
}
+jit_bool_t
+_jit_arg_register_p(jit_state_t *_jit, jit_node_t *u)
+{
+ if (u->code == jit_code_arg)
+ return (jit_arg_reg_p(u->u.w));
+ assert(u->code == jit_code_arg_f || u->code == jit_code_arg_d);
+#if NEW_ABI
+ return (jit_arg_reg_p(u->u.w));
+#else
+ return (u->u.w < 8);
+#endif
+}
+
jit_node_t *
_jit_arg(jit_state_t *_jit)
{
diff --git a/lib/jit_ppc.c b/lib/jit_ppc.c
index 3d08112..a5e4a76 100644
--- a/lib/jit_ppc.c
+++ b/lib/jit_ppc.c
@@ -265,6 +265,15 @@ _jit_epilog(jit_state_t *_jit)
_jitc->function = NULL;
}
+jit_bool_t
+_jit_arg_register_p(jit_state_t *_jit, jit_node_t *u)
+{
+ if (u->code == jit_code_arg)
+ return (jit_arg_reg_p(u->u.w));
+ assert(u->code == jit_code_arg_f || u->code == jit_code_arg_d);
+ return (jit_arg_f_reg_p(u->u.w));
+}
+
jit_node_t *
_jit_arg(jit_state_t *_jit)
{
diff --git a/lib/jit_s390.c b/lib/jit_s390.c
index 0cbb8ac..bbeb86b 100644
--- a/lib/jit_s390.c
+++ b/lib/jit_s390.c
@@ -222,6 +222,15 @@ _jit_epilog(jit_state_t *_jit)
_jitc->function = NULL;
}
+jit_bool_t
+_jit_arg_register_p(jit_state_t *_jit, jit_node_t *u)
+{
+ if (u->code == jit_code_arg)
+ return (jit_arg_reg_p(u->u.w));
+ assert(u->code == jit_code_arg_f || u->code == jit_code_arg_d);
+ return (jit_arg_f_reg_p(u->u.w));
+}
+
jit_node_t *
_jit_arg(jit_state_t *_jit)
{
diff --git a/lib/jit_sparc.c b/lib/jit_sparc.c
index 122aaf8..8924cf9 100644
--- a/lib/jit_sparc.c
+++ b/lib/jit_sparc.c
@@ -227,6 +227,15 @@ _jit_epilog(jit_state_t *_jit)
_jitc->function = NULL;
}
+jit_bool_t
+_jit_arg_register_p(jit_state_t *_jit, jit_node_t *u)
+{
+ if (u->code == jit_code_arg || u->code == jit_code_arg_f)
+ return (jit_arg_reg_p(u->u.w));
+ assert(u->code == jit_code_arg_d);
+ return (jit_arg_d_reg_p(u->u.w));
+}
+
jit_node_t *
_jit_arg(jit_state_t *_jit)
{
diff --git a/lib/jit_x86.c b/lib/jit_x86.c
index fa05318..87f6dc2 100644
--- a/lib/jit_x86.c
+++ b/lib/jit_x86.c
@@ -472,6 +472,15 @@ _jit_epilog(jit_state_t *_jit)
_jitc->function = NULL;
}
+jit_bool_t
+_jit_arg_register_p(jit_state_t *_jit, jit_node_t *u)
+{
+ if (u->code == jit_code_arg)
+ return (jit_arg_reg_p(u->u.w));
+ assert(u->code == jit_code_arg_f || u->code == jit_code_arg_d);
+ return (jit_arg_f_reg_p(u->u.w));
+}
+
jit_node_t *
_jit_arg(jit_state_t *_jit)
{
- [Guile-commits] 390/437: Correct make check for systems without gcc., (continued)
- [Guile-commits] 390/437: Correct make check for systems without gcc., Andy Wingo, 2018/07/02
- [Guile-commits] 388/437: sparc: Add initial jit_va_ calls to sparc, Andy Wingo, 2018/07/02
- [Guile-commits] 319/437: Properly handle jit_tramp and function descriptors, Andy Wingo, 2018/07/02
- [Guile-commits] 414/437: Always set t12 to address of called function, Andy Wingo, 2018/07/02
- [Guile-commits] 289/437: Remove the global but not advertised jit_progname variable, Andy Wingo, 2018/07/02
- [Guile-commits] 334/437: ARM: Correct several inconsistencies with ldrd and strd, Andy Wingo, 2018/07/02
- [Guile-commits] 210/437: Correct all ldst test cases., Andy Wingo, 2018/07/02
- [Guile-commits] 252/437: GNU lightning 2.0.1 release, Andy Wingo, 2018/07/02
- [Guile-commits] 327/437: Force creation of the m4 directory on a clean checkout, Andy Wingo, 2018/07/02
- [Guile-commits] 314/437: Add back files missed when reapplying patches, Andy Wingo, 2018/07/02
- [Guile-commits] 354/437: Implement the jit_arg_register_p predicate.,
Andy Wingo <=
- [Guile-commits] 381/437: Remove wrong comment after cut and paste, Andy Wingo, 2018/07/02
- [Guile-commits] 209/437: Correct float division and LX with stop code generation., Andy Wingo, 2018/07/02
- [Guile-commits] 280/437: Implement the new jit_set_code interface., Andy Wingo, 2018/07/02
- [Guile-commits] 284/437: ARM: Do not emit a nop stack adjust instruction., Andy Wingo, 2018/07/02
- [Guile-commits] 345/437: PPC: Implement and use mcrxr emulation by default, Andy Wingo, 2018/07/02
- [Guile-commits] 246/437: Use the logic to workaround float NaN and Inf Hercules bug conditional, Andy Wingo, 2018/07/02
- [Guile-commits] 363/437: Correct typo, Andy Wingo, 2018/07/02
- [Guile-commits] 383/437: ia64: Implement cache flush., Andy Wingo, 2018/07/02
- [Guile-commits] 371/437: Correct read of freed memory, Andy Wingo, 2018/07/02
- [Guile-commits] 342/437: x86: Implement support for the x32 abi, Andy Wingo, 2018/07/02