guile-commits
[Top][All Lists]
Advanced

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

[Guile-commits] 83/437: detect 32-/64-bit variant of i386 back-end at in


From: Andy Wingo
Subject: [Guile-commits] 83/437: detect 32-/64-bit variant of i386 back-end at include time (not configure time)
Date: Mon, 2 Jul 2018 05:13:50 -0400 (EDT)

wingo pushed a commit to branch lightning
in repository guile.

commit 66aef1c64412f4be53fb16da7417421ffb8cbb7a
Author: Paolo Bonzini <address@hidden>
Date:   Wed Jun 11 19:00:37 2008 -0700

    detect 32-/64-bit variant of i386 back-end at include time (not configure 
time)
    
    2008-06-11  Paolo Bonzini  <address@hidden>
    
        * build-aux/lightning.m4: Adjust LIGHTNING_BACKENDS, don't
        use suffix support to distinguish i386/x86_64.
        * lightning/i386/Makefile.frag: Use LIGHTNING_TARGET_FILES
        to distribute *-32.h and *-64.h files now.
        * lightning/i386/asm-i386: Moved to...
        * lightning/i386/asm.h: Include the appropriate subtarget file.
        * lightning/i386/core-i386: Moved to...
        * lightning/i386/core.h: Include the appropriate subtarget file.
        * lightning/i386/fp.h: New, include the appropriate subtarget file.
        * lightning/i386/asm-32: Do not include asm-i386.h.
        * lightning/i386/asm-64.h: Likewise.
        * lightning/i386/core-32: Do not include core-i386.h.
        * lightning/i386/core-64.h: Likewise.
        * lightning/Makefile.am: Adjust for renamed files.
    
        * configure.ac: Define LIGHTNING_TARGET here.
        * opcode/disass.c: Change list of valid LIGHTNING_TARGET values.
    
        * lightningize.in: Robustify against missing subtarget files.
---
 ChangeLog                              | 22 +++++++++++++++++
 build-aux/lightning.m4                 | 14 +++++------
 configure                              | 23 +++++++++++------
 configure.ac                           |  9 ++++++-
 doc/lightningize.1                     |  2 +-
 lightning/Makefile.am                  |  6 ++---
 lightning/Makefile.in                  |  6 ++---
 lightning/i386/Makefile.frag           |  3 ++-
 lightning/i386/asm-32.h                |  2 --
 lightning/i386/asm-64.h                |  2 --
 lightning/i386/{asm-i386.h => asm.h}   |  8 ++++++
 lightning/i386/core-32.h               |  4 +--
 lightning/i386/core-64.h               |  2 --
 lightning/i386/{core-i386.h => core.h} |  9 +++++++
 lightning/i386/fp-32.h                 |  6 ++---
 lightning/i386/fp.h                    | 45 ++++++++++++++++++++++++++++++++++
 lightningize.in                        |  3 ++-
 opcode/disass.c                        |  8 +++---
 18 files changed, 133 insertions(+), 41 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a57ee84..d8de0b4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,27 @@
 2008-06-11  Paolo Bonzini  <address@hidden>
 
+       * build-aux/lightning.m4: Adjust LIGHTNING_BACKENDS, don't
+       use suffix support to distinguish i386/x86_64.
+       * lightning/i386/Makefile.frag: Use LIGHTNING_TARGET_FILES
+       to distribute *-32.h and *-64.h files now.
+       * lightning/i386/asm-i386: Moved to...
+       * lightning/i386/asm.h: Include the appropriate subtarget file.
+       * lightning/i386/core-i386: Moved to...
+       * lightning/i386/core.h: Include the appropriate subtarget file.
+       * lightning/i386/fp.h: New, include the appropriate subtarget file.
+       * lightning/i386/asm-32: Do not include asm-i386.h.
+       * lightning/i386/asm-64.h: Likewise.
+       * lightning/i386/core-32: Do not include core-i386.h.
+       * lightning/i386/core-64.h: Likewise.
+       * lightning/Makefile.am: Adjust for renamed files.
+
+       * configure.ac: Define LIGHTNING_TARGET here.
+       * opcode/disass.c: Change list of valid LIGHTNING_TARGET values.
+
+       * lightningize.in: Robustify against missing subtarget files.
+
+2008-06-11  Paolo Bonzini  <address@hidden>
+
        * lightning/i386/core-32.h: Use MOVLir instead of jit_movi_l
        to implement jit_movi_p.
 
