mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-09 15:10:29 +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:
parent
ef7eb772be
commit
66aef1c644
18 changed files with 133 additions and 41 deletions
22
ChangeLog
22
ChangeLog
|
@ -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>
|
2008-06-11 Paolo Bonzini <bonzini@gnu.org>
|
||||||
|
|
||||||
* lightning/i386/core-32.h: Use MOVLir instead of jit_movi_l
|
* lightning/i386/core-32.h: Use MOVLir instead of jit_movi_l
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
dnl I'd like this to be edited in -*- Autoconf -*- mode...
|
dnl I'd like this to be edited in -*- Autoconf -*- mode...
|
||||||
dnl
|
dnl
|
||||||
# serial 2 LIGHTNING_CONFIGURE_IF_NOT_FOUND
|
# 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], [
|
AC_DEFUN([LIGHTNING_CONFIGURE_LINKS], [
|
||||||
|
|
||||||
suffix=
|
suffix=
|
||||||
case "$host_cpu" in
|
case "$target_cpu" in
|
||||||
i?86) cpu=i386; suffix=-32 ;;
|
i?86) cpu=i386 ;;
|
||||||
x86_64) cpu=i386; suffix=-64 ;;
|
x86_64) cpu=i386 ;;
|
||||||
sparc*) cpu=sparc ;;
|
sparc*) cpu=sparc ;;
|
||||||
powerpc) cpu=ppc ;;
|
powerpc) cpu=ppc ;;
|
||||||
*) ;;
|
*) ;;
|
||||||
esac
|
esac
|
||||||
if test -n "$cpu" && test -d "$srcdir/lightning/$cpu"; then
|
if test -n "$cpu" && test -d "$srcdir/lightning/$cpu"; then
|
||||||
$1
|
$1
|
||||||
|
|
23
configure
vendored
23
configure
vendored
|
@ -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=
|
suffix=
|
||||||
case "$host_cpu" in
|
case "$target_cpu" in
|
||||||
i?86) cpu=i386; suffix=-32 ;;
|
i?86) cpu=i386 ;;
|
||||||
x86_64) cpu=i386; suffix=-64 ;;
|
x86_64) cpu=i386 ;;
|
||||||
sparc*) cpu=sparc ;;
|
sparc*) cpu=sparc ;;
|
||||||
powerpc) cpu=ppc ;;
|
powerpc) cpu=ppc ;;
|
||||||
*) ;;
|
*) ;;
|
||||||
esac
|
esac
|
||||||
if test -n "$cpu" && test -d "$srcdir/lightning/$cpu"; then
|
if test -n "$cpu" && test -d "$srcdir/lightning/$cpu"; then
|
||||||
|
|
||||||
cat >>confdefs.h <<_ACEOF
|
cat >>confdefs.h <<_ACEOF
|
||||||
#define LIGHTNING_TARGET `echo "LIGHTNING_$cpu$suffix" | $as_tr_cpp`
|
#define LIGHTNING_TARGET `echo "$LIGHTNING_TARGET" | $as_tr_cpp`
|
||||||
_ACEOF
|
_ACEOF
|
||||||
|
|
||||||
lightning_frag=`cd $srcdir && pwd`/lightning/$cpu/Makefile.frag
|
lightning_frag=`cd $srcdir && pwd`/lightning/$cpu/Makefile.frag
|
||||||
|
|
|
@ -29,8 +29,15 @@ AC_EXEEXT
|
||||||
BACKENDS="LIGHTNING_BACKENDS"
|
BACKENDS="LIGHTNING_BACKENDS"
|
||||||
AC_SUBST(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(
|
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])],
|
[Used to pick the appropriate disassembler, for debugging])],
|
||||||
[AC_MSG_ERROR([cpu $target_cpu not supported])])
|
[AC_MSG_ERROR([cpu $target_cpu not supported])])
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.28.
|
.\" 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
|
.SH NAME
|
||||||
lightningize \- manual page for lightningize 1.2c
|
lightningize \- manual page for lightningize 1.2c
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
DISTCLEANFILES = asm.h core.h funcs.h fp.h
|
DISTCLEANFILES = asm.h core.h funcs.h fp.h
|
||||||
|
|
||||||
EXTRA_DIST = i386/Makefile.frag \
|
EXTRA_DIST = i386/Makefile.frag \
|
||||||
i386/asm-32.h i386/asm-64.h i386/asm-i386.h \
|
i386/asm-32.h i386/asm-64.h i386/asm.h \
|
||||||
i386/core-32.h i386/core-64.h i386/core-i386.h \
|
i386/core-32.h i386/core-64.h i386/core.h \
|
||||||
i386/fp-32.h i386/fp-64.h \
|
i386/fp-32.h i386/fp-64.h i386/fp.h \
|
||||||
i386/funcs.h \
|
i386/funcs.h \
|
||||||
sparc/asm.h sparc/core.h sparc/funcs.h sparc/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
|
ppc/asm.h ppc/core.h ppc/funcs.h ppc/fp.h
|
||||||
|
|
|
@ -173,9 +173,9 @@ target_os = @target_os@
|
||||||
target_vendor = @target_vendor@
|
target_vendor = @target_vendor@
|
||||||
DISTCLEANFILES = asm.h core.h funcs.h fp.h
|
DISTCLEANFILES = asm.h core.h funcs.h fp.h
|
||||||
EXTRA_DIST = i386/Makefile.frag \
|
EXTRA_DIST = i386/Makefile.frag \
|
||||||
i386/asm-32.h i386/asm-64.h i386/asm-i386.h \
|
i386/asm-32.h i386/asm-64.h i386/asm.h \
|
||||||
i386/core-32.h i386/core-64.h i386/core-i386.h \
|
i386/core-32.h i386/core-64.h i386/core.h \
|
||||||
i386/fp-32.h i386/fp-64.h \
|
i386/fp-32.h i386/fp-64.h i386/fp.h \
|
||||||
i386/funcs.h \
|
i386/funcs.h \
|
||||||
sparc/asm.h sparc/core.h sparc/funcs.h sparc/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
|
ppc/asm.h ppc/core.h ppc/funcs.h ppc/fp.h
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -43,8 +43,6 @@
|
||||||
* + sr/sm = a star preceding a register or memory
|
* + sr/sm = a star preceding a register or memory
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "asm-i386.h"
|
|
||||||
|
|
||||||
#if defined(_ASM_SAFETY)
|
#if defined(_ASM_SAFETY)
|
||||||
#define _r1(R) ( ((R) & ~3) == _AL || ((R) & ~3) == _AH ? _rN(R) : JITFAIL( "8-bit register required"))
|
#define _r1(R) ( ((R) & ~3) == _AL || ((R) & ~3) == _AH ? _rN(R) : JITFAIL( "8-bit register required"))
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -37,8 +37,6 @@
|
||||||
|
|
||||||
#ifndef LIGHTNING_DEBUG
|
#ifndef LIGHTNING_DEBUG
|
||||||
|
|
||||||
#include "asm-i386.h"
|
|
||||||
|
|
||||||
/* OPCODE + i = immediate operand
|
/* OPCODE + i = immediate operand
|
||||||
* + r = register operand
|
* + r = register operand
|
||||||
* + m = memory operand (disp,base,index,scale)
|
* + m = memory operand (disp,base,index,scale)
|
||||||
|
|
|
@ -1590,6 +1590,14 @@ enum {
|
||||||
/* [2] "Intel Architecture Software Developer's Manual Volume 2: Instruction Set Reference", */
|
/* [2] "Intel Architecture Software Developer's Manual Volume 2: Instruction Set Reference", */
|
||||||
/* Intel Corporation 1997. */
|
/* 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
|
||||||
#endif /* __lightning_asm_i386_h */
|
#endif /* __lightning_asm_i386_h */
|
||||||
|
|
|
@ -37,8 +37,6 @@
|
||||||
#define JIT_CAN_16 1
|
#define JIT_CAN_16 1
|
||||||
#define JIT_AP _EBP
|
#define JIT_AP _EBP
|
||||||
|
|
||||||
#include "core-i386.h"
|
|
||||||
|
|
||||||
struct jit_local_state {
|
struct jit_local_state {
|
||||||
int framesize;
|
int framesize;
|
||||||
int argssize;
|
int argssize;
|
||||||
|
@ -48,7 +46,7 @@ struct jit_local_state {
|
||||||
|
|
||||||
#define jit_base_prolog() (_jitl.framesize = 20, _jitl.alloca_offset = 0, \
|
#define jit_base_prolog() (_jitl.framesize = 20, _jitl.alloca_offset = 0, \
|
||||||
PUSHLr(_EBX), PUSHLr(_ESI), PUSHLr(_EDI), PUSHLr(_EBP), MOVLrr(_ESP, _EBP))
|
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)), \
|
(((ofs) < 0 ? LEAVE_() : POPLr(_EBP)), \
|
||||||
POPLr(_EDI), POPLr(_ESI), POPLr(_EBX), RET_())
|
POPLr(_EDI), POPLr(_ESI), POPLr(_EBX), RET_())
|
||||||
|
|
||||||
|
|
|
@ -39,8 +39,6 @@
|
||||||
#define JIT_CALLTMPSTART 0x48
|
#define JIT_CALLTMPSTART 0x48
|
||||||
#define JIT_REXTMP 0x4B
|
#define JIT_REXTMP 0x4B
|
||||||
|
|
||||||
#include "core-i386.h"
|
|
||||||
|
|
||||||
struct jit_local_state {
|
struct jit_local_state {
|
||||||
int long_jumps;
|
int long_jumps;
|
||||||
int nextarg_getfp;
|
int nextarg_getfp;
|
||||||
|
|
|
@ -350,5 +350,14 @@
|
||||||
#define _jit_alignment(pc, n) (((pc ^ _MASK(4)) + 1) & _MASK(n))
|
#define _jit_alignment(pc, n) (((pc ^ _MASK(4)) + 1) & _MASK(n))
|
||||||
#define jit_align(n) NOPi(_jit_alignment(_jit_UL(_jit.x.pc), (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 */
|
#endif /* __lightning_core_i386_h */
|
||||||
|
|
|
@ -30,8 +30,8 @@
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#ifndef __lightning_asm_fp_h
|
#ifndef __lightning_fp_h
|
||||||
#define __lightning_asm_fp_h
|
#define __lightning_fp_h
|
||||||
|
|
||||||
/* We really must map the x87 stack onto a flat register file. In practice,
|
/* 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
|
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_f() ((_jitl.framesize += sizeof(float)) - sizeof(float))
|
||||||
#define jit_arg_d() ((_jitl.framesize += sizeof(double)) - sizeof(double))
|
#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
45
lightning/i386/fp.h
Normal 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 */
|
|
@ -195,7 +195,8 @@ for j in $BACKENDS; do
|
||||||
suffix=`echo $j | sed -ne 's,.*:,,p' `
|
suffix=`echo $j | sed -ne 's,.*:,,p' `
|
||||||
dirs="$dirs lightning/$dir"
|
dirs="$dirs lightning/$dir"
|
||||||
for i in $file_base_names; do
|
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
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
@ -34,10 +34,10 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "dis-asm.h"
|
#include "dis-asm.h"
|
||||||
|
|
||||||
#define LIGHTNING_I386_32 0
|
#define LIGHTNING_I386 0
|
||||||
#define LIGHTNING_I386_64 1
|
#define LIGHTNING_X86_64 1
|
||||||
#define LIGHTNING_PPC 2
|
#define LIGHTNING_PPC 2
|
||||||
#define LIGHTNING_SPARC 3
|
#define LIGHTNING_SPARC 3
|
||||||
|
|
||||||
void disassemble(stream, from, to)
|
void disassemble(stream, from, to)
|
||||||
FILE *stream;
|
FILE *stream;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue