[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 28/437: first merge of x86-64 backend and related config
From: |
Andy Wingo |
Subject: |
[Guile-commits] 28/437: first merge of x86-64 backend and related configury changes |
Date: |
Mon, 2 Jul 2018 05:13:38 -0400 (EDT) |
wingo pushed a commit to branch lightning
in repository guile.
commit 1f7feaffe2ea32d35593a61eecf000688bb8ff21
Author: Paolo Bonzini <address@hidden>
Date: Mon Oct 30 08:48:47 2006 +0000
first merge of x86-64 backend and related configury changes
Patches applied:
* address@hidden/lightning--x86-64--1.3--base-0
tag of address@hidden/lightning--stable--1.2--patch-28
* address@hidden/lightning--x86-64--1.3--patch-1
start merging from mzscheme...
* address@hidden/lightning--x86-64--1.3--patch-2
fix i386
* address@hidden/lightning--x86-64--1.3--patch-3
fix distribution hiccups
* address@hidden/lightning--x86-64--1.3--patch-4
adapt for usage outside distribution.
* address@hidden/lightning--x86-64--1.3--patch-6
fixes for GNU Smalltalk
git-archimport-id: address@hidden/lightning--stable--1.2--patch-30
---
ChangeLog | 51 +++++++-
Makefile.am | 5 +-
Makefile.in | 11 +-
aclocal.m4 | 1 +
build-aux/lightning.m4 | 64 ++++++++++
config.h.in | 10 +-
configure | 159 ++++++++++++++---------
configure.ac | 38 +++---
doc/Makefile.in | 4 +-
doc/lightningize.1 | 2 +-
lightning.m4 | 58 ---------
lightning/Makefile.am | 30 +++--
lightning/Makefile.in | 120 ++++++++----------
lightning/core-common.h | 7 ++
lightning/i386/Makefile.frag | 1 +
lightning/i386/asm-32.h | 61 +++++++++
lightning/i386/asm-64.h | 134 ++++++++++++++++++++
lightning/i386/{asm.h => asm-i386.h} | 16 +--
lightning/i386/core-32.h | 80 ++++++++++++
lightning/i386/core-64.h | 202 ++++++++++++++++++++++++++++++
lightning/i386/{core.h => core-i386.h} | 60 ++++-----
lightning/i386/{fp.h => fp-32.h} | 4 +-
opcode/disass.c => lightning/i386/fp-64.h | 52 +-------
lightning/ppc/funcs.h | 6 +-
lightningize.in | 16 ++-
opcode/Makefile.in | 4 +-
opcode/disass.c | 15 ++-
tests/Makefile.am | 2 +-
tests/Makefile.in | 6 +-
29 files changed, 868 insertions(+), 351 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 32255d8..760acf4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,10 +1,59 @@
2006-10-30 Paolo Bonzini <address@hidden>
+ * lightning/Makefile.am: Use "ln -sf".
+ * lightning/core-common.h: Define jit_negr_l if necessary.
+
+2006-10-30 Paolo Bonzini <address@hidden>
+
* lightning/i386/asm.h (MOVS*, MOVZ*): Use correct _r[124] macros.
+2006-10-29 Paolo Bonzini <address@hidden>
+
+ * configure.ac: Use lightning.m4 macros.
+ * lightning.m4: Refactor to use common code in configure.ac. Move...
+ * build-aux/lightning.m4: ... here.
+ * lightningize.in: Support suffixes.
+ * opcode/disass.in: Adapt to changes in configure.ac.
+
+ * lightning/ppc/funcs.h: Use __APPLE__ instead of _CALL_DARWIN.
+ * lightning/i386/core-32.h: Likewise.
+
+2006-10-26 Paolo Bonzini <address@hidden>
+
+ * configure.ac: Fix compilation test.
+ * lightning/Makefile.am: Symlink LIGHTNING_TARGET_FILES in
+ non-distribution mode.
+ * lightning/i386/Makefile.frag: Use LIGHTNING_TARGET_FILES.
+
+2006-10-26 Paolo Bonzini <address@hidden>
+
+ * configure.ac: Subst cpu.
+ * lightning/core-common.h: Make tests pass on i386.
+ * lightning/i386/asm-32.h: Make tests pass on i386.
+ * lightning/i386/asm-64.h: Make tests pass on i386.
+ * lightning/i386/asm-i386.h: Make tests pass on i386.
+ * lightning/i386/core-32.h: Make tests pass on i386.
+ * lightning/i386/core-64.h: Make tests pass on i386.
+ * lightning/i386/core-i386.h: Make tests pass on i386.
+ * tests/Makefile.am: Include files from cpu directory.
+
+2006-10-26 Paolo Bonzini <address@hidden>
+
+ * lightning/i386/asm.h: Move to asm-i386.h
+ * lightning/i386/asm-32.h: New, from Matthew Flatt.
+ * lightning/i386/asm-64.h: New, from Matthew Flatt.
+ * lightning/i386/core.h: Move to core-i386.h
+ * lightning/i386/core-32.h: New, from Matthew Flatt.
+ * lightning/i386/core-64.h: New, from Matthew Flatt.
+ * lightning/i386/fp.h: Move to fp-32.h
+ * lightning/i386/fp-64.h: New, dummy.
+ * lightning/i386/Makefile.frag: New.
+ * lightning/Makefile.am: Support per-target Makefile fragments.
+ * configure.ac: Support per-target Makefile fragments and CPU suffixes.
+
2006-10-16 Paolo Bonzini <address@hidden>
- * lightning/i386/funcs.h (jit_flush_code): Fix syntax error. :-(
+ * lightning/i386/i386.h (jit_flush_code): Fix syntax error. :-(
2006-07-06 Paolo Bonzini <address@hidden>
Ludovic Courtes <address@hidden>
diff --git a/Makefile.am b/Makefile.am
index 92654b0..8a87da9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,6 @@
# Automake requirements:
-AUTOMAKE_OPTIONS = 1.7 gnu
+AUTOMAKE_OPTIONS = 1.8 gnu
+ACLOCAL_AMFLAGS = -I build-aux
SUBDIRS = . doc lightning opcode tests
EXTRA_DIST = build-aux/texi2dvi build-aux/help2man
@@ -7,5 +8,5 @@ EXTRA_DIST = build-aux/texi2dvi build-aux/help2man
include_HEADERS = lightning.h
aclocaldir = $(datadir)/aclocal
-dist_aclocal_DATA = lightning.m4
+dist_aclocal_DATA = build-aux/lightning.m4
bin_SCRIPTS = lightningize
diff --git a/Makefile.in b/Makefile.in
index bfd05e0..18d2d75 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -43,13 +43,14 @@ DIST_COMMON = README $(am__configure_deps)
$(dist_aclocal_DATA) \
$(include_HEADERS) $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/config.h.in $(srcdir)/lightningize.in \
$(top_srcdir)/configure AUTHORS COPYING COPYING.DOC \
- COPYING.LESSER ChangeLog INSTALL NEWS THANKS \
+ COPYING.LESSER ChangeLog INSTALL NEWS THANKS TODO \
build-aux/config.guess build-aux/config.sub build-aux/depcomp \
build-aux/install-sh build-aux/mdate-sh build-aux/missing \
build-aux/texinfo.tex
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/build-aux/lightning.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
@@ -159,6 +160,7 @@ build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
+cpu = @cpu@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
@@ -194,12 +196,13 @@ target_os = @target_os@
target_vendor = @target_vendor@
# Automake requirements:
-AUTOMAKE_OPTIONS = 1.7 gnu
+AUTOMAKE_OPTIONS = 1.8 gnu
+ACLOCAL_AMFLAGS = -I build-aux
SUBDIRS = . doc lightning opcode tests
EXTRA_DIST = build-aux/texi2dvi build-aux/help2man
include_HEADERS = lightning.h
aclocaldir = $(datadir)/aclocal
-dist_aclocal_DATA = lightning.m4
+dist_aclocal_DATA = build-aux/lightning.m4
bin_SCRIPTS = lightningize
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
diff --git a/aclocal.m4 b/aclocal.m4
index aef181a..f8b5760 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -848,3 +848,4 @@ AC_SUBST([am__tar])
AC_SUBST([am__untar])
]) # _AM_PROG_TAR
+m4_include([build-aux/lightning.m4])
diff --git a/build-aux/lightning.m4 b/build-aux/lightning.m4
new file mode 100644
index 0000000..105aaf2
--- /dev/null
+++ b/build-aux/lightning.m4
@@ -0,0 +1,64 @@
+dnl I'd like this to be edited in -*- Autoconf -*- mode...
+dnl
+# serial 2 LIGHTNING_CONFIGURE_IF_NOT_FOUND
+m4_define([LIGHTNING_BACKENDS], [i386:-32 i386:-64 sparc ppc])
+
+AC_DEFUN([LIGHTNING_CONFIGURE_LINKS], [
+
+suffix=
+case "$host_cpu" in
+ i?86) cpu=i386; suffix=-32 ;;
+ x86_64) cpu=i386; suffix=-64 ;;
+ sparc*) cpu=sparc ;;
+ powerpc) cpu=ppc ;;
+ *) ;;
+esac
+if test -n "$cpu" && test -d "$srcdir/lightning/$cpu"; then
+ $1
+ lightning_frag=`cd $srcdir && pwd`/lightning/$cpu/Makefile.frag
+ test -f $lightning_frag || lightning_frag=/dev/null
+
+ asm_src=lightning/$cpu/asm.h
+ test -f $srcdir/lightning/$cpu/asm$suffix.h &&
asm_src=lightning/$cpu/asm$suffix.h
+ AC_CONFIG_LINKS(lightning/asm.h:$asm_src, [], [asm_src=$asm_src])
+
+ fp_src=lightning/$cpu/fp.h
+ test -f $srcdir/lightning/$cpu/fp$suffix.h &&
fp_src=lightning/$cpu/fp$suffix.h
+ AC_CONFIG_LINKS(lightning/fp.h:$fp_src, [], [fp_src=$fp_src])
+
+ core_src=lightning/$cpu/core.h
+ test -f $srcdir/lightning/$cpu/core$suffix.h &&
core_src=lightning/$cpu/core$suffix.h
+ AC_CONFIG_LINKS(lightning/core.h:$core_src, [], [core_src=$core_src])
+
+ funcs_src=lightning/$cpu/funcs.h
+ test -f $srcdir/lightning/$cpu/funcs$suffix.h &&
funcs_src=lightning/$cpu/funcs$suffix.h
+ AC_CONFIG_LINKS(lightning/funcs.h:$funcs_src, [], [funcs_src=$funcs_src])
+else
+ $2
+ lightning_frag=/dev/null
+fi
+AC_SUBST_FILE(lightning_frag)
+
+])
+
+AC_DEFUN([LIGHTNING_CONFIGURE_IF_NOT_FOUND], [
+AC_REQUIRE([AC_PROG_LN_S])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_CHECK_HEADER(lightning.h)
+AM_CONDITIONAL(LIGHTNING_MAIN, (exit 1))
+AM_CONDITIONAL(HAVE_INSTALLED_LIGHTNING, test "$ac_cv_header_lightning_h" =
yes)
+
+lightning=
+if test "$ac_cv_header_lightning_h" = yes; then
+ lightning=yes
+else
+ LIGHTNING_CONFIGURE_LINKS(lightning=yes, lightning=no)
+fi
+
+AS_IF([test "$lightning" = yes], [
+ AC_DEFINE(HAVE_LIGHTNING, 1, [Define if GNU lightning can be used])
+ $1
+], [$2])
+unset lightning
+
+])dnl
diff --git a/config.h.in b/config.h.in
index d38eddc..69cbd81 100644
--- a/config.h.in
+++ b/config.h.in
@@ -6,14 +6,8 @@
/* Define if the test programs should disassemble the code they produce */
#undef LIGHTNING_DISASSEMBLE
-/* Define if lightning is targeting the x86 architecture */
-#undef LIGHTNING_I386
-
-/* Define if lightning is targeting the PowerPC architecture */
-#undef LIGHTNING_PPC
-
-/* Define if lightning is targeting the SPARC architecture */
-#undef LIGHTNING_SPARC
+/* Used to pick the appropriate disassembler, for debugging */
+#undef LIGHTNING_TARGET
/* Name of package */
#undef PACKAGE
diff --git a/configure b/configure
index 50e30ef..1cbb424 100755
--- a/configure
+++ b/configure
@@ -655,16 +655,17 @@ LN_S
RANLIB
INSTALL_INFO
BACKENDS
+cpu
+LIGHTNING_MAIN_TRUE
+LIGHTNING_MAIN_FALSE
REGRESSION_TESTING_TRUE
REGRESSION_TESTING_FALSE
DISASS_TRUE
DISASS_FALSE
-LIGHTNING_MAIN_TRUE
-LIGHTNING_MAIN_FALSE
LIBDISASS
LIBOBJS
LTLIBOBJS'
-ac_subst_files=''
+ac_subst_files='lightning_frag'
ac_precious_vars='build_alias
host_alias
target_alias
@@ -3995,29 +3996,68 @@ fi
-BACKENDS="i386 sparc ppc"
+BACKENDS="i386:-32 i386:-64 sparc ppc"
-case "$target_cpu" in
- i?86) cpu=i386;
-cat >>confdefs.h <<\_ACEOF
-#define LIGHTNING_I386 1
-_ACEOF
- ;;
- sparc*) cpu=sparc;
-cat >>confdefs.h <<\_ACEOF
-#define LIGHTNING_SPARC 1
-_ACEOF
- ;;
- powerpc) cpu=ppc;
-cat >>confdefs.h <<\_ACEOF
-#define LIGHTNING_PPC 1
+
+
+suffix=
+case "$host_cpu" in
+ i?86) cpu=i386; suffix=-32 ;;
+ x86_64) cpu=i386; suffix=-64 ;;
+ sparc*) cpu=sparc ;;
+ powerpc) cpu=ppc ;;
+ *) ;;
+esac
+if test -n "$cpu" && test -d "$srcdir/lightning/$cpu"; then
+
+cat >>confdefs.h <<_ACEOF
+#define LIGHTNING_TARGET `echo "LIGHTNING_$cpu$suffix" | $as_tr_cpp`
_ACEOF
- ;;
- *) { { echo "$as_me:$LINENO: error: cpu $target_cpu not
supported" >&5
+
+ lightning_frag=`cd $srcdir && pwd`/lightning/$cpu/Makefile.frag
+ test -f $lightning_frag || lightning_frag=/dev/null
+
+ asm_src=lightning/$cpu/asm.h
+ test -f $srcdir/lightning/$cpu/asm$suffix.h &&
asm_src=lightning/$cpu/asm$suffix.h
+ ac_config_links="$ac_config_links lightning/asm.h:$asm_src"
+
+
+ fp_src=lightning/$cpu/fp.h
+ test -f $srcdir/lightning/$cpu/fp$suffix.h &&
fp_src=lightning/$cpu/fp$suffix.h
+ ac_config_links="$ac_config_links lightning/fp.h:$fp_src"
+
+
+ core_src=lightning/$cpu/core.h
+ test -f $srcdir/lightning/$cpu/core$suffix.h &&
core_src=lightning/$cpu/core$suffix.h
+ ac_config_links="$ac_config_links lightning/core.h:$core_src"
+
+
+ funcs_src=lightning/$cpu/funcs.h
+ test -f $srcdir/lightning/$cpu/funcs$suffix.h &&
funcs_src=lightning/$cpu/funcs$suffix.h
+ ac_config_links="$ac_config_links lightning/funcs.h:$funcs_src"
+
+else
+ { { echo "$as_me:$LINENO: error: cpu $target_cpu not supported" >&5
echo "$as_me: error: cpu $target_cpu not supported" >&2;}
- { (exit 1); exit 1; }; } ;;
-esac
+ { (exit 1); exit 1; }; }
+ lightning_frag=/dev/null
+fi
+
+
+
+
+
+
+
+if :; then
+ LIGHTNING_MAIN_TRUE=
+ LIGHTNING_MAIN_FALSE='#'
+else
+ LIGHTNING_MAIN_TRUE='#'
+ LIGHTNING_MAIN_FALSE=
+fi
+
# Check whether --enable-disassembling was given.
@@ -4053,8 +4093,10 @@ cat >>confdefs.h <<\_ACEOF
#define LIGHTNING_DISASSEMBLE 1
_ACEOF
+ LIBDISASS="libdisass.a"
+else
+ LIBDISASS=
fi
-LIBDISASS=""
if test "$enable_disassembling" != no; then
@@ -4065,7 +4107,8 @@ else
DISASS_FALSE=
fi
-test "$enable_disassembling" != no && LIBDISASS="libdisass.a"
+test "$enable_disassembling" != no &&
+
# Check whether --enable-assertions was given.
if test "${enable_assertions+set}" = set; then
@@ -4084,23 +4127,6 @@ _ACEOF
fi
-
-if :; then
- LIGHTNING_MAIN_TRUE=
- LIGHTNING_MAIN_FALSE='#'
-else
- LIGHTNING_MAIN_TRUE='#'
- LIGHTNING_MAIN_FALSE=
-fi
-
-
-
-cpu_dir=lightning/$cpu
-ac_config_links="$ac_config_links lightning/asm.h:$cpu_dir/asm.h
lightning/fp.h:$cpu_dir/fp.h lightning/core.h:$cpu_dir/core.h
lightning/funcs.h:$cpu_dir/funcs.h"
-
-
-
-
ac_config_files="$ac_config_files Makefile doc/Makefile tests/Makefile
opcode/Makefile lightning/Makefile"
ac_config_files="$ac_config_files lightningize"
@@ -4216,6 +4242,13 @@ echo "$as_me: error: conditional \"am__fastdepCC\" was
never defined.
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
+if test -z "${LIGHTNING_MAIN_TRUE}" && test -z "${LIGHTNING_MAIN_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"LIGHTNING_MAIN\" was never
defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"LIGHTNING_MAIN\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
if test -z "${REGRESSION_TESTING_TRUE}" && test -z
"${REGRESSION_TESTING_FALSE}"; then
{ { echo "$as_me:$LINENO: error: conditional \"REGRESSION_TESTING\" was
never defined.
Usually this means the macro was only invoked conditionally." >&5
@@ -4230,13 +4263,6 @@ echo "$as_me: error: conditional \"DISASS\" was never
defined.
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
-if test -z "${LIGHTNING_MAIN_TRUE}" && test -z "${LIGHTNING_MAIN_FALSE}"; then
- { { echo "$as_me:$LINENO: error: conditional \"LIGHTNING_MAIN\" was never
defined.
-Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"LIGHTNING_MAIN\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
- { (exit 1); exit 1; }; }
-fi
: ${CONFIG_STATUS=./config.status}
ac_clean_files_save=$ac_clean_files
@@ -4685,7 +4711,10 @@ cat >>$CONFIG_STATUS <<_ACEOF
# INIT-COMMANDS
#
AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
-cpu_dir=$cpu_dir
+asm_src=$asm_src
+fp_src=$fp_src
+core_src=$core_src
+funcs_src=$funcs_src
_ACEOF
@@ -4697,10 +4726,10 @@ do
case $ac_config_target in
"config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
"depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
- "lightning/asm.h") CONFIG_LINKS="$CONFIG_LINKS
lightning/asm.h:$cpu_dir/asm.h" ;;
- "lightning/fp.h") CONFIG_LINKS="$CONFIG_LINKS
lightning/fp.h:$cpu_dir/fp.h" ;;
- "lightning/core.h") CONFIG_LINKS="$CONFIG_LINKS
lightning/core.h:$cpu_dir/core.h" ;;
- "lightning/funcs.h") CONFIG_LINKS="$CONFIG_LINKS
lightning/funcs.h:$cpu_dir/funcs.h" ;;
+ "lightning/asm.h") CONFIG_LINKS="$CONFIG_LINKS lightning/asm.h:$asm_src" ;;
+ "lightning/fp.h") CONFIG_LINKS="$CONFIG_LINKS lightning/fp.h:$fp_src" ;;
+ "lightning/core.h") CONFIG_LINKS="$CONFIG_LINKS
lightning/core.h:$core_src" ;;
+ "lightning/funcs.h") CONFIG_LINKS="$CONFIG_LINKS
lightning/funcs.h:$funcs_src" ;;
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
"doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
"tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;;
@@ -4765,6 +4794,11 @@ if test -n "$CONFIG_FILES"; then
_ACEOF
+# Create sed commands to just substitute file output variables.
+
+# Remaining file output variables are in a fragment that also has non-file
+# output varibles.
+
ac_delim='%!_!# '
@@ -4861,15 +4895,12 @@ LN_S!$LN_S$ac_delim
RANLIB!$RANLIB$ac_delim
INSTALL_INFO!$INSTALL_INFO$ac_delim
BACKENDS!$BACKENDS$ac_delim
-REGRESSION_TESTING_TRUE!$REGRESSION_TESTING_TRUE$ac_delim
-REGRESSION_TESTING_FALSE!$REGRESSION_TESTING_FALSE$ac_delim
-DISASS_TRUE!$DISASS_TRUE$ac_delim
-DISASS_FALSE!$DISASS_FALSE$ac_delim
+cpu!$cpu$ac_delim
LIGHTNING_MAIN_TRUE!$LIGHTNING_MAIN_TRUE$ac_delim
LIGHTNING_MAIN_FALSE!$LIGHTNING_MAIN_FALSE$ac_delim
_ACEOF
- if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 94; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
@@ -4889,6 +4920,10 @@ fi
cat >>$CONFIG_STATUS <<_ACEOF
cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof
/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+/^[ address@hidden@[ ]*$/{
+r $lightning_frag
+d
+}
_ACEOF
sed '
s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
@@ -4908,12 +4943,16 @@ _ACEOF
ac_delim='%!_!# '
for ac_last_try in false false false false false :; do
cat >conf$$subs.sed <<_ACEOF
+REGRESSION_TESTING_TRUE!$REGRESSION_TESTING_TRUE$ac_delim
+REGRESSION_TESTING_FALSE!$REGRESSION_TESTING_FALSE$ac_delim
+DISASS_TRUE!$DISASS_TRUE$ac_delim
+DISASS_FALSE!$DISASS_FALSE$ac_delim
LIBDISASS!$LIBDISASS$ac_delim
LIBOBJS!$LIBOBJS$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
- if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 3; then
+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 7; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
@@ -5534,7 +5573,7 @@ fi
# A small sanity check
echo "#include <stdio.h>" > confdefs.h # dummy input file
-CPPFLAGS="$CPPFLAGS -I. -I$srcdir"
+CPPFLAGS="$CPPFLAGS -I. -I$srcdir -I$srcdir/lightning/$cpu"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
diff --git a/configure.ac b/configure.ac
index 43f31b3..59f6bbf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,18 +26,16 @@ AC_PROG_MAKE_SET
AC_PATH_PROG(INSTALL_INFO, install-info, :, $PATH:/sbin)
AC_EXEEXT
-BACKENDS="i386 sparc ppc"
+BACKENDS="LIGHTNING_BACKENDS"
AC_SUBST(BACKENDS)
-case "$target_cpu" in
- i?86) cpu=i386; AC_DEFINE(LIGHTNING_I386, 1,
- [Define if lightning is targeting the x86 architecture]) ;;
- sparc*) cpu=sparc; AC_DEFINE(LIGHTNING_SPARC, 1,
- [Define if lightning is targeting the SPARC architecture]) ;;
- powerpc) cpu=ppc; AC_DEFINE(LIGHTNING_PPC, 1,
- [Define if lightning is targeting the PowerPC architecture])
;;
- *) AC_MSG_ERROR([cpu $target_cpu not supported]) ;;
-esac
+LIGHTNING_CONFIGURE_LINKS(
+ [AC_DEFINE_UNQUOTED(LIGHTNING_TARGET, [AS_TR_CPP([LIGHTNING_$cpu$suffix])],
+ [Used to pick the appropriate disassembler, for
debugging])],
+ [AC_MSG_ERROR([cpu $target_cpu not supported])])
+
+AC_SUBST(cpu)
+AM_CONDITIONAL(LIGHTNING_MAIN, :)
dnl ---------------------------- COMMAND LINE ---------------------------------
@@ -56,10 +54,13 @@ fi
if test "$enable_disassembling" != no; then
AC_DEFINE(LIGHTNING_DISASSEMBLE, 1,
[Define if the test programs should disassemble the code they produce])
+ LIBDISASS="libdisass.a"
+else
+ LIBDISASS=
fi
-LIBDISASS=""
AM_CONDITIONAL(DISASS, test "$enable_disassembling" != no)
-test "$enable_disassembling" != no && LIBDISASS="libdisass.a"
+test "$enable_disassembling" != no &&
+AC_SUBST(LIBDISASS)
AC_ARG_ENABLE( assertions,
[ --enable-assertions perform internal consistency checks],
@@ -69,19 +70,8 @@ if test "$enable_assertions" != no; then
AC_DEFINE(_ASM_SAFETY, 1, [Define to enable assertions])
fi
-AM_CONDITIONAL(LIGHTNING_MAIN, :)
-
dnl --------------------------- PRODUCE OUTPUT --------------------------------
-cpu_dir=lightning/$cpu
-AC_CONFIG_LINKS(lightning/asm.h:$cpu_dir/asm.h dnl
- lightning/fp.h:$cpu_dir/fp.h dnl
- lightning/core.h:$cpu_dir/core.h dnl
- lightning/funcs.h:$cpu_dir/funcs.h, [],
- [cpu_dir=$cpu_dir])
-
-AC_SUBST(LIBDISASS)
-
AC_CONFIG_FILES(Makefile doc/Makefile tests/Makefile opcode/Makefile
lightning/Makefile)
AC_CONFIG_FILES(lightningize, chmod +x lightningize)
@@ -90,6 +80,6 @@ AC_OUTPUT
# A small sanity check
echo "#include <stdio.h>" > confdefs.h # dummy input file
-CPPFLAGS="$CPPFLAGS -I. -I$srcdir"
+CPPFLAGS="$CPPFLAGS -I. -I$srcdir -I$srcdir/lightning/$cpu"
AC_TRY_COMPILE([#include "lightning.h"], , ,
AC_MSG_WARN(the compiler that was found could not compile GNU lightning))
diff --git a/doc/Makefile.in b/doc/Makefile.in
index 5d1814a..3223a92 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -41,7 +41,8 @@ DIST_COMMON = $(dist_man1_MANS) $(lightning_TEXINFOS) \
$(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/stamp-vti $(srcdir)/version.texi
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/build-aux/lightning.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
@@ -132,6 +133,7 @@ build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
+cpu = @cpu@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
diff --git a/doc/lightningize.1 b/doc/lightningize.1
index cc6fbb2..bb3c53b 100644
--- a/doc/lightningize.1
+++ b/doc/lightningize.1
@@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.28.
-.TH LIGHTNINGIZE "1" "September 2006" "lightningize 1.2b" "User Commands"
+.TH LIGHTNINGIZE "1" "October 2006" "lightningize 1.2b" "User Commands"
.SH NAME
lightningize \- manual page for lightningize 1.2b
.SH SYNOPSIS
diff --git a/lightning.m4 b/lightning.m4
deleted file mode 100644
index 1c9d01f..0000000
--- a/lightning.m4
+++ /dev/null
@@ -1,58 +0,0 @@
-dnl I'd like this to be edited in -*- Autoconf -*- mode...
-dnl
-# serial 1 LIGHTNING_CONFIGURE_IF_NOT_FOUND
-AC_DEFUN([LIGHTNING_CONFIGURE_IF_NOT_FOUND], [
-AC_REQUIRE([AC_PROG_LN_S])dnl
-AC_REQUIRE([AC_CANONICAL_HOST])dnl
-AC_CHECK_HEADER(lightning.h)
-AM_CONDITIONAL(LIGHTNING_MAIN, (exit 1))
-AM_CONDITIONAL(HAVE_INSTALLED_LIGHTNING, test "$ac_cv_header_lightning_h" =
yes)
-
-lightning=
-if test "$ac_cv_header_lightning_h" = yes; then
- lightning=yes
-else
- case "$host_cpu" in
- i?86) cpu_subdir=i386 ;;
- sparc*) cpu_subdir=sparc ;;
- powerpc) cpu_subdir=ppc ;;
- *) ;;
- esac
- test -n "$cpu_subdir" && test -d "$srcdir/lightning/$cpu_subdir" && \
- lightning=yes
-fi
-
-ifdef([AC_HELP_STRING], [
- dnl autoconf 2.50 style
- if test -n "$cpu_subdir" && test -d "$srcdir/lightning/$cpu_subdir"; then
- AC_CONFIG_LINKS(lightning/asm.h:lightning/$cpu_subdir/asm.h
- lightning/core.h:lightning/$cpu_subdir/core.h
- lightning/fp.h:lightning/$cpu_subdir/fp.h
- lightning/funcs.h:lightning/$cpu_subdir/funcs.h, , [
- cpu_subdir=$cpu_subdir
- ])
- fi
-], [
- dnl autoconf 2.13 style
- AC_OUTPUT_COMMANDS([
- if test -n "$cpu_subdir" && test -d "$srcdir/lightning/$cpu_subdir"; then
- for i in asm fp core funcs; do
- echo linking $srcdir/lightning/$cpu_subdir/$i.h to lightning/$i.h
- (cd lightning && $LN_S -f $srcdir/$cpu_subdir/$i.h $i.h)
- done
- fi
- ], [
- LN_S='$LN_S'
- cpu_subdir=$cpu_subdir
- ])
-])
-
-if test -n "$lightning"; then
- AC_DEFINE(HAVE_LIGHTNING, 1, [Define if GNU lightning can be used])
- lightning=
- ifelse([$1], , :, [$1])
-else
- ifelse([$2], , :, [$2])
-fi
-
-])dnl
diff --git a/lightning/Makefile.am b/lightning/Makefile.am
index 0c39bf9..cce56d7 100644
--- a/lightning/Makefile.am
+++ b/lightning/Makefile.am
@@ -1,18 +1,32 @@
DISTCLEANFILES = asm.h core.h funcs.h fp.h
-LIGHTNING_FILES = funcs-common.h core-common.h fp-common.h \
- asm-common.h \
- i386/asm.h i386/core.h i386/funcs.h i386/fp.h \
- sparc/asm.h sparc/core.h sparc/funcs.h sparc/fp.h \
- ppc/asm.h ppc/core.h ppc/funcs.h ppc/fp.h
+EXTRA_DIST = i386/Makefile.frag \
+ i386/asm-32.h i386/asm-64.h i386/asm-i386.h \
+ i386/core-32.h i386/core-64.h i386/core-i386.h \
+ i386/fp-32.h i386/fp-64.h \
+ i386/funcs.h \
+ sparc/asm.h sparc/core.h sparc/funcs.h sparc/fp.h \
+ ppc/asm.h ppc/core.h ppc/funcs.h ppc/fp.h
+
address@hidden@
+
+LIGHTNING_FILES = funcs-common.h core-common.h fp-common.h asm-common.h \
+ asm.h core.h funcs.h fp.h $(LIGHTNING_TARGET_FILES)
if LIGHTNING_MAIN
+
lightningdir = $(includedir)/lightning
dist_pkgdata_DATA = Makefile.am
-nobase_dist_lightning_HEADERS = $(LIGHTNING_FILES)
-nodist_lightning_HEADERS = asm.h core.h funcs.h fp.h
+dist_lightning_HEADERS = $(LIGHTNING_FILES)
+
else
-dist_noinst_HEADERS = $(LIGHTNING_FILES)
+all-am:
+ @set frob $(LIGHTNING_TARGET_FILES); shift; \
+ for i; \
+ do \
+ echo $(LN_S) -f $(srcdir)/$$i `basename $$i`; \
+ $(LN_S) -f $(srcdir)/$$i `basename $$i`; \
+ done
dist-hook:
cp -p $(srcdir)/lightning.h $(distdir)
diff --git a/lightning/Makefile.in b/lightning/Makefile.in
index 426723e..1338b51 100644
--- a/lightning/Makefile.in
+++ b/lightning/Makefile.in
@@ -39,12 +39,12 @@ build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = lightning
-DIST_COMMON = $(am__dist_noinst_HEADERS_DIST) \
- $(am__dist_pkgdata_DATA_DIST) \
- $(am__nobase_dist_lightning_HEADERS_DIST) \
- $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+DIST_COMMON = $(am__dist_lightning_HEADERS_DIST) \
+ $(am__dist_pkgdata_DATA_DIST) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/build-aux/lightning.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
@@ -60,21 +60,13 @@ am__vpath_adj = case $$p in \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__installdirs = "$(DESTDIR)$(pkgdatadir)" \
- "$(DESTDIR)$(lightningdir)" "$(DESTDIR)$(lightningdir)"
+ "$(DESTDIR)$(lightningdir)"
dist_pkgdataDATA_INSTALL = $(INSTALL_DATA)
DATA = $(dist_pkgdata_DATA)
-am__dist_noinst_HEADERS_DIST = funcs-common.h core-common.h \
- fp-common.h asm-common.h i386/asm.h i386/core.h i386/funcs.h \
- i386/fp.h sparc/asm.h sparc/core.h sparc/funcs.h sparc/fp.h \
- ppc/asm.h ppc/core.h ppc/funcs.h ppc/fp.h
-am__nobase_dist_lightning_HEADERS_DIST = funcs-common.h core-common.h \
- fp-common.h asm-common.h i386/asm.h i386/core.h i386/funcs.h \
- i386/fp.h sparc/asm.h sparc/core.h sparc/funcs.h sparc/fp.h \
- ppc/asm.h ppc/core.h ppc/funcs.h ppc/fp.h
-nobase_dist_lightningHEADERS_INSTALL = $(install_sh_DATA)
-nodist_lightningHEADERS_INSTALL = $(INSTALL_HEADER)
-HEADERS = $(dist_noinst_HEADERS) $(nobase_dist_lightning_HEADERS) \
- $(nodist_lightning_HEADERS)
+am__dist_lightning_HEADERS_DIST = funcs-common.h core-common.h \
+ fp-common.h asm-common.h asm.h core.h funcs.h fp.h
+dist_lightningHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(dist_lightning_HEADERS)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -144,6 +136,7 @@ build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
+cpu = @cpu@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
@@ -178,17 +171,20 @@ target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
DISTCLEANFILES = asm.h core.h funcs.h fp.h
-LIGHTNING_FILES = funcs-common.h core-common.h fp-common.h \
- asm-common.h \
- i386/asm.h i386/core.h i386/funcs.h i386/fp.h \
- sparc/asm.h sparc/core.h sparc/funcs.h sparc/fp.h \
- ppc/asm.h ppc/core.h ppc/funcs.h ppc/fp.h
+EXTRA_DIST = i386/Makefile.frag \
+ i386/asm-32.h i386/asm-64.h i386/asm-i386.h \
+ i386/core-32.h i386/core-64.h i386/core-i386.h \
+ i386/fp-32.h i386/fp-64.h \
+ i386/funcs.h \
+ sparc/asm.h sparc/core.h sparc/funcs.h sparc/fp.h \
+ ppc/asm.h ppc/core.h ppc/funcs.h ppc/fp.h
+
+LIGHTNING_FILES = funcs-common.h core-common.h fp-common.h asm-common.h \
+ asm.h core.h funcs.h fp.h $(LIGHTNING_TARGET_FILES)
@address@hidden = $(includedir)/lightning
@address@hidden = Makefile.am
address@hidden@nobase_dist_lightning_HEADERS = $(LIGHTNING_FILES)
address@hidden@nodist_lightning_HEADERS = asm.h core.h funcs.h fp.h
address@hidden@dist_noinst_HEADERS = $(LIGHTNING_FILES)
address@hidden@dist_lightning_HEADERS = $(LIGHTNING_FILES)
all: all-am
.SUFFIXES:
@@ -239,38 +235,19 @@ uninstall-dist_pkgdataDATA:
echo " rm -f '$(DESTDIR)$(pkgdatadir)/$$f'"; \
rm -f "$(DESTDIR)$(pkgdatadir)/$$f"; \
done
-install-nobase_dist_lightningHEADERS: $(nobase_dist_lightning_HEADERS)
+install-dist_lightningHEADERS: $(dist_lightning_HEADERS)
@$(NORMAL_INSTALL)
test -z "$(lightningdir)" || $(mkdir_p) "$(DESTDIR)$(lightningdir)"
- @$(am__vpath_adj_setup) \
- list='$(nobase_dist_lightning_HEADERS)'; for p in $$list; do \
- if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
- $(am__vpath_adj) \
- echo " $(nobase_dist_lightningHEADERS_INSTALL) '$$d$$p'
'$(DESTDIR)$(lightningdir)/$$f'"; \
- $(nobase_dist_lightningHEADERS_INSTALL) "$$d$$p"
"$(DESTDIR)$(lightningdir)/$$f"; \
- done
-
-uninstall-nobase_dist_lightningHEADERS:
- @$(NORMAL_UNINSTALL)
- @$(am__vpath_adj_setup) \
- list='$(nobase_dist_lightning_HEADERS)'; for p in $$list; do \
- $(am__vpath_adj) \
- echo " rm -f '$(DESTDIR)$(lightningdir)/$$f'"; \
- rm -f "$(DESTDIR)$(lightningdir)/$$f"; \
- done
-install-nodist_lightningHEADERS: $(nodist_lightning_HEADERS)
- @$(NORMAL_INSTALL)
- test -z "$(lightningdir)" || $(mkdir_p) "$(DESTDIR)$(lightningdir)"
- @list='$(nodist_lightning_HEADERS)'; for p in $$list; do \
+ @list='$(dist_lightning_HEADERS)'; for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
f=$(am__strip_dir) \
- echo " $(nodist_lightningHEADERS_INSTALL) '$$d$$p'
'$(DESTDIR)$(lightningdir)/$$f'"; \
- $(nodist_lightningHEADERS_INSTALL) "$$d$$p"
"$(DESTDIR)$(lightningdir)/$$f"; \
+ echo " $(dist_lightningHEADERS_INSTALL) '$$d$$p'
'$(DESTDIR)$(lightningdir)/$$f'"; \
+ $(dist_lightningHEADERS_INSTALL) "$$d$$p"
"$(DESTDIR)$(lightningdir)/$$f"; \
done
-uninstall-nodist_lightningHEADERS:
+uninstall-dist_lightningHEADERS:
@$(NORMAL_UNINSTALL)
- @list='$(nodist_lightning_HEADERS)'; for p in $$list; do \
+ @list='$(dist_lightning_HEADERS)'; for p in $$list; do \
f=$(am__strip_dir) \
echo " rm -f '$(DESTDIR)$(lightningdir)/$$f'"; \
rm -f "$(DESTDIR)$(lightningdir)/$$f"; \
@@ -360,7 +337,7 @@ check-am: all-am
check: check-am
all-am: Makefile $(DATA) $(HEADERS)
installdirs:
- for dir in "$(DESTDIR)$(pkgdatadir)" "$(DESTDIR)$(lightningdir)"
"$(DESTDIR)$(lightningdir)"; do \
+ for dir in "$(DESTDIR)$(pkgdatadir)" "$(DESTDIR)$(lightningdir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
@@ -406,9 +383,8 @@ info: info-am
info-am:
-install-data-am: install-dist_pkgdataDATA \
- install-nobase_dist_lightningHEADERS \
- install-nodist_lightningHEADERS
+install-data-am: install-dist_lightningHEADERS \
+ install-dist_pkgdataDATA
install-exec-am:
@@ -434,25 +410,31 @@ ps: ps-am
ps-am:
-uninstall-am: uninstall-dist_pkgdataDATA uninstall-info-am \
- uninstall-nobase_dist_lightningHEADERS \
- uninstall-nodist_lightningHEADERS
+uninstall-am: uninstall-dist_lightningHEADERS \
+ uninstall-dist_pkgdataDATA uninstall-info-am
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
ctags dist-hook distclean distclean-generic distclean-tags \
distdir dvi dvi-am html html-am info info-am install \
install-am install-data install-data-am \
- install-dist_pkgdataDATA install-exec install-exec-am \
- install-info install-info-am install-man \
- install-nobase_dist_lightningHEADERS \
- install-nodist_lightningHEADERS install-strip installcheck \
- installcheck-am installdirs maintainer-clean \
- maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
- pdf-am ps ps-am tags uninstall uninstall-am \
- uninstall-dist_pkgdataDATA uninstall-info-am \
- uninstall-nobase_dist_lightningHEADERS \
- uninstall-nodist_lightningHEADERS
-
+ install-dist_lightningHEADERS install-dist_pkgdataDATA \
+ install-exec install-exec-am install-info install-info-am \
+ install-man install-strip installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \
+ uninstall uninstall-am uninstall-dist_lightningHEADERS \
+ uninstall-dist_pkgdataDATA uninstall-info-am
+
+
address@hidden@
+
address@hidden@all-am:
address@hidden@ @set frob $(LIGHTNING_TARGET_FILES); shift; \
address@hidden@ for i; \
address@hidden@ do \
address@hidden@ echo $(LN_S) $(srcdir)/$$i `basename $$i`; \
address@hidden@ $(LN_S) $(srcdir)/$$i `basename $$i`; \
address@hidden@ done
@address@hidden:
@LIGHTNING_MAIN_FALSE@ cp -p $(srcdir)/lightning.h $(distdir)
diff --git a/lightning/core-common.h b/lightning/core-common.h
index d2f1e15..5ff4d76 100644
--- a/lightning/core-common.h
+++ b/lightning/core-common.h
@@ -480,8 +480,12 @@ typedef union jit_code {
/* ALU */
#define jit_addi_l(d, rs, is) jit_addi_i((d), (rs), (is))
#define jit_addr_l(d, s1, s2) jit_addr_i((d), (s1), (s2))
+#ifndef jit_addci_l
#define jit_addci_l(d, rs, is) jit_addci_i((d), (rs), (is))
+#endif
+#ifndef jit_addcr_l
#define jit_addcr_l(d, s1, s2) jit_addcr_i((d), (s1), (s2))
+#endif
#define jit_addxi_l(d, rs, is) jit_addxi_i((d), (rs), (is))
#define jit_addxr_l(d, s1, s2) jit_addxr_i((d), (s1), (s2))
#define jit_andi_l(d, rs, is) jit_andi_i((d), (rs), (is))
@@ -496,6 +500,9 @@ typedef union jit_code {
#define jit_modr_l(d, s1, s2) jit_modr_i((d), (s1), (s2))
#define jit_muli_l(d, rs, is) jit_muli_i((d), (rs), (is))
#define jit_mulr_l(d, s1, s2) jit_mulr_i((d), (s1), (s2))
+#ifndef jit_negr_l
+#define jit_negr_l(d, s1) jit_negr_i((d), (s1))
+#endif
#define jit_ori_l(d, rs, is) jit_ori_i((d), (rs), (is))
#define jit_orr_l(d, s1, s2) jit_orr_i((d), (s1), (s2))
#define jit_rshi_l(d, rs, is) jit_rshi_i((d), (rs), (is))
diff --git a/lightning/i386/Makefile.frag b/lightning/i386/Makefile.frag
new file mode 100644
index 0000000..78a56f8
--- /dev/null
+++ b/lightning/i386/Makefile.frag
@@ -0,0 +1 @@
+LIGHTNING_TARGET_FILES += i386/asm-i386.h i386/core-i386.h
diff --git a/lightning/i386/asm-32.h b/lightning/i386/asm-32.h
new file mode 100644
index 0000000..2854a48
--- /dev/null
+++ b/lightning/i386/asm-32.h
@@ -0,0 +1,61 @@
+/******************************** -*- C -*- ****************************
+ *
+ * Run-time assembler for the i386
+ *
+ ***********************************************************************/
+
+
+/***********************************************************************
+ *
+ * Copyright 2006 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 2.1, 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.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GNU lightning; see the file COPYING.LESSER; if not, write to the
+ * Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA.
+ *
+ ***********************************************************************/
+
+
+
+
+#ifndef __lightning_asm_h
+#define __lightning_asm_h
+
+/* OPCODE + i = immediate operand
+ * + r = register operand
+ * + m = memory operand (disp,base,index,scale)
+ * + sr/sm = a star preceding a register or memory
+ */
+
+#include "asm-i386.h"
+
+#ifndef LIGHTNING_DEBUG
+
+#define _r_D( R, D ) (_Mrm(_b00,_rN(R),_b101 )
,_jit_I((long)(D)))
+
+#define CALLm(D,B,I,S) ((_r0P(B) && _r0P(I)) ? _O_D32 (0xe8
,(long)(D) ) : \
+
JITFAIL("illegal mode in direct jump"))
+
+#define JCCim(CC,D,B,I,S) ((_r0P(B) && _r0P(I)) ? _OO_D32
(0x0f80|(CC) ,(long)(D) ) : \
+
JITFAIL("illegal mode in conditional jump"))
+
+#define JMPm(D,B,I,S) ((_r0P(B) && _r0P(I)) ? _O_D32 (0xe9
,(long)(D) ) : \
+
JITFAIL("illegal mode in direct jump"))
+
+#endif
+#endif /* __lightning_asm_h */
+
+
diff --git a/lightning/i386/asm-64.h b/lightning/i386/asm-64.h
new file mode 100644
index 0000000..f44f203
--- /dev/null
+++ b/lightning/i386/asm-64.h
@@ -0,0 +1,134 @@
+/******************************** -*- C -*- ****************************
+ *
+ * Run-time assembler for the x86-64
+ *
+ ***********************************************************************/
+
+
+/***********************************************************************
+ *
+ * Copyright 2006 Matthew Flatt
+ *
+ * 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 2.1, 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.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GNU lightning; see the file COPYING.LESSER; if not, write to the
+ * Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA.
+ *
+ ***********************************************************************/
+
+
+
+
+#ifndef __lightning_asm_h
+#define __lightning_asm_h
+
+#include "asm-i386.h"
+
+/* OPCODE + i = immediate operand
+ * + r = register operand
+ * + m = memory operand (disp,base,index,scale)
+ * + sr/sm = a star preceding a register or memory
+ */
+
+
+#ifndef LIGHTNING_DEBUG
+#define _R12 0x4C
+#define _R13 0x4D
+#define JIT_CALLTMPSTART 0x48
+#define JIT_REXTMP 0x4B
+
+#define _qMrm(Md,R,M) _jit_B((_M(Md)<<6)|(_r((R & 0x7))<<3)|_m((M & 0x7)))
+#define _r_D( R, D ) (_Mrm(_b00,_rN(R),_b100 ),_SIB(0,_b100,_b101)
,_jit_I((long)(D)))
+#define _r_Q( R, D ) (_qMrm(_b00,_rN(R),_b100 ),_SIB(0,_b100,_b101)
,_jit_I((long)(D)))
+
+#define _REX(R,X,B) (
_jit_B(0x48|((R&0x8)>>1)|((X&0x8)>>2)|((B&0x8)>>3)) )
+#define _qO( OP, R,X,B ) ( _REX(R,X,B), _jit_B( OP
) )
+#define _qOr( OP,R ) ( _REX(0,0,R), _jit_B(
(OP)|_r(R&0x7)) )
+#define _qOs( OP, B, R, M ) ( _REX(0, M, R), _Os(OP, B) )
+
+#define ADDQrr(RS, RD) _qO_Mrm (0x01
,_b11,_r8(RS),_r8(RD) )
+#define ADDQir(IM, RD) _qOs_Mrm_sL (0x81
,_b11,_b000 ,_r8(RD) ,IM )
+
+#define ANDQrr(RS, RD) _qO_Mrm (0x21
,_b11,_r8(RS),_r8(RD) )
+#define ANDQir(IM, RD) _qOs_Mrm_sL (0x81
,_b11,_b100 ,_r8(RD) ,IM )
+
+#define CALLm(D,B,I,S) (MOVQir((D), JIT_REXTMP),
CALLQsr(JIT_REXTMP))
+
+#define CALLsr(R) _O_Mrm (0xff ,_b11,_b010,_r4(R)
)
+#define CALLQsr(R) _qO_Mrm (0xff ,_b11,_b010,_r8(R))
+
+#define CMPQrr(RS, RD) _qO_Mrm (0x39
,_b11,_r8(RS),_r8(RD) )
+#define CMPQir(IM, RD) _qO_Mrm_L (0x81
,_b11,_b111 ,_r8(RD) ,IM )
+
+#define JCCim(CC,D,B,I,S) (!_jitl.long_jumps \
+ ? _OO_D32(0x0f80|(CC), (long)(D) ) \
+ : (_O_D8(0x71^(CC), _jit_UL(_jit.x.pc) + 13),
JMPm((long)D, 0, 0, 0)))
+
+#define JMPm(D,B,I,S) (!_jitl.long_jumps \
+ ? _O_D32(0xe9, (long)(D)) \
+ : (MOVQir((D), JIT_REXTMP),
_qO_Mrm(0xff,_b11,_b100,_r8(JIT_REXTMP))))
+
+#define LEAQmr(MD, MB, MI, MS, RD) _qO_r_X (0x8d
,_r8(RD) ,MD,MB,MI,MS )
+#define MOVQmr(MD, MB, MI, MS, RD) _qO_r_X (0x8b
,_r8(RD) ,MD,MB,MI,MS )
+#define MOVQrm(RS, MD, MB, MI, MS) _qO_r_X (0x89
,_r8(RS) ,MD,MB,MI,MS )
+#define MOVQrQm(RS, MD, MB, MI, MS) _qO_r_XB (0x89
,_r8(RS) ,MD,MB,MI,MS )
+#define MOVQir(IM, R) _qOr_Q (0xb8,_r8(R)
,IM )
+
+#define MOVQrr(RS, RD) _qO_Mrm (0x89
,_b11,_r8(RS),_r8(RD) )
+
+#define NEGQr(RD) _qO_Mrm (0xf7
,_b11,_b011 ,_r8(RD) )
+
+#define ORQrr(RS, RD) _qO_Mrm (0x09
,_b11,_r8(RS),_r8(RD) )
+#define ORQir(IM, RD) _qOs_Mrm_sL (0x81
,_b11,_b001 ,_r8(RD) ,IM )
+
+#define POPQr(RD) _qOr (0x58,_r8(RD)
)
+
+#define PUSHQr(R) _qOr (0x50,_r8(R)
)
+#define SALQir SHLQir
+#define SALQim SHLQim
+#define SALQrr SHLQrr
+#define SALQrm SHLQrm
+
+#define SARQir(IM,RD) (((IM)==1) ? _qO_Mrm (0xd1
,_b11,_b111,_r8(RD) ) : \
+ _qO_Mrm_B (0xc1
,_b11,_b111,_r4(RD) ,_u8(IM) ) )
+#define SARQrr(RS,RD) (((RS)==_CL) ? _qO_Mrm (0xd3
,_b11,_b111,_r8(RD) ) : \
+ JITFAIL ("source
register must be CL" ) )
+
+
+#define SHLQir(IM,RD) (((IM)==1) ? _qO_Mrm (0xd1
,_b11,_b100,_r8(RD) ) : \
+ _qO_Mrm_B (0xc1
,_b11,_b100,_r8(RD) ,_u8(IM) ) )
+#define SHLQrr(RS,RD) (((RS)==_CL) ? _qO_Mrm (0xd3
,_b11,_b100,_r8(RD) ) : \
+ JITFAIL ("source
register must be CL" ) )
+
+
+#define SHRQir(IM,RD) (((IM)==1) ? _qO_Mrm (0xd1
,_b11,_b101,_r8(RD) ) : \
+ _qO_Mrm_B (0xc1
,_b11,_b101,_r8(RD) ,_u8(IM) ) )
+#define SHRQrr(RS,RD) (((RS)==_CL) ? _qO_Mrm (0xd3
,_b11,_b101,_r8(RD) ) : \
+ JITFAIL ("source
register must be CL" ) )
+
+
+#define SUBQrr(RS, RD) _qO_Mrm (0x29
,_b11,_r8(RS),_r8(RD) )
+#define SUBQir(IM, RD) _qOs_Mrm_sL (0x81
,_b11,_b101 ,_r8(RD) ,IM )
+
+#define TESTQrr(RS, RD) _qO_Mrm (0x85
,_b11,_r8(RS),_r8(RD) )
+#define TESTQir(IM, RD) _qO_Mrm_L (0xf7
,_b11,_b000 ,_r8(RD) ,IM )
+
+#define XORQrr(RS, RD) _qO_Mrm (0x31
,_b11,_r8(RS),_r8(RD) )
+#define XORQir(IM, RD) _qOs_Mrm_sL (0x81
,_b11,_b110 ,_r8(RD) ,IM )
+
+#endif
+#endif /* __lightning_asm_h */
+
+
diff --git a/lightning/i386/asm.h b/lightning/i386/asm-i386.h
similarity index 98%
rename from lightning/i386/asm.h
rename to lightning/i386/asm-i386.h
index 8a9c581..9bcf4ce 100644
--- a/lightning/i386/asm.h
+++ b/lightning/i386/asm-i386.h
@@ -31,8 +31,8 @@
-#ifndef __lightning_asm_h
-#define __lightning_asm_h
+#ifndef __lightning_asm_i386_h
+#define __lightning_asm_i386_h
/* OPCODE + i = immediate operand
* + r = register operand
@@ -147,7 +147,6 @@ typedef _uc jit_insn;
/* memory subformats - urgh! */
-#define _r_D( R, D ) (_Mrm(_b00,_rN(R),_b101 )
,_jit_L((long)(D)))
#define _r_0B( R, B ) (_Mrm(_b00,_rN(R),_r4(B))
)
#define _r_0BIS(R, B,I,S) (_Mrm(_b00,_rN(R),_b100
),_SIB(_SCL(S),_r4(I),_r4(B)) )
#define _r_1B( R, D,B ) (_Mrm(_b01,_rN(R),_r4(B))
,_jit_B((long)(D)))
@@ -334,9 +333,6 @@ typedef _uc jit_insn;
#define BTSLrm(RS,MD,MB,MI,MS) _OO_r_X (0x0fab
,_r4(RS) ,MD,MB,MI,MS )
-#define CALLm(D,B,I,S) ((_r0P(B) && _r0P(I)) ? _O_D32 (0xe8
,(int)(D) ) : \
-
JITFAIL("illegal mode in direct jump"))
-
#define CALLsr(R) _O_Mrm (0xff ,_b11,_b010,_r4(R)
)
#define CALLsm(D,B,I,S) _O_r_X (0xff ,_b010
,(int)(D),B,I,S )
@@ -482,9 +478,6 @@ typedef _uc jit_insn;
#define JNLESm(D,B,I,S) JCCSim(0xf,D,B,I,S)
#define JGSm(D,B,I,S) JCCSim(0xf,D,B,I,S)
-#define JCCim(CC,D,B,I,S) ((_r0P(B) && _r0P(I)) ? _OO_D32
(0x0f80|(CC) ,(int)(D) ) : \
-
JITFAIL("illegal mode in conditional jump"))
-
#define JOm(D,B,I,S) JCCim(0x0,D,B,I,S)
#define JNOm(D,B,I,S) JCCim(0x1,D,B,I,S)
#define JCm(D,B,I,S) JCCim(0x2,D,B,I,S)
@@ -520,9 +513,6 @@ typedef _uc jit_insn;
#define JMPSm(D,B,I,S) ((_r0P(B) && _r0P(I)) ? _O_D8 (0xeb
,(int)(D) ) : \
JITFAIL("illegal mode in short jump"))
-#define JMPm(D,B,I,S) ((_r0P(B) && _r0P(I)) ? _O_D32 (0xe9
,(int)(D) ) : \
-
JITFAIL("illegal mode in direct jump"))
-
#define JMPsr(R) _O_Mrm (0xff ,_b11,_b100,_r4(R)
)
#define JMPsm(D,B,I,S) _O_r_X (0xff ,_b100
,(int)(D),B,I,S )
@@ -1062,5 +1052,5 @@ typedef _uc jit_insn;
/* Intel Corporation 1997.
*/
#endif
-#endif /* __lightning_asm_h */
+#endif /* __lightning_asm_i386_h */
diff --git a/lightning/i386/core-32.h b/lightning/i386/core-32.h
new file mode 100644
index 0000000..d68f8f6
--- /dev/null
+++ b/lightning/i386/core-32.h
@@ -0,0 +1,80 @@
+/******************************** -*- C -*- ****************************
+ *
+ * Platform-independent layer (i386 version)
+ *
+ ***********************************************************************/
+
+
+/***********************************************************************
+ *
+ * Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+ * Written by Paolo Bonzini.
+ *
+ * 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 2.1, 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.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GNU lightning; see the file COPYING.LESSER; if not, write to the
+ * Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA.
+ *
+ ***********************************************************************/
+
+
+
+#ifndef __lightning_core_h
+#define __lightning_core_h
+
+#include "core-i386.h"
+
+#define JIT_CAN_16 1
+
+struct jit_local_state {
+ int framesize;
+ int argssize;
+};
+
+#define jit_base_prolog() (PUSHLr(_EBP), MOVLrr(_ESP, _EBP), PUSHLr(_EBX),
PUSHLr(_ESI), PUSHLr(_EDI))
+#define jit_prolog(n) (_jitl.framesize = 8, jit_base_prolog())
+
+/* The += allows for stack pollution */
+
+#ifdef __APPLE__
+ /* Stack must stay 16-byte aligned: */
+# define jit_prepare_i(ni) (((ni & 0x3) \
+ ? SUBLir(4 * ((((ni) + 3) & ~(0x3)) - (ni)),
JIT_SP) \
+ : (void)0), \
+ _jitl.argssize += (((ni) + 3) & ~(0x3)))
+#else
+# define jit_prepare_i(ni) (_jitl.argssize += (ni))
+#endif
+
+#define jit_pusharg_i(rs) PUSHLr(rs)
+#define jit_finish(sub) ((void)jit_calli((sub)), ADDLir(sizeof(long) *
_jitl.argssize, JIT_SP), _jitl.argssize = 0)
+#define jit_finishr(reg) (jit_callr((reg)), ADDLir(sizeof(long) *
_jitl.argssize, JIT_SP), _jitl.argssize = 0)
+
+#define jit_arg_c() ((_jitl.framesize += sizeof(int)) -
sizeof(int))
+#define jit_arg_uc() ((_jitl.framesize += sizeof(int)) -
sizeof(int))
+#define jit_arg_s() ((_jitl.framesize += sizeof(int)) -
sizeof(int))
+#define jit_arg_us() ((_jitl.framesize += sizeof(int)) -
sizeof(int))
+#define jit_arg_i() ((_jitl.framesize += sizeof(int)) -
sizeof(int))
+#define jit_arg_ui() ((_jitl.framesize += sizeof(int)) -
sizeof(int))
+#define jit_arg_l() ((_jitl.framesize += sizeof(long)) -
sizeof(long))
+#define jit_arg_ul() ((_jitl.framesize += sizeof(long)) -
sizeof(long))
+#define jit_arg_p() ((_jitl.framesize += sizeof(long)) -
sizeof(long))
+
+#define jit_patch_long_at(jump_pc,v) (*_PSL((jump_pc) - sizeof(long)) =
_jit_SL((jit_insn *)(v) - (jump_pc)))
+#define jit_patch_at(jump_pc,v) jit_patch_long_at(jump_pc, v)
+#define jit_ret() (POPLr(_EDI), POPLr(_ESI), POPLr(_EBX), POPLr(_EBP), RET_())
+
+#endif /* __lightning_core_h */
+
diff --git a/lightning/i386/core-64.h b/lightning/i386/core-64.h
new file mode 100644
index 0000000..7680d18
--- /dev/null
+++ b/lightning/i386/core-64.h
@@ -0,0 +1,202 @@
+/******************************** -*- C -*- ****************************
+ *
+ * Platform-independent layer (i386 version)
+ *
+ ***********************************************************************/
+
+
+/***********************************************************************
+ *
+ * Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+ * Written by Paolo Bonzini.
+ *
+ * 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 2.1, 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.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with GNU lightning; see the file COPYING.LESSER; if not, write to the
+ * Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA.
+ *
+ ***********************************************************************/
+
+
+
+#ifndef __lightning_core_h
+#define __lightning_core_h
+
+#include "core-i386.h"
+
+struct jit_local_state {
+ int long_jumps;
+ int nextarg_geti;
+ int argssize;
+};
+
+/* 3-parameter operation */
+#define jit_qopr_(d, s1, s2, op1d, op2d) \
+ ( (s2 == d) ? op1d : \
+ ( ((s1 == d) ? (void)0 : (void)MOVQrr(s1, d)), op2d ) \
+ )
+
+/* 3-parameter operation, with immediate */
+#define jit_qop_(d, s1, op2d) \
+
+#define jit_bra_qr(s1, s2, op) (CMPQrr(s2, s1), op, _jit.x.pc)
+#define _jit_bra_l(rs, is, op) (CMPQir(is, rs), op, _jit.x.pc)
+
+#define jit_bra_l(rs, is, op) (_s32P((long)(is)) \
+ ? _jit_bra_l(rs, is, op) \
+ : (jit_movi_l(JIT_REXTMP, is),
jit_bra_qr(JIT_REXTMP, rs, op)))
+
+/* When CMP with 0 can be replaced with TEST */
+#define jit_bra_l0(rs, is, op, op0) \
+ ( (is) == 0 ? (TESTQrr(rs, rs), op0, _jit.x.pc) : jit_bra_l(rs, is, op))
+
+/* Used to implement ldc, stc, ... */
+#define JIT_CAN_16 0
+
+#define jit_reduceQ(op, is, rs)
\
+ (_u8P(is) && jit_check8(rs) ? jit_reduce_(op##Bir(is, jit_reg8(rs))) :
\
+ jit_reduce_(op##Qir(is, rs)) )
+
+#define jit_addi_l(d, rs, is) jit_opi_((d), (rs), ADDQir((is), (d)),
LEAQmr((is), (rs), 0, 0, (d)) )
+#define jit_addr_l(d, s1, s2) jit_opo_((d), (s1), (s2), ADDQrr((s2), (d)),
ADDQrr((s1), (d)), LEAQmr(0, (s1), (s2), 1, (d)) )
+#define jit_andi_l(d, rs, is) jit_qop_ ((d), (rs), ANDQir((is), (d))
)
+#define jit_andr_l(d, s1, s2) jit_qopr_((d), (s1), (s2), ANDQrr((s1), (d)),
ANDQrr((s2), (d)) )
+#define jit_orr_l(d, s1, s2) jit_qopr_((d), (s1), (s2), ORQrr((s1), (d)),
ORQrr((s2), (d)) )
+#define jit_subr_l(d, s1, s2) jit_qopr_((d), (s1), (s2), (SUBQrr((s1), (d)),
NEGQr(d)), SUBQrr((s2), (d)) )
+#define jit_xorr_l(d, s1, s2) jit_qopr_((d), (s1), (s2), XORQrr((s1), (d)),
XORQrr((s2), (d)) )
+
+/* These can sometimes use byte or word versions! */
+#define jit_ori_i(d, rs, is) jit_op_ ((d), (rs), jit_reduce(OR, (is),
(d)) )
+#define jit_xori_i(d, rs, is) jit_op_ ((d), (rs), jit_reduce(XOR,
(is), (d)) )
+#define jit_ori_l(d, rs, is) jit_qop_ ((d), (rs), jit_reduceQ(OR,
(is), (d)) )
+#define jit_xori_l(d, rs, is) jit_qop_ ((d), (rs), jit_reduceQ(XOR,
(is), (d)) )
+
+#define jit_lshi_l(d, rs, is) ((is) <= 3 ? LEAQmr(0, 0, (rs), 1 << (is),
(d)) : jit_qop_ ((d), (rs), SHLQir((is), (d)) ))
+#define jit_rshi_l(d, rs, is)
jit_qop_ ((d), (rs), SARQir((is), (d)) )
+#define jit_rshi_ul(d, rs, is)
jit_qop_ ((d), (rs), SHRQir((is), (d)) )
+#define jit_lshr_l(d, r1, r2) jit_replace((r1), (r2), _ECX,
jit_qop_ ((d), (r1), SHLQrr(_CL, (d)) ))
+#define jit_rshr_l(d, r1, r2) jit_replace((r1), (r2), _ECX,
jit_qop_ ((d), (r1), SARQrr(_CL, (d)) ))
+#define jit_rshr_ul(d, r1, r2) jit_replace((r1), (r2), _ECX,
jit_qop_ ((d), (r1), SHRQrr(_CL, (d)) ))
+
+/* Stack */
+#define jit_pushr_l(rs) PUSHQr(rs)
+#define jit_popr_l(rs) POPQr(rs)
+
+#define jit_base_prolog() (PUSHQr(_EBP), MOVQrr(_ESP, _EBP), PUSHQr(_EBX),
PUSHQr(_R12), PUSHQr(_R13))
+#define jit_prolog(n) (_jitl.nextarg_geti = 0, jit_base_prolog())
+
+/* Stack isn't used for arguments: */
+#define jit_prepare_i(ni) (_jitl.argssize = 0)
+
+#define jit_pusharg_i(rs) (_jitl.argssize++, MOVQrr(rs, JIT_CALLTMPSTART
+ _jitl.argssize - 1))
+#define jit_finish(sub) (jit_shift_args(), (void)jit_calli((sub)),
jit_restore_locals())
+#define jit_reg_is_arg(reg) ((reg == _EDI) || (reg ==_ESI) || (reg == _EDX))
+#define jit_finishr(reg) ((jit_reg_is_arg((reg)) ? MOVQrr(reg,
JIT_REXTMP) : (void)0), \
+ jit_shift_args(), \
+ jit_reg_is_arg((reg)) ? CALQsr((JIT_REXTMP))
: jit_callr((reg)), \
+ jit_restore_locals())
+
+/* R12 and R13 are callee-save, instead of EDI and ESI. Can be improved. */
+#define jit_shift_args() \
+ (MOVQrr(_ESI, _R12), MOVQrr(_EDI, _R13), \
+ (_jitl.argssize-- \
+ ? (MOVQrr(JIT_CALLTMPSTART + _jitl.argssize, jit_arg_reg_order[0]), \
+ (_jitl.argssize-- \
+ ? (MOVQrr(JIT_CALLTMPSTART + _jitl.argssize, jit_arg_reg_order[1]), \
+ (_jitl.argssize-- \
+ ? MOVQrr(JIT_CALLTMPSTART, jit_arg_reg_order[2]) \
+ : (void)0)) \
+ : (void)0)) \
+ : (void)0))
+
+#define jit_restore_locals() \
+ (MOVQrr(_R12, _ESI), MOVQrr(_R13, _EDI))
+
+#define jit_retval_l(rd) ((void)jit_movr_l ((rd), _EAX))
+#define jit_arg_i() (_jitl.nextarg_geti++)
+#define jit_arg_l() (_jitl.nextarg_geti++)
+#define jit_arg_p() (_jitl.nextarg_geti++)
+#define jit_arg_reg(p) (jit_arg_reg_order[p])
+static int jit_arg_reg_order[] = { _EDI, _ESI, _EDX, _ECX };
+
+#define jit_negr_l(d, rs) jit_opi_((d), (rs), NEGQr(d), (XORQrr((d),
(d)), SUBQrr((rs), (d))) )
+#define jit_movr_l(d, rs) ((void)((rs) == (d) ? 0 : MOVQrr((rs), (d))))
+#define jit_movi_l(d, is) ((is) \
+ ? (_u32P((long)(is)) \
+ ? MOVLir((is), (d)) \
+ : MOVQir((is), (d))) \
+ : XORLrr ((d), (d)) )
+
+#define jit_bmsr_l(label, s1, s2) (TESTQrr((s1), (s2)),
JNZm(label,0,0,0), _jit.x.pc)
+#define jit_bmcr_l(label, s1, s2) (TESTQrr((s1), (s2)), JZm(label,0,0,0),
_jit.x.pc)
+#define jit_boaddr_l(label, s1, s2) (ADDQrr((s2), (s1)), JOm(label,0,0,0),
_jit.x.pc)
+#define jit_bosubr_l(label, s1, s2) (SUBQrr((s2), (s1)), JOm(label,0,0,0),
_jit.x.pc)
+#define jit_boaddr_ul(label, s1, s2) (ADDQrr((s2), (s1)), JCm(label,0,0,0),
_jit.x.pc)
+#define jit_bosubr_ul(label, s1, s2) (SUBQrr((s2), (s1)), JCm(label,0,0,0),
_jit.x.pc)
+
+#define jit_boaddi_l(label, rs, is) (ADDQir((is), (rs)), JOm(label,0,0,0),
_jit.x.pc)
+#define jit_bosubi_l(label, rs, is) (SUBQir((is), (rs)), JOm(label,0,0,0),
_jit.x.pc)
+#define jit_boaddi_ul(label, rs, is) (ADDQir((is), (rs)), JCm(label,0,0,0),
_jit.x.pc)
+#define jit_bosubi_ul(label, rs, is) (SUBQir((is), (rs)), JCm(label,0,0,0),
_jit.x.pc)
+
+#define jit_patch_long_at(jump_pc,v) (*_PSL((jump_pc) - sizeof(long)) =
_jit_SL((jit_insn *)(v)))
+#define jit_patch_short_at(jump_pc,v) (*_PSI((jump_pc) - sizeof(int)) =
_jit_SI((jit_insn *)(v) - (jump_pc)))
+#define jit_patch_at(jump_pc,v) (_jitl.long_jumps ?
jit_patch_long_at((jump_pc)-3, v) : jit_patch_short_at(jump_pc, v))
+#define jit_ret() (POPQr(_R13), POPQr(_R12), POPQr(_EBX), POPQr(_EBP), RET_())
+
+#define _jit_ldi_l(d, is) MOVQmr((is), 0, 0, 0, (d))
+#define jit_ldr_l(d, rs) MOVQmr(0, (rs), 0, 0, (d))
+#define jit_ldxr_l(d, s1, s2) MOVQmr(0, (s1), (s2), 1, (d))
+#define jit_ldxi_l(d, rs, is) MOVQmr((is), (rs), 0, 0, (d))
+
+#define _jit_sti_l(id, rs) MOVQrm((rs), (id), 0, 0, 0)
+#define jit_str_l(rd, rs) MOVQrm((rs), 0, (rd), 0, 0)
+#define jit_stxr_l(d1, d2, rs) MOVQrm((rs), 0, (d1), (d2), 1)
+#define jit_stxi_l(id, rd, rs) MOVQrm((rs), (id), (rd), 0, 0)
+
+#define jit_ldi_l(d, is) (_u32P((long)(is)) ? _jit_ldi_l(d, is) :
(jit_movi_l(d, is), jit_ldr_l(d, d)))
+#define jit_sti_l(id, rs) (_u32P((long)(id)) ? _jit_sti_l(id, rs) :
(jit_movi_l(JIT_REXTMP, id), MOVQrQm(rs, 0, JIT_REXTMP, 0, 0)))
+
+#define jit_blti_l(label, rs, is) jit_bra_l0((rs), (is), JLm(label,
0,0,0), JSm(label, 0,0,0) )
+#define jit_blei_l(label, rs, is) jit_bra_l ((rs), (is),
JLEm(label,0,0,0) )
+#define jit_bgti_l(label, rs, is) jit_bra_l ((rs), (is), JGm(label,
0,0,0) )
+#define jit_bgei_l(label, rs, is) jit_bra_l0((rs), (is),
JGEm(label,0,0,0), JNSm(label,0,0,0) )
+#define jit_beqi_l(label, rs, is) jit_bra_l0((rs), (is), JEm(label,
0,0,0), JEm(label, 0,0,0) )
+#define jit_bnei_l(label, rs, is) jit_bra_l0((rs), (is),
JNEm(label,0,0,0), JNEm(label,0,0,0) )
+#define jit_blti_ul(label, rs, is) jit_bra_l ((rs), (is), JBm(label,
0,0,0) )
+#define jit_blei_ul(label, rs, is) jit_bra_l0((rs), (is),
JBEm(label,0,0,0), JEm(label, 0,0,0) )
+#define jit_bgti_ul(label, rs, is) jit_bra_l0((rs), (is), JAm(label,
0,0,0), JNEm(label,0,0,0) )
+#define jit_bgei_ul(label, rs, is) jit_bra_l ((rs), (is),
JAEm(label,0,0,0) )
+#define jit_bmsi_l(label, rs, is) jit_bmsi_i(label, rs, is)
+#define jit_bmci_l(label, rs, is) jit_bmci_i(label, rs, is)
+
+#define jit_pushr_l(rs) jit_pushr_i(rs)
+#define jit_popr_l(rs) jit_popr_i(rs)
+
+#define jit_pusharg_l(rs) jit_pusharg_i(rs)
+#define jit_retval_l(rd) ((void)jit_movr_l ((rd), _EAX))
+#define jit_bltr_l(label, s1, s2) jit_bra_qr((s1), (s2), JLm(label,
0,0,0) )
+#define jit_bler_l(label, s1, s2) jit_bra_qr((s1), (s2),
JLEm(label,0,0,0) )
+#define jit_bgtr_l(label, s1, s2) jit_bra_qr((s1), (s2), JGm(label,
0,0,0) )
+#define jit_bger_l(label, s1, s2) jit_bra_qr((s1), (s2),
JGEm(label,0,0,0) )
+#define jit_beqr_l(label, s1, s2) jit_bra_qr((s1), (s2), JEm(label,
0,0,0) )
+#define jit_bner_l(label, s1, s2) jit_bra_qr((s1), (s2),
JNEm(label,0,0,0) )
+#define jit_bltr_ul(label, s1, s2) jit_bra_qr((s1), (s2), JBm(label,
0,0,0) )
+#define jit_bler_ul(label, s1, s2) jit_bra_qr((s1), (s2),
JBEm(label,0,0,0) )
+#define jit_bgtr_ul(label, s1, s2) jit_bra_qr((s1), (s2), JAm(label,
0,0,0) )
+#define jit_bger_ul(label, s1, s2) jit_bra_qr((s1), (s2),
JAEm(label,0,0,0) )
+
+#endif /* __lightning_core_h */
+
diff --git a/lightning/i386/core.h b/lightning/i386/core-i386.h
similarity index 90%
rename from lightning/i386/core.h
rename to lightning/i386/core-i386.h
index 0517db1..2540b84 100644
--- a/lightning/i386/core.h
+++ b/lightning/i386/core-i386.h
@@ -16,23 +16,23 @@
* under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 2.1, or (at your option)
* any later version.
- *
- * GNU lightning is distributed in the hope that it will be useful, but
+ *
+ * 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.
- *
+ *
* You should have received a copy of the GNU Lesser General Public License
* along with GNU lightning; see the file COPYING.LESSER; if not, write to the
- * Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
+ * Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA.
*
***********************************************************************/
-#ifndef __lightning_core_h
-#define __lightning_core_h
+#ifndef __lightning_core_i386_h
+#define __lightning_core_i386_h
#define JIT_FP _EBP
#define JIT_SP _ESP
@@ -43,10 +43,6 @@
#define JIT_R(i) (_EAX + (i))
#define JIT_V(i) ((i) == 0 ? _EBX : _ESI + (i) - 1)
-struct jit_local_state {
- int framesize;
- int argssize;
-};
/* 3-parameter operation */
#define jit_opr_(d, s1, s2, op1d, op2d)
\
@@ -56,7 +52,7 @@ struct jit_local_state {
/* 3-parameter operation, with immediate */
#define jit_op_(d, s1, op2d) \
- ((s1 == d) ? op2d : (MOVLrr(s1, d), op2d)) \
+ ((s1 == d) ? op2d : (MOVLrr(s1, d), op2d))
/* 3-parameter operation, optimizable */
#define jit_opo_(d, s1, s2, op1d, op2d, op12d) \
@@ -110,10 +106,15 @@ struct jit_local_state {
: jit_replace(_EBX, rs, _EAX, MOVBrm(_AL, dd, db, di, ds)))
/* Reduce arguments of XOR/OR/TEST */
+#ifdef JIT_X86_64
+# define JIT_CAN_16 0
+#else
+# define JIT_CAN_16 1
+#endif
#define jit_reduce_(op) op
#define jit_reduce(op, is, rs)
\
(_u8P(is) && jit_check8(rs) ? jit_reduce_(op##Bir(is, jit_reg8(rs))) :
\
- (_u16P(is) ? jit_reduce_(op##Wir(is, jit_reg16(rs))) :
\
+ (_u16P(is) && JIT_CAN_16 ? jit_reduce_(op##Wir(is, jit_reg16(rs))) :
\
jit_reduce_(op##Lir(is, rs)) ))
/* Helper macros for MUL/DIV/IDIV */
@@ -207,6 +208,7 @@ struct jit_local_state {
#define jit_subxi_i(d, rs, is) jit_op_ ((d), (rs), SBBLir((is), (d))
)
#define jit_xorr_i(d, s1, s2) jit_opr_((d), (s1), (s2), XORLrr((s1), (d)),
XORLrr((s2), (d)) )
+
/* These can sometimes use byte or word versions! */
#define jit_ori_i(d, rs, is) jit_op_ ((d), (rs), jit_reduce(OR, (is),
(d)) )
#define jit_xori_i(d, rs, is) jit_op_ ((d), (rs), jit_reduce(XOR,
(is), (d)) )
@@ -260,39 +262,21 @@ struct jit_local_state {
/* Stack */
#define jit_pushr_i(rs) PUSHLr(rs)
#define jit_popr_i(rs) POPLr(rs)
-#define jit_prolog(n) (_jitl.framesize = 8, PUSHLr(_EBP),
MOVLrr(_ESP, _EBP), PUSHLr(_EBX), PUSHLr(_ESI), PUSHLr(_EDI))
-/* The += allows for stack pollution */
-
-#define jit_prepare_i(ni) (_jitl.argssize += (ni))
#define jit_prepare_f(nf) (_jitl.argssize += (nf))
#define jit_prepare_d(nd) (_jitl.argssize += 2 * (nd))
-#define jit_pusharg_i(rs) PUSHLr(rs)
-#define jit_finish(sub) (jit_calli((sub)), ADDLir(4 *
_jitl.argssize, JIT_SP), _jitl.argssize = 0)
-#define jit_finishr(reg) (jit_callr((reg)), ADDLir(4 * _jitl.argssize,
JIT_SP), _jitl.argssize = 0)
-#define jit_retval_i(rd) jit_movr_i ((rd), _EAX)
-
-#define jit_arg_c() ((_jitl.framesize += sizeof(int)) -
sizeof(int))
-#define jit_arg_uc() ((_jitl.framesize += sizeof(int)) -
sizeof(int))
-#define jit_arg_s() ((_jitl.framesize += sizeof(int)) -
sizeof(int))
-#define jit_arg_us() ((_jitl.framesize += sizeof(int)) -
sizeof(int))
-#define jit_arg_i() ((_jitl.framesize += sizeof(int)) -
sizeof(int))
-#define jit_arg_ui() ((_jitl.framesize += sizeof(int)) -
sizeof(int))
-#define jit_arg_l() ((_jitl.framesize += sizeof(long)) -
sizeof(long))
-#define jit_arg_ul() ((_jitl.framesize += sizeof(long)) -
sizeof(long))
-#define jit_arg_p() ((_jitl.framesize += sizeof(long)) -
sizeof(long))
+#define jit_retval_i(rd) ((void)jit_movr_i ((rd), _EAX))
#define jit_arg_f() ((_jitl.framesize += sizeof(float)) -
sizeof(float))
#define jit_arg_d() ((_jitl.framesize += sizeof(double)) -
sizeof(double))
/* Unary */
#define jit_negr_i(d, rs) jit_opi_((d), (rs), NEGLr(d), (XORLrr((d),
(d)), SUBLrr((rs), (d))) )
-#define jit_negr_l(d, rs) jit_opi_((d), (rs), NEGLr(d), (XORLrr((d),
(d)), SUBLrr((rs), (d))) )
-#define jit_movr_i(d, rs) ((rs) == (d) ? 0 : MOVLrr((rs), (d)))
+#define jit_movr_i(d, rs) ((void)((rs) == (d) ? 0 : MOVLrr((rs), (d))))
#define jit_movi_i(d, is) ((is) ? MOVLir((is), (d)) : XORLrr ((d), (d)) )
-#define jit_movi_p(d, is) (MOVLir((is), (d)), _jit.x.pc)
-#define jit_patch_movi(pa,pv) (*_PSL((pa) - 4) = _jit_SL((pv)))
+#define jit_movi_p(d, is) (jit_movi_l(d, ((long)(is))), _jit.x.pc)
+#define jit_patch_movi(pa,pv) (*_PSL((pa) - sizeof(long)) = _jit_SL((pv)))
#define jit_ntoh_ui(d, rs) jit_op_((d), (rs), BSWAPLr(d))
#define jit_ntoh_us(d, rs) jit_op_((d), (rs), RORWir(8, d))
@@ -360,8 +344,6 @@ struct jit_local_state {
#define jit_calli(label) (CALLm( ((unsigned long) (label)), 0, 0,
0), _jit.x.pc)
#define jit_callr(reg) (CALLsr(reg))
#define jit_jmpr(reg) JMPsr(reg)
-#define jit_patch_at(jump_pc,v) (*_PSL((jump_pc) - 4) = _jit_SL((v) -
(jump_pc)))
-#define jit_ret() (POPLr(_EDI), POPLr(_ESI), POPLr(_EBX),
POPLr(_EBP), RET_())
/* Memory */
#define jit_ldi_c(d, is) MOVSBLmr((is), 0, 0, 0, (d))
@@ -404,10 +386,12 @@ struct jit_local_state {
#define jit_stxr_i(d1, d2, rs) MOVLrm((rs), 0, (d1), (d2), 1)
#define jit_stxi_i(id, rd, rs) MOVLrm((rs), (id), (rd), 0, 0)
+
/* Extra */
#define jit_nop() NOP_()
#define _jit_alignment(pc, n) (((pc ^ _MASK(4)) + 1) & _MASK(n))
#define jit_align(n) NOPi(_jit_alignment(_jit_UL(_jit.x.pc),
(n)))
-#endif /* __lightning_core_h */
+#endif /* __lightning_core_i386_h */
+
diff --git a/lightning/i386/fp.h b/lightning/i386/fp-32.h
similarity index 99%
rename from lightning/i386/fp.h
rename to lightning/i386/fp-32.h
index c8e47fe..8e65a87 100644
--- a/lightning/i386/fp.h
+++ b/lightning/i386/fp-32.h
@@ -84,8 +84,8 @@
FST ST3
move FPR3 to FPR1
- FLD ST1
- FST ST4 Stack is rotated, so FPRn becomes STn+1 */
+ FLD ST3
+ FST ST2 Stack is rotated, so FPRn becomes STn+1 */
#define jit_movr_d(rd,s1) \
((s1) == (rd) ? 0 \
diff --git a/opcode/disass.c b/lightning/i386/fp-64.h
similarity index 54%
copy from opcode/disass.c
copy to lightning/i386/fp-64.h
index 8ae9533..b5b2cd3 100644
--- a/opcode/disass.c
+++ b/lightning/i386/fp-64.h
@@ -1,13 +1,13 @@
/******************************** -*- C -*- ****************************
*
- * lightning disassembling support
+ * Run-time assembler & support macros for the i386 math coprocessor
*
***********************************************************************/
/***********************************************************************
*
- * Copyright 2000 Free Software Foundation, Inc.
+ * Copyright 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
* Written by Paolo Bonzini.
*
* This file is part of GNU lightning.
@@ -29,50 +29,10 @@
*
***********************************************************************/
-#include <stdio.h>
-#include <stdlib.h>
-#include "config.h"
-#include "dis-asm.h"
-void disassemble(stream, from, to)
- FILE *stream;
- char *from, *to;
-{
- disassemble_info info;
- bfd_vma pc = (bfd_vma) from;
- bfd_vma end = (bfd_vma) to;
+#ifndef __lightning_fp_h
+#define __lightning_fp_h
- INIT_DISASSEMBLE_INFO(info, stream, fprintf);
- info.buffer = NULL;
- info.buffer_vma = 0;
- info.buffer_length = end;
-
- while (pc < end) {
- fprintf_vma(stream, pc);
- putc('\t', stream);
-#ifdef LIGHTNING_I386
- pc += print_insn_i386(pc, &info);
-#endif
-#ifdef LIGHTNING_PPC
- pc += print_insn_big_powerpc(pc, &info);
-#endif
-#ifdef LIGHTNING_SPARC
- pc += print_insn_sparc(pc, &info);
-#endif
- putc('\n', stream);
- }
-}
-
-/* Panic on failing malloc */
-PTR
-xmalloc(size)
- size_t size;
-{
- PTR ret = malloc(size ? size : 1);
- if (!ret) {
- fprintf(stderr, "Couldn't allocate memory\n");
- exit(1);
- }
- return ret;
-}
+#warning SSE math not yet supported
+#endif /* __lightning_fp_h */
diff --git a/lightning/ppc/funcs.h b/lightning/ppc/funcs.h
index 6f04606..90d84d2 100644
--- a/lightning/ppc/funcs.h
+++ b/lightning/ppc/funcs.h
@@ -34,6 +34,8 @@
#ifndef __lightning_funcs_h
#define __lightning_funcs_h
+#include <string.h>
+
#if !defined(__GNUC__) && !defined(__GNUG__)
#error Go get GNU C, I do not know how to flush the cache
#error with this compiler.
@@ -97,7 +99,7 @@ _jit_epilog(jit_state *jit)
frame_size += 15; /* the stack must be quad-word */
frame_size &= ~15; /* aligned */
-#ifdef _CALL_DARWIN
+#ifdef __APPLE__
LWZrm(0, frame_size + 8, 1); /* lwz r0, x+8(r1) (ret.addr.) */
#else
LWZrm(0, frame_size + 4, 1); /* lwz r0, x+4(r1) (ret.addr.) */
@@ -150,7 +152,7 @@ _jit_prolog(jit_state *jit, int n)
ofs = frame_size - num_saved_regs * 4;
STMWrm(first_saved_reg, ofs, 1); /* stmw rI, ofs(r1)
*/
-#ifdef _CALL_DARWIN
+#ifdef __APPLE__
STWrm(0, frame_size + 8, 1); /* stw r0, x+8(r1) */
#else
STWrm(0, frame_size + 4, 1); /* stw r0, x+4(r1) */
diff --git a/lightningize.in b/lightningize.in
index ef9b07c..ed8491b 100644
--- a/lightningize.in
+++ b/lightningize.in
@@ -33,10 +33,9 @@ address@hidden@
# Directory names.
address@hidden@
address@hidden@
address@hidden@
address@hidden@
-pkgdatadir=${datadir}/lightning
-pkgincludedir=${includedir}/lightning
aclocaldir=${datadir}/aclocal
BACKENDS="@BACKENDS@"
@@ -136,8 +135,13 @@ else
exit 1
fi
+if test "$automake" = yes; then
+ if egrep "^$macro_name" $configure_ac >/dev/null 2>&1; then :
+ else
+ echo "Remember to add \`$macro_name' to \`$configure_ac' and reconfigure
your package."
+ fi
-if test -z "$automake"; then
+else
if egrep "^$macro_name" $configure_ac >/dev/null 2>&1; then :
else
echo "Remember to add \`$macro_name' to \`$configure_ac'."
@@ -186,9 +190,11 @@ for i in $file_base_names; do
files="$files lightning:$pkgincludedir/$i-common.h"
done
for j in $BACKENDS; do
- dirs="$dirs lightning/$j"
+ dir=`expr $j : '\([^:]*\)' `
+ suffix=`expr $j : '.*:\(.*\)' `
+ dirs="$dirs lightning/$dir"
for i in $file_base_names; do
- files="$files lightning/$j:$pkgincludedir/$j/$i.h"
+ files="$files lightning/$j:$pkgincludedir/$j/$i$suffix.h"
done
done
diff --git a/opcode/Makefile.in b/opcode/Makefile.in
index 7d2de36..722a6e3 100644
--- a/opcode/Makefile.in
+++ b/opcode/Makefile.in
@@ -42,7 +42,8 @@ subdir = opcode
DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/build-aux/lightning.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
@@ -136,6 +137,7 @@ build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
+cpu = @cpu@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
diff --git a/opcode/disass.c b/opcode/disass.c
index 8ae9533..1983a7a 100644
--- a/opcode/disass.c
+++ b/opcode/disass.c
@@ -34,6 +34,11 @@
#include "config.h"
#include "dis-asm.h"
+#define LIGHTNING_I386_32 0
+#define LIGHTNING_I386_64 1
+#define LIGHTNING_PPC 2
+#define LIGHTNING_SPARC 3
+
void disassemble(stream, from, to)
FILE *stream;
char *from, *to;
@@ -50,14 +55,14 @@ void disassemble(stream, from, to)
while (pc < end) {
fprintf_vma(stream, pc);
putc('\t', stream);
-#ifdef LIGHTNING_I386
+#if LIGHTNING_TARGET == LIGHTNING_I386_32
pc += print_insn_i386(pc, &info);
-#endif
-#ifdef LIGHTNING_PPC
+#elif LIGHTNING_TARGET == LIGHTNING_PPC
pc += print_insn_big_powerpc(pc, &info);
-#endif
-#ifdef LIGHTNING_SPARC
+#elif LIGHTNING_TARGET == LIGHTNING_SPARC
pc += print_insn_sparc(pc, &info);
+#else
+# error disassembling not yet supported for your architecture
#endif
putc('\n', stream);
}
diff --git a/tests/Makefile.am b/tests/Makefile.am
index a61e896..de39902 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,4 +1,4 @@
-AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir)
+AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir)
-I$(top_srcdir)/lightning/$(cpu)
check_PROGRAMS = fibit incr printf printf2 rpn fib fibdelay add bp testfp
funcfp rpnfp modi ldxi
noinst_DATA = fibit.ok incr.ok printf.ok printf2.ok rpn.ok fib.ok fibdelay.ok
testfp.ok funcfp.ok rpnfp.ok add.ok bp.ok modi.ok ldxi.ok
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 6b3cb3f..dda527d 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -44,7 +44,8 @@ check_PROGRAMS = fibit$(EXEEXT) incr$(EXEEXT) printf$(EXEEXT)
\
subdir = tests
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/build-aux/lightning.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
@@ -189,6 +190,7 @@ build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
+cpu = @cpu@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
@@ -222,7 +224,7 @@ target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
-AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir)
+AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir)
-I$(top_srcdir)/lightning/$(cpu)
noinst_DATA = fibit.ok incr.ok printf.ok printf2.ok rpn.ok fib.ok fibdelay.ok
testfp.ok funcfp.ok rpnfp.ok add.ok bp.ok modi.ok ldxi.ok
EXTRA_DIST = $(noinst_DATA) run-test
@address@hidden = $(top_builddir)/opcode/libdisass.a
- [Guile-commits] 66/437: warning patrol (allocai.c, ppc), (continued)
- [Guile-commits] 66/437: warning patrol (allocai.c, ppc), Andy Wingo, 2018/07/02
- [Guile-commits] 75/437: fix uses of jit_qop_ with 4 parameters, Andy Wingo, 2018/07/02
- [Guile-commits] 61/437: avoid redefinition of _r1, Andy Wingo, 2018/07/02
- [Guile-commits] 73/437: add LEAQmr for x86-64, Andy Wingo, 2018/07/02
- [Guile-commits] 82/437: use MOVLir directly to implement i386 32-bit jit_movi_p, Andy Wingo, 2018/07/02
- [Guile-commits] 72/437: misc. x86-64 bugfixes, Andy Wingo, 2018/07/02
- [Guile-commits] 78/437: avoid CRLF issues on mingw, Andy Wingo, 2018/07/02
- [Guile-commits] 62/437: commit source files for separate using/porting manuals, Andy Wingo, 2018/07/02
- [Guile-commits] 80/437: fix C++ incompatibility in i386 back-end, Andy Wingo, 2018/07/02
- [Guile-commits] 45/437: add floating-point for x86-64, Andy Wingo, 2018/07/02
- [Guile-commits] 28/437: first merge of x86-64 backend and related configury changes,
Andy Wingo <=
- [Guile-commits] 74/437: add long boolean operations for x86-64, Andy Wingo, 2018/07/02
- [Guile-commits] 89/437: fix _rN vs. _rR, Andy Wingo, 2018/07/02
- [Guile-commits] 90/437: fix IMULQir and IMULQirr, Andy Wingo, 2018/07/02
- [Guile-commits] 79/437: fix jit_replace8 for case when one of the operands is _EAX., Andy Wingo, 2018/07/02
- [Guile-commits] 87/437: rewrite x86-64 argument passing to support up to 6 arguments, Andy Wingo, 2018/07/02
- [Guile-commits] 92/437: fix installation bug, Andy Wingo, 2018/07/02
- [Guile-commits] 71/437: add missing x86-64 memory operations, Andy Wingo, 2018/07/02
- [Guile-commits] 84/437: move x86-64 JIT_V1/JIT_V2 in R12/R13, Andy Wingo, 2018/07/02
- [Guile-commits] 83/437: detect 32-/64-bit variant of i386 back-end at include time (not configure time), Andy Wingo, 2018/07/02
- [Guile-commits] 86/437: fix x86-64 jit_movi_l (x, 0) and 16-byte stack alignment in the prolog, Andy Wingo, 2018/07/02