diff --git a/build-aux/lightning.m4 b/build-aux/lightning.m4
index b612d7c..395916c 100644
--- a/build-aux/lightning.m4
+++ b/build-aux/lightning.m4
@@ -1,17 +1,17 @@
 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])
+m4_define([LIGHTNING_BACKENDS], [i386 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             ;;
-  *)                           ;;
+case "$target_cpu" in
+  i?86)  cpu=i386      ;;
+  x86_64)  cpu=i386    ;;
+  sparc*)  cpu=sparc   ;;
+  powerpc) cpu=ppc      ;;
+  *)                   ;;
 esac
 if test -n "$cpu" && test -d "$srcdir/lightning/$cpu"; then
   $1
diff --git a/configure b/configure
index 5be8631..79ac87e 100755
--- a/configure
+++ b/configure
@@ -3896,23 +3896,30 @@ fi
 
 
 
-BACKENDS="i386:-32 i386:-64 sparc ppc"
+BACKENDS="i386 i386:-32 i386:-64 sparc ppc"
 
 
+case "$target_cpu" in
+  i?86)    LIGHTNING_TARGET=LIGHTNING_I386     ;;
+  x86_64)  LIGHTNING_TARGET=LIGHTNING_X86_64   ;;
+  sparc*)  LIGHTNING_TARGET=LIGHTNING_SPARC    ;;
+  powerpc) LIGHTNING_TARGET=LIGHTNING_PPC      ;;
+  *)                                           ;;
+esac
 
 
 suffix=
