David Given
2924ce8ffa
Use nicely optimised helper tools to do signed comparisons of words. Star Trek
...
goes from 40452 to 39890 bytes.
2019-02-14 23:57:55 +01:00
David Given
3c3d2a4520
Fix bad helper tool invocation for inl with faddrn.
2019-02-14 23:21:47 +01:00
David Given
8eaa11ac72
Turns out that every time the compiler tried to do a stack retraction with asp,
...
it would flush registers onto the stack. This stops it doing this. Star Trek
goes from 40779 to 40452 bytes.
2019-02-14 00:05:08 +01:00
David Given
6e3ba8e9a0
Merge from default.
2019-02-13 22:46:00 +01:00
David Given
79a38ecc08
Instead of using parameterised rsts for stack access, add a huge swathe of
...
automatically built helper tools. Star Trek goes up from 40243 to 40779 bytes,
but should be a lot faster.
2019-02-13 22:45:22 +01:00
David Given
8200f041c2
Fix issue with logical operations and small signed constants which turned out
...
to affect multiple platforms.
2019-02-13 20:56:10 +01:00
David Given
f4b45f1ed7
Fix bad code generation due to not correctly flushing the stack before
...
comparisons.
2019-02-12 22:19:07 +01:00
David Given
360e1525ae
Replace the non-working Z80 style signed comparison sign adjustment with
...
something which actually works on the 8080. Sadly, Star Trek is up to
40243 bytes again.
2019-02-12 11:57:37 +01:00
David Given
f1b128baeb
Signed comparisons now work correctly; sadly, Star Trek increases from 39656 to
...
39726 bytes. Note that the emulator doesn't set P/V correctly and all the tests
fail. Testing in z80ex works fine.
2019-02-11 20:46:06 +01:00
David Given
fca54ccc1b
Improve subtractions, using dad and inline constants where possible. Shrinks
...
Star Trek from 39740 to 39656 bytes.
2019-02-10 19:40:48 +01:00
David Given
7d34cd7407
Simplify simple comparisons and use inlie constants where possible. Reduces
...
Star Trek from 39771 to 39740 bytes.
2019-02-10 19:22:43 +01:00
David Given
35d1f36ca4
Use pop rather than inx;inx to retract the stack; consumes a register but
...
halves the number of calls. Reduces Star Trek from 39976 to 39771 bytes.
2019-02-10 18:57:20 +01:00
David Given
b34ff2bdec
Teach the i80 code generator how to do left shifts by using dad hl; prevents it
...
from calling out to .sli2 for simple shifts. Shrinks Star Trek from 40055 bytes
to 39976.
2019-02-10 18:44:47 +01:00
David Given
10b509d6b6
Add rst 3 to get the address of a frame variable; lots of rule overhaulage.
...
Reduces Star Trek from 41821 to 41055 bytes.
2019-02-09 13:29:41 +01:00
David Given
0de5001f82
Make sign extension much less horrible.
2019-02-08 23:16:57 +01:00
David Given
0ac145a0d1
Add tests for simple and, or, and xor; drastically improve the i80 code
...
generation for these.
2019-02-08 22:38:07 +01:00
David Given
a91ab5c599
Somehow the implementation of rst 2 got lost, with hilarious results. Also fix
...
some register corruption issues (I hope).
2019-02-08 21:35:14 +01:00
David Given
a5bf2932c8
Add rst 1 to store frame variables. Reduces Star Trek from 42339 to 41821
...
bytes.
2019-02-07 09:31:38 +01:00
David Given
9d8ea79c7f
rst 1 now takes an eight-bit parameter, not a 16 bit one. Reduces Star Trek
...
again from 43205 to 42339 bytes.
2019-02-07 08:45:20 +01:00
David Given
5ac280026e
Experimentally use rst 1 to optimise frame variable loads. Reduces Star Trek
...
from 43892 to 43205 bytes.
2019-02-07 00:06:32 +01:00
David Given
08b92153a0
Use a helper function for cai --- only saves two bytes per invocation, but is
...
much less embarassing.
2019-02-06 20:36:23 +01:00
David Given
02779325ab
Move the standard ret boilerplate into a helper procedure, to save a little
...
space.
2019-02-06 08:08:11 +01:00
George Koehler
93e01eb5d1
Teach i80 ncg to use libfp. Enable ack -mcpm -fp
.
...
Old .o files stop working if they use floating point. One must
recompile those files. Old files don't call libfp in the correct way,
and may use symbols that I removed from libem. I don't keep old
symbols in libem/flp.s, because a program that pulls both libfp and
flp.s would get "multiply defined" errors in the linker.
I teach mach/i80/ncg/table to use libfp by copying or adapting the
patterns from mach/i86/ncg/table. I did not test all the patterns,
but I did use `ack -mcpm -fp -O4` to compile examples/mandelbrot.c,
then I ran it in the emulator YAZE-AG. It worked, but it was slow.
2018-04-25 16:09:56 -04:00
George Koehler
34cf0c8b63
Kill registers a, de, when i80 ncg does Call libem.
...
I compiled tests/plat/lib/test.c with ack -mcpm, but i80 ncg did emit
wrong code in writehex(uint32_t) for
"0123456789abcdef"[code & 0xf]
The code called '.and' to evaluate `code & 0xf`, then tried to call
'.cii' to narrow the result from 4 to 2 bytes, but it passed garbage
instead of 4 to '.cii'. The rule for '.and' was
pat and defined($1)
kills ALL
uses dereg={const2,$1}
gen Call {label,".and"}
This failed to kill register de={const2,4}, so ncg pushed de,
expecting to push 4, but actually pushing garbage.
Fix such rules using `mvi a,...` or `lxi de,...` so ncg doesn't track
the token in the register. This is like the i86 table. A different
fix would use a dummy instruction `killreg a` or `killreg de` like the
m68020 table.
Also correct 1 to $1 when calling '.exg'.
2017-12-06 22:14:00 -05:00
dtrg
df088c184b
Added optimised rules for int<<8 and uint>>8 (which can be done with simple register shuffling rather than calling .sli).
2007-04-29 23:00:31 +00:00
dtrg
440d6faadd
Fixed a bug where loc lol stf was getting the constant pushed onto the stack *after* stf had popped it off.
2007-04-27 22:15:31 +00:00
ceriel
1db6a3029b
Header --> Id
1994-06-24 14:02:31 +00:00
ceriel
6f03cff48f
Some minor modifications reflecting some changes in the peephole optimizer
1992-09-01 09:39:15 +00:00
ceriel
564cbc6eba
Only call NOP routine when debugging table
1991-09-04 10:55:52 +00:00
ceriel
c998623932
Some more adaptions to new semantics of ncgg
1987-11-10 13:49:04 +00:00
ceriel
12d731dfcf
adapted table to new semantics of STACK
1987-08-26 13:47:37 +00:00
em
94534b7c15
1- Floating point routines now call routines instead of calling trp.
1985-04-12 14:25:59 +00:00
garde
80e349860b
Added RCS id.
1985-03-18 12:55:07 +00:00
garde
d52117c8dd
Some less important changes
1985-03-18 10:00:30 +00:00
garde
736a2d1022
Many things improved and extended
1985-03-04 13:42:38 +00:00
garde
8e154eb826
Many, many improvements made, ususually small ones.
...
For example: many em-patterns have got alternative code-rules.
1985-02-01 12:51:56 +00:00
garde
a849b751a9
src1 and src2 extended.
...
Errors in 'pat loc cmi teq' and 'pat loc cmi tne' recovered.
Second stack-pattern for 'pat zlt' and 'pat zge' added.
Patterns for 'lil loc adi sil', 'lil inc sil', 'lil dec sil'
and 'sil lil' added.
1985-01-22 19:55:11 +00:00
garde
d8d2068664
Initial revision
1985-01-17 14:31:34 +00:00