Commit af9e6d3d authored by pazsan's avatar pazsan

First steps to get peephole optimizing into cross

parent d53714f2
......@@ -516,7 +516,7 @@ bench: gforth-fast$(EXE) gforth.fi
@echo 'Each benchmark takes about 30s on a 486-66 (gcc-2.6.3 -DFORCE_REG)'
time $(FORTH_FAST) siev.fs -e "main bye"
time $(FORTH_FAST) bubble.fs -e "main bye"
time $(FORTH_FAST) -m 160000 matrix.fs -e "main bye"
time $(FORTH_FAST) -m 200000 matrix.fs -e "main bye"
time $(FORTH_FAST) fib.fs -e "main bye"
# ------------- Make forth images
......@@ -625,6 +625,11 @@ kernel/prim.fs: prim.b prims2x.fs kernel/prim0.fs
$(CP) $@- $@
$(RM) $@-
kernel/peephole.fs: prim.b prims2x.fs
$(FORTH) -m 1000000 prims2x.fs -e "forth-flag on s\" prim.b\" ' noop ' output-forth-peephole process-file bye" >$@-
$(CP) $@- $@
$(RM) $@-
gforth$(EXE): engines
-$(CP) gforth$(EXE) gforth~
$(CP) engine/$@ $@
......
This diff is collapsed.
......@@ -126,6 +126,7 @@
\ these m4 macros would collide with identifiers
undefine(`index')
undefine(`shift')
undefine(`symbols')
noop ( -- ) gforth
:
......
......@@ -1013,6 +1013,15 @@ s" IP" save-mem w s" error don't use # on results" make-stack inst-stream
combined prim-c-name 2@ type ." */"
cr ;
: output-forth-peephole ( -- )
combined-prims num-combined @ 1- cells combinations search-wordlist
s" the prefix for this combination must be defined earlier" ?print-error
execute prim-num @ 5 .r
combined-prims num-combined @ 1- th @ prim-num @ 5 .r
combined prim-num @ 5 .r ." prim, \ "
combined prim-c-name 2@ type
cr ;
\ the parser
......
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