-case "$host_cpu" in
-  i?86)           cpu=i386; suffix=-32 ;;
-  x86_64)  cpu=i386; suffix=-64 ;;
-  sparc*)  cpu=sparc           ;;
-  powerpc) cpu=ppc             ;;
-  *)                           ;;
+case "$target_cpu" in
+  i?86)  cpu=i386      ;;
+  x86_64)  cpu=i386    ;;
+  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`
+#define LIGHTNING_TARGET `echo "$LIGHTNING_TARGET" | $as_tr_cpp`
 _ACEOF
 
   lightning_frag=`cd $srcdir && pwd`/lightning/$cpu/Makefile.frag
diff --git a/configure.ac b/configure.ac
index 583f3ed..65d7601 100644
--- a/configure.ac
+++ b/configure.ac
@@ -29,8 +29,15 @@ AC_EXEEXT
 BACKENDS="LIGHTNING_BACKENDS"
 AC_SUBST(BACKENDS)
 
+case "$target_cpu" in
+  i?86)    LIGHTNING_TARGET=LIGHTNING_I386     ;;
+  x86_64)  LIGHTNING_TARGET=LIGHTNING_X86_64   ;;
+  sparc*)  LIGHTNING_TARGET=LIGHTNING_SPARC    ;;
+  powerpc) LIGHTNING_TARGET=LIGHTNING_PPC      ;;
+  *)                                           ;;
+esac
 LIGHTNING_CONFIGURE_LINKS(
-  [AC_DEFINE_UNQUOTED(LIGHTNING_TARGET, [AS_TR_CPP([LIGHTNING_$cpu$suffix])],
+  [AC_DEFINE_UNQUOTED(LIGHTNING_TARGET, [AS_TR_CPP([$LIGHTNING_TARGET])],
                      [Used to pick the appropriate disassembler, for 
debugging])],
   [AC_MSG_ERROR([cpu $target_cpu not supported])])
 
diff --git a/doc/lightningize.1 b/doc/lightningize.1
index b00f79c..28fef11 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" "June 2007" "lightningize 1.2c" "User Commands"
+.TH LIGHTNINGIZE "1" "June 2008" "lightningize 1.2c" "User Commands"
 .SH NAME
 lightningize \- manual page for lightningize 1.2c
 .SH SYNOPSIS
diff --git a/lightning/Makefile.am b/lightning/Makefile.am
index 5459d60..e133d85 100644
--- a/lightning/Makefile.am
+++ b/lightning/Makefile.am
@@ -1,9 +1,9 @@
 DISTCLEANFILES = asm.h core.h funcs.h 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/asm-32.h i386/asm-64.h i386/asm.h \
+        i386/core-32.h i386/core-64.h i386/core.h \
+        i386/fp-32.h i386/fp-64.h i386/fp.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
diff --git a/lightning/Makefile.in b/lightning/Makefile.in
index 35359d6..4e98eba 100644
--- a/lightning/Makefile.in
+++ b/lightning/Makefile.in
@@ -173,9 +173,9 @@ target_os = @target_os@
 target_vendor = @target_vendor@
 DISTCLEANFILES = asm.h core.h funcs.h 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/asm-32.h i386/asm-64.h i386/asm.h \
+        i386/core-32.h i386/core-64.h i386/core.h \
+        i386/fp-32.h i386/fp-64.h i386/fp.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
diff --git a/lightning/i386/Makefile.frag b/lightning/i386/Makefile.frag
index 78a56f8..59c01a2 100644
--- a/lightning/i386/Makefile.frag
+++ b/lightning/i386/Makefile.frag
@@ -1 +1,2 @@
-LIGHTNING_TARGET_FILES += i386/asm-i386.h i386/core-i386.h
+LIGHTNING_TARGET_FILES += i386/asm-32.h i386/core-32.h \
+        i386/asm-64.h i386/core-64.h
diff --git a/lightning/i386/asm-32.h b/lightning/i386/asm-32.h
index ac1e55b..649ef75 100644
--- a/lightning/i386/asm-32.h
+++ b/lightning/i386/asm-32.h
@@ -43,8 +43,6 @@
  *             + sr/sm         = a star preceding a register or memory
  */
 
-#include "asm-i386.h"
-
 #if defined(_ASM_SAFETY)
 #define _r1(R)          ( ((R) & ~3) == _AL || ((R) & ~3) == _AH ? _rN(R) : 
JITFAIL( "8-bit register required"))
 #endif
diff --git a/lightning/i386/asm-64.h b/lightning/i386/asm-64.h
index c6a8fc6..a92db0d 100644
--- a/lightning/i386/asm-64.h
+++ b/lightning/i386/asm-64.h
@@ -37,8 +37,6 @@
 
 #ifndef LIGHTNING_DEBUG
 
-#include "asm-i386.h"
-
 /*     OPCODE  + i             = immediate operand
  *             + r             = register operand
  *             + m             = memory operand (disp,base,index,scale)
diff --git a/lightning/i386/asm-i386.h b/lightning/i386/asm.h
similarity index 99%
rename from lightning/i386/asm-i386.h
rename to lightning/i386/asm.h
index 62f9ba0..4861511 100644
--- a/lightning/i386/asm-i386.h
+++ b/lightning/i386/asm.h
@@ -1590,6 +1590,14 @@ enum {
 /* [2] "Intel Architecture Software Developer's Manual Volume 2: Instruction 
Set Reference",   */
 /*     Intel Corporation 1997.                                                 
                */
 
+#if LIGHTNING_CROSS \
+       ? LIGHTNING_TARGET == LIGHTNING_X86_64 \
+       : defined (__x86_64__)
+#include "asm-64.h"
+#else
+#include "asm-32.h"
+#endif
+
 #endif
 #endif /* __lightning_asm_i386_h */
 
diff --git a/lightning/i386/core-32.h b/lightning/i386/core-32.h
index 7014315..d93967f 100644
--- a/lightning/i386/core-32.h
+++ b/lightning/i386/core-32.h
@@ -37,8 +37,6 @@
 #define JIT_CAN_16 1
 #define JIT_AP                 _EBP
 
-#include "core-i386.h"
-
 struct jit_local_state {
   int  framesize;
   int  argssize;
@@ -48,7 +46,7 @@ struct jit_local_state {
 
 #define jit_base_prolog() (_jitl.framesize = 20, _jitl.alloca_offset = 0, \
   PUSHLr(_EBX), PUSHLr(_ESI), PUSHLr(_EDI), PUSHLr(_EBP), MOVLrr(_ESP, _EBP))
-#define jit_ret(ofs)                                                     \
+#define jit_base_ret(ofs)                                                \
   (((ofs) < 0 ? LEAVE_() : POPLr(_EBP)),                                 \
    POPLr(_EDI), POPLr(_ESI), POPLr(_EBX), RET_())
 
diff --git a/lightning/i386/core-64.h b/lightning/i386/core-64.h
index 0c8808c..d2ab96a 100644
--- a/lightning/i386/core-64.h
+++ b/lightning/i386/core-64.h
@@ -39,8 +39,6 @@
 #define JIT_CALLTMPSTART 0x48
 #define JIT_REXTMP       0x4B
 
-#include "core-i386.h"
-
 struct jit_local_state {
   int   long_jumps;
   int   nextarg_getfp;
diff --git a/lightning/i386/core-i386.h b/lightning/i386/core.h
similarity index 99%
rename from lightning/i386/core-i386.h
rename to lightning/i386/core.h
index b57f9a5..3ed6730 100644
--- a/lightning/i386/core-i386.h
+++ b/lightning/i386/core.h
@@ -350,5 +350,14 @@
 #define _jit_alignment(pc, n)          (((pc ^ _MASK(4)) + 1) & _MASK(n))
 #define jit_align(n)                   NOPi(_jit_alignment(_jit_UL(_jit.x.pc), 
(n)))
 
+
+#if LIGHTNING_CROSS \
+       ? LIGHTNING_TARGET == LIGHTNING_X86_64 \
+       : defined (__x86_64__)
+#include "core-64.h"
+#else
+#include "core-32.h"
+#endif
+
 #endif /* __lightning_core_i386_h */
 
diff --git a/lightning/i386/fp-32.h b/lightning/i386/fp-32.h
index b6cd9fd..ff59631 100644
--- a/lightning/i386/fp-32.h
+++ b/lightning/i386/fp-32.h
@@ -30,8 +30,8 @@
  ***********************************************************************/
 
 
-#ifndef __lightning_asm_fp_h
-#define __lightning_asm_fp_h
+#ifndef __lightning_fp_h
+#define __lightning_fp_h
 
 /* We really must map the x87 stack onto a flat register file.  In practice,
    we can provide something sensible and make it work on the x86 using the
@@ -353,4 +353,4 @@ union jit_double_imm {
 #define jit_arg_f()             ((_jitl.framesize += sizeof(float)) - 
sizeof(float))
 #define jit_arg_d()             ((_jitl.framesize += sizeof(double)) - 
sizeof(double))
 
-#endif /* __lightning_asm_h */
+#endif /* __lightning_fp_h */
diff --git a/lightning/i386/fp.h b/lightning/i386/fp.h
new file mode 100644
index 0000000..f0b75f5
--- /dev/null
+++ b/lightning/i386/fp.h
@@ -0,0 +1,45 @@
+/******************************** -*- C -*- ****************************
+ *
+ *     Floating-point support (i386)
+ *
+ ***********************************************************************/
+
+
+/***********************************************************************
+ *
+ * Copyright 2008 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 3, or (at your option)
+ * any later version.
+ * 
+ * GNU lightning is distributed in the hope that it will be useful, but 
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+ * License for more details.
+ * 
+ * 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.
+ *
+ ***********************************************************************/
+
+
+
+#ifndef __lightning_fp_i386_h
+#define __lightning_fp_i386_h
+
+#if LIGHTNING_CROSS \
+       ? LIGHTNING_TARGET == LIGHTNING_X86_64 \
+       : defined (__x86_64__)
+#include "fp-64.h"
+#else
+#include "fp-32.h"
+#endif
+
+#endif /* __lightning_fp_i386_h */
diff --git a/lightningize.in b/lightningize.in
index 8abff21..9c87760 100644
--- a/lightningize.in
+++ b/lightningize.in
@@ -195,7 +195,8 @@ for j in $BACKENDS; do
   suffix=`echo $j | sed -ne 's,.*:,,p' `
   dirs="$dirs lightning/$dir"
   for i in $file_base_names; do
-    files="$files lightning/$dir:$pkgincludedir/$dir/$i$suffix.h"
+    test -f "$pkgincludedir/$dir/$i$suffix.h" && \
+      files="$files lightning/$dir:$pkgincludedir/$dir/$i$suffix.h"
   done
 done
 
diff --git a/opcode/disass.c b/opcode/disass.c
index 8e3b962..c2a7e25 100644
--- a/opcode/disass.c
+++ b/opcode/disass.c
@@ -34,10 +34,10 @@
 #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
+#define LIGHTNING_I386         0
+#define LIGHTNING_X86_64       1
+#define LIGHTNING_PPC          2
+#define LIGHTNING_SPARC                3
 
 void disassemble(stream, from, to)
      FILE *stream;



reply via email to

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