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
e8994afdf0
Apply Alan Cox's patch to add the 8085 extended instructions to the i80
...
assembler.
2019-02-11 21:14:35 +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
c95d5db372
Replace mkstemp() with the more modern and safer and simpler tmpfile().
2019-02-10 14:36:15 +01:00
David Given
63fa647bc9
freopen() appears to be problematic on OSX; as it's only ever used to rewind
...
files, replace with rewind().
2019-02-10 14:32:17 +01:00
David Given
1dfafe070c
Better error reporting.
2019-02-10 14:19:18 +01:00
David Given
58698bed19
Removed a whole bunch of old strcpy() prototypes in favour of <string.h>.
2019-02-10 13:20:04 +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
d319c7d679
Fix swapped bytes in probyte which was causing junk stack frames.
2019-02-08 08:09:55 +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
67a9be26d1
Fix warnings.
2019-02-07 09:09:31 +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
2b0629f87f
Common out boilerplate function prologue code; shrinks Star Trek from 44256 to
...
43892 bytes.
2019-02-06 16:06:07 +01:00
David Given
b77f616598
Run through clang-format before editing.
2019-02-06 11:50:05 +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
David Given
ed91ea4371
When parsing constants which don't fit into an arith, handle overflow properly
...
(and don't turn them all into INT_MAX...).
2018-09-22 12:45:59 +02:00
David Given
79e7636537
Teach the code generator about the zero register and how to efficiently access
...
the stack.
2018-09-22 11:49:13 +02:00
David Given
99fcde69dc
Take hreg aliases into account when finding evicted registers and performing
...
the register shuffle dance.
2018-09-22 11:19:50 +02:00
David Given
bbb708717a
Add the OPTIONS clause to the mcgg grammar; add an optional pass which converts
...
sequences of PUSHes to a single STACKADJUST followed by STOREs. This should
dramatically improve code on stack-unfriendly architectures like MIPS.
2018-09-22 11:19:00 +02:00
David Given
985d3dc7d1
Remove some old, hopefully unused PowerPC code. Teach the code generator about
...
non-volatile long registers.
2018-09-20 23:30:38 +02:00
David Given
65a20ce2d6
Fix subtle register corruption bug where aliases weren't taken into account
...
when assigning input registers to phis, which could cause the same hreg to be
assigned to two vregs of different types. Also improve tracing.
2018-09-20 23:24:46 +02:00
David Given
cb20856aea
A few more minor optimisations.
2018-09-20 00:39:13 +02:00
David Given
ac856f3b09
The approach I was taking to csa and csb turns out not to work --- critical
...
edge splitting can cause new basic blocks to be added to the graph, but while
the graph itself gets properly rewritten the descriptor tables can't be updated
to take these into account, so they end up pointing at the wrong blocks. This
causes really hard-to-debug problems.
The new approach is to parse the descriptor blocks and then generate a
comparison chain. Brute force, but much easier for the compiler to reason
about.
2018-09-20 00:12:03 +02:00
David Given
ac921080b7
Fix incorrect ori encoding.
2018-09-20 00:06:26 +02:00
David Given
8fda024ec8
Remember to save longs and doubles. Yikes.
2018-09-19 00:09:50 +02:00
David Given
d23d2dd1b3
Loads and stores (except longs, which are difficult) are now loaded with two
...
instructions rather than three.
2018-09-18 23:38:37 +02:00
David Given
52ee317878
Fixed some bad mcg ir code generation: only nodes which have been appendir'd
...
may be used multiple times.
2018-09-18 23:32:53 +02:00
David Given
692caa2b0a
Add unsigned comparison rules.
2018-09-18 00:19:40 +02:00
David Given
f362d12dee
Add extern declaration which I forget to check in.
2018-09-17 23:59:49 +02:00
David Given
fe177bd688
Add specialist rules for signed integer comparisons; much better code.
2018-09-17 23:53:18 +02:00
David Given
ec0891469f
Array descriptor ranges are inclusive; adjust aar and the tests to check for
...
this. All the tests except rotate build now!
2018-09-17 19:34:38 +01:00
David Given
f61500c51b
Fix lar and sar, which were horribly, horribly broken. Add tests.
2018-09-17 18:44:17 +01:00
David Given
abb7e3e105
Fix aar; add test.
2018-09-17 16:59:45 +01:00
David Given
b665efca04
ACK loi 1 and sti 1 load and store unsigned bytes. I think.
2018-09-17 15:03:44 +01:00
David Given
c2dc1e184e
rotate() now generates valid code.
2018-09-17 13:13:39 +01:00
David Given
0202ac8700
Fix bls4.
2018-09-17 12:53:27 +01:00
David Given
1e073e944a
Added cms, and a test for it.
2018-09-17 12:42:10 +01:00
David Given
0b65591972
Add hacky 64-bit comparisons (used by M2).
2018-09-17 12:16:17 +01:00
David Given
15ae171aef
Added a test for set. Fix mips set implementation.
2018-09-17 11:56:15 +01:00
David Given
7efb749003
Set fixes; also add discrete tests for and, ior, xor.
2018-09-14 14:13:35 +01:00
David Given
08b1e8d71b
Make inn work; fix broken 64-bit loads and stores.
2018-09-14 13:48:43 +02:00