Commit 940e3b26 authored by pazsan's avatar pazsan

Made peephole a configurable option

parent c9c194c1
......@@ -127,7 +127,7 @@ INCLUDES = engine/forth.h engine/threaded.h engine/io.h
KERN_SRC = \
mach16b.fs mach16l.fs mach32b.fs mach32l.fs mach64b.fs mach64l.fs \
machpc.fs \
machpc.fs.in \
kernel/aliases0.fs \
kernel/aliases.fs \
kernel/args.fs \
......@@ -529,22 +529,22 @@ bench: gforth-fast$(EXE) gforth.fi
# 3. copy new kernels to kernlXYZ.fi
# these are the ones we want to use now
kernl16l.fi-: $(KERN_SRC) kernel/version.fs mach16l.fs $(FORTH_GEN0)
kernl16l.fi-: $(KERN_SRC) kernel/version.fs mach16l.fs machpc.fs $(FORTH_GEN0)
$(FORTHK) -e 's" mach16l.fs"' $(srcdir)/kernel/main.fs -e "save-cross kernl16l.fi- $(bindir)/gforth-$(VERSION) bye"
kernl16b.fi-: $(KERN_SRC) kernel/version.fs mach16b.fs $(FORTH_GEN0)
kernl16b.fi-: $(KERN_SRC) kernel/version.fs mach16b.fs machpc.fs $(FORTH_GEN0)
$(FORTHK) -e 's" mach16b.fs"' $(srcdir)/kernel/main.fs -e "save-cross kernl16b.fi- $(bindir)/gforth-$(VERSION) bye"
kernl32l.fi-: $(KERN_SRC) kernel/version.fs mach32l.fs $(FORTH_GEN0)
kernl32l.fi-: $(KERN_SRC) kernel/version.fs mach32l.fs machpc.fs $(FORTH_GEN0)
$(FORTHK) -e 's" mach32l.fs"' $(srcdir)/kernel/main.fs -e "save-cross kernl32l.fi- $(bindir)/gforth-$(VERSION) bye"
kernl32b.fi-: $(KERN_SRC) kernel/version.fs mach32b.fs $(FORTH_GEN0)
kernl32b.fi-: $(KERN_SRC) kernel/version.fs mach32b.fs machpc.fs $(FORTH_GEN0)
$(FORTHK) -e 's" mach32b.fs"' $(srcdir)/kernel/main.fs -e "save-cross kernl32b.fi- $(bindir)/gforth-$(VERSION) bye"
kernl64l.fi-: $(KERN_SRC) kernel/version.fs mach64l.fs $(FORTH_GEN0)
kernl64l.fi-: $(KERN_SRC) kernel/version.fs mach64l.fs machpc.fs $(FORTH_GEN0)
$(FORTHK) -e 's" mach64l.fs"' $(srcdir)/kernel/main.fs -e "save-cross kernl64l.fi- $(bindir)/gforth-$(VERSION) bye"
kernl64b.fi-: $(KERN_SRC) kernel/version.fs mach64b.fs $(FORTH_GEN0)
kernl64b.fi-: $(KERN_SRC) kernel/version.fs mach64b.fs machpc.fs $(FORTH_GEN0)
$(FORTHK) -e 's" mach64b.fs"' $(srcdir)/kernel/main.fs -e "save-cross kernl64b.fi- $(bindir)/gforth-$(VERSION) bye"
kernl-%.fi: arch/%/mach.fs $(KERN_SRC) kernel/version.fs $(FORTH_GEN0)
......@@ -745,7 +745,7 @@ stamp-h: engine/config.h.in config.status
CONFIG_FILES=$@ CONFIG_HEADERS=engine/config.h ./config.status
echo timestamp > stamp-h
Makefile Makedist engine/Makefile gforthmi: Makefile.in Makedist.in engine/Makefile.in gforthmi.in config.status
Makefile Makedist engine/Makefile gforthmi machpc.fs: Makefile.in Makedist.in engine/Makefile.in gforthmi.in machpc.fs.in config.status
CONFIG_FILES="$@" CONFIG_HEADERS=engine/config.h ./config.status
config.status: configure
......
......@@ -45,6 +45,11 @@
#undef FORCE_REG
#endif
/* Define if you want to use peephole optimization */
#ifndef HAS_PEEPHOLE
#undef HAS_PEEPHOLE
#endif
/* an integer type that is as long as a pointer */
#define CELL_TYPE long
......
......@@ -101,6 +101,5 @@ typedef void *Label;
#define HAS_XCONDS
#define HAS_STANDARDTHREADING
#define HAS_DEBUG
#define HAS_PEEPHOLE
#define RELINFOBITS 8
......@@ -34,7 +34,6 @@ AC_ARG_ENABLE(force-reg,
the machine.h file. This can cause a good speedup,
but also incorrect code with some gcc versions on
some processors (default disabled).],
AC_DEFINE(FORCE_REG))
dnl this is not quite according to the autoconf manual, it causes a replacement
AC_ARG_ENABLE(direct-threaded,
......@@ -55,6 +54,13 @@ AC_ARG_WITH(debug,
debugging informations.],
if test "$withval" = "yes"; then DEBUGFLAG=-g; fi)
PEEPHOLE="yes"
AC_ARG_WITH(peephole,
[ --with-peephole Enable peephole optimization (default)
--without-peephole disables peephole optimization. Creates smaller,
but slower images.],
PEEPHOLE="$withval")
CFLAGS=$CFLAGS
AC_PROG_CC
......@@ -296,6 +302,15 @@ AC_DEFINE_UNQUOTED(PATHSEP,'$PATHSEP')
AC_SUBST(FORTHSIZES)
if test "$PEEPHOLE" = "yes"
then
PEEPHOLEFLAG="true"
AC_DEFINE(HAS_PEEPHOLE)
else
PEEPHOLEFLAG="false"
fi
AC_SUBST(PEEPHOLEFLAG)
dnl copy commands for systems that don't have links
AC_SUBST(LINK_KERNL)
LINK_KERNL=""
......@@ -360,6 +375,7 @@ AC_OUTPUT([
Makefile
Makedist
gforthmi
machpc.fs
engine/Makefile
doc/version.texi ],
echo timestamp > stamp-h
......
......@@ -808,7 +808,7 @@ ghost (next) drop
ghost unloop ghost ;S 2drop
ghost lit ghost (compile) ghost ! 2drop drop
ghost (does>) ghost noop 2drop
ghost (.") ghost (S") ghost (ABORT") 2drop drop ( " )
ghost (.") ghost (S") ghost (ABORT") 2drop drop
ghost ' drop
ghost :docol ghost :doesjump ghost :dodoes 2drop drop
ghost :dovar ghost :dodefer ghost :dofield 2drop drop
......@@ -2405,9 +2405,9 @@ Cond: NEXT restrict? sys? next, ;Cond
: ," [char] " parse T string, align H ;
Cond: ." restrict? compile (.") T ," H ;Cond ( " )
Cond: S" restrict? compile (S") T ," H ;Cond ( " )
Cond: ABORT" restrict? compile (ABORT") T ," H ;Cond ( " )
Cond: ." restrict? compile (.") T ," H ;Cond
Cond: S" restrict? compile (S") T ," H ;Cond
Cond: ABORT" restrict? compile (ABORT") T ," H ;Cond
Cond: IS T ' >body H compile ALiteral compile ! ;Cond
: IS T >address ' >body ! H ;
......
......@@ -20,6 +20,7 @@
*/
#include "config.h"
#include "forth.h"
#include <ctype.h>
#include <stdio.h>
#include <string.h>
......@@ -27,7 +28,6 @@
#include <assert.h>
#include <stdlib.h>
#include <errno.h>
#include "forth.h"
#include "io.h"
#include "threaded.h"
#ifndef STANDALONE
......
This diff is collapsed.
......@@ -2143,7 +2143,7 @@ Variable UP
wcall ( u -- ) gforth
IF_fpTOS(fp[0]=fpTOS);
FP=fp;
sp=(SYSCALL(Cell(*)(Cell *, void *))u)(sp, &FP);
sp=(Cell*)(SYSCALL(Cell(*)(Cell *, void *))u)(sp, &FP);
fp=FP;
IF_spTOS(spTOS=sp[0];)
IF_fpTOS(fpTOS=fp[0]);
......
......@@ -444,7 +444,7 @@ VARIABLE C-Pass
CREATE C-Table
' lit A, ' c-lit A,
' call A, ' c-call A,
[IFDEF] call ' call A, ' c-call A, [THEN]
' (s") A, ' c-c" A,
' (.") A, ' c-c" A,
' "lit A, ' c-c" A,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment