1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-09 07:00:23 +02:00

detect 32-/64-bit variant of i386 back-end at include time (not configure time)

2008-06-11  Paolo Bonzini  <bonzini@gnu.org>

	* 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.
This commit is contained in:
Paolo Bonzini 2008-06-11 19:00:37 -07:00
parent ef7eb772be
commit 66aef1c644
18 changed files with 133 additions and 41 deletions

View file

@ -1,3 +1,25 @@
2008-06-11 Paolo Bonzini <bonzini@gnu.org>
* 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 <bonzini@gnu.org>
* lightning/i386/core-32.h: Use MOVLir instead of jit_movi_l

View file

@ -1,14 +1,14 @@
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 ;;
case "$target_cpu" in
i?86) cpu=i386 ;;
x86_64) cpu=i386 ;;
sparc*) cpu=sparc ;;
powerpc) cpu=ppc ;;
*) ;;

17
configure vendored
View file

@ -3896,15 +3896,22 @@ 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 ;;
case "$target_cpu" in
i?86) cpu=i386 ;;
x86_64) cpu=i386 ;;
sparc*) cpu=sparc ;;
powerpc) cpu=ppc ;;
*) ;;
@ -3912,7 +3919,7 @@ 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

View file

@ -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])])

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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)

View file

@ -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 */

View file

@ -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_())

View file

@ -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;

View file

@ -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 */

View file

@ -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 */

45
lightning/i386/fp.h Normal file
View file

@ -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 */

View file

@ -195,6 +195,7 @@ for j in $BACKENDS; do
suffix=`echo $j | sed -ne 's,.*:,,p' `
dirs="$dirs lightning/$dir"
for i in $file_base_names; do
test -f "$pkgincludedir/$dir/$i$suffix.h" && \
files="$files lightning/$dir:$pkgincludedir/$dir/$i$suffix.h"
done
done

View file

@ -34,8 +34,8 @@
#include "config.h"
#include "dis-asm.h"
#define LIGHTNING_I386_32 0
#define LIGHTNING_I386_64 1
#define LIGHTNING_I386 0
#define LIGHTNING_X86_64 1
#define LIGHTNING_PPC 2
#define LIGHTNING_SPARC 3