David Given [Tue, 12 Feb 2019 23:42:47 +0000 (00:42 +0100)]
Oops! Forgot to define bc_or_de, which meant anything which tried to use that
register class couldn't find a register. Star Trek shrinks from 40513 to 40485
bytes.
David Given [Tue, 12 Feb 2019 23:40:20 +0000 (00:40 +0100)]
Go through the code generator telling it it's allowed to use BC. Something's
terribly wrong with register moves; Star Trek shrinks from 40539 to 40513
bytes.
David Given [Tue, 12 Feb 2019 22:49:54 +0000 (23:49 +0100)]
Rework the code generator not to use BC for the frame pointer. Star Trek is up
from 40243 to 40539 bytes.
David Given [Tue, 12 Feb 2019 21:29:01 +0000 (22:29 +0100)]
Merge pull request #158 from davidgiven/dtrg-b157
i80: fix bad code in comparisons
David Given [Tue, 12 Feb 2019 21:19:07 +0000 (22:19 +0100)]
Fix bad code generation due to not correctly flushing the stack before
comparisons.
David Given [Tue, 12 Feb 2019 21:08:08 +0000 (22:08 +0100)]
Added a test case for #157.
David Given [Tue, 12 Feb 2019 20:51:46 +0000 (21:51 +0100)]
Merge pull request #154 from ccodere/buildfix
Bugfix of compilation on gcc 4.8
carl [Tue, 12 Feb 2019 16:17:45 +0000 (00:17 +0800)]
Fix compilation issue on C90 compilers (gcc 4.8 was failing to compile with default flags) - updated following comment.
David Given [Tue, 12 Feb 2019 10:57:37 +0000 (11:57 +0100)]
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.
David Given [Mon, 11 Feb 2019 20:35:16 +0000 (21:35 +0100)]
Merge pull request #156 from davidgiven/dtrg-arraysizes
i80: add 8085 instruction support
David Given [Mon, 11 Feb 2019 20:14:35 +0000 (21:14 +0100)]
Apply Alan Cox's patch to add the 8085 extended instructions to the i80
assembler.
David Given [Mon, 11 Feb 2019 20:09:52 +0000 (21:09 +0100)]
Merge pull request #155 from davidgiven/dtrg-arraysizes
i80: fix signed comparisons
David Given [Mon, 11 Feb 2019 19:46:06 +0000 (20:46 +0100)]
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.
carl [Mon, 11 Feb 2019 16:46:09 +0000 (00:46 +0800)]
Fix compilation issue on C90 compilers (gcc 4.8 was failing to compile with default flags).
David Given [Sun, 10 Feb 2019 22:40:07 +0000 (23:40 +0100)]
Merge from default.
David Given [Sun, 10 Feb 2019 22:39:15 +0000 (23:39 +0100)]
Add tests for simple comparisons (which i80 fails).
David Given [Sun, 10 Feb 2019 18:45:00 +0000 (19:45 +0100)]
Merge pull request #153 from davidgiven/dtrg-i80
i80: more code generator improvements
David Given [Sun, 10 Feb 2019 18:40:48 +0000 (19:40 +0100)]
Improve subtractions, using dad and inline constants where possible. Shrinks
Star Trek from 39740 to 39656 bytes.
David Given [Sun, 10 Feb 2019 18:22:43 +0000 (19:22 +0100)]
Simplify simple comparisons and use inlie constants where possible. Reduces
Star Trek from 39771 to 39740 bytes.
David Given [Sun, 10 Feb 2019 17:57:20 +0000 (18:57 +0100)]
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.
David Given [Sun, 10 Feb 2019 17:44:47 +0000 (18:44 +0100)]
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.
David Given [Sun, 10 Feb 2019 15:40:16 +0000 (16:40 +0100)]
Merge pull request #152 from davidgiven/dtrg-osx
Enable OSX builds again.
David Given [Sun, 10 Feb 2019 13:36:15 +0000 (14:36 +0100)]
Replace mkstemp() with the more modern and safer and simpler tmpfile().
David Given [Sun, 10 Feb 2019 13:32:17 +0000 (14:32 +0100)]
freopen() appears to be problematic on OSX; as it's only ever used to rewind
files, replace with rewind().
David Given [Sun, 10 Feb 2019 13:19:18 +0000 (14:19 +0100)]
Better error reporting.
David Given [Sun, 10 Feb 2019 13:09:52 +0000 (14:09 +0100)]
More common symbol removal.
David Given [Sun, 10 Feb 2019 13:03:55 +0000 (14:03 +0100)]
More common symbol fixing.
David Given [Sun, 10 Feb 2019 12:20:04 +0000 (13:20 +0100)]
Removed a whole bunch of old strcpy() prototypes in favour of <string.h>.
David Given [Sun, 10 Feb 2019 12:11:03 +0000 (13:11 +0100)]
Second try at removing common symbols.
David Given [Sun, 10 Feb 2019 11:57:22 +0000 (12:57 +0100)]
Change the way external symbols are defined to avoid COMMON symbols, which
don't work on OSX very well.
David Given [Sun, 10 Feb 2019 11:57:00 +0000 (12:57 +0100)]
Add stray header.
David Given [Sun, 10 Feb 2019 11:38:33 +0000 (12:38 +0100)]
Remember that we need to update the generated file in LLgen, as it's not
self-bootstrapping...
David Given [Sun, 10 Feb 2019 11:35:18 +0000 (12:35 +0100)]
We don't need depth 10 in the travis checkout.
David Given [Sun, 10 Feb 2019 11:28:42 +0000 (12:28 +0100)]
Don't prototype strcpy as it makes OSX sad.
David Given [Sun, 10 Feb 2019 11:22:59 +0000 (12:22 +0100)]
Merge from default.
David Given [Sat, 9 Feb 2019 23:45:09 +0000 (00:45 +0100)]
Add missing header.
David Given [Sat, 9 Feb 2019 16:43:19 +0000 (17:43 +0100)]
Merge pull request #150 from davidgiven/dtrg-windows
Don't run the floating point tests on i80.
David Given [Sat, 9 Feb 2019 13:24:31 +0000 (14:24 +0100)]
Don't run the floating point tests on i80.
David Given [Sat, 9 Feb 2019 13:15:38 +0000 (14:15 +0100)]
Merge pull request #148 from davidgiven/dtrg-windows
Make the ACK build on Windows again.
David Given [Sat, 9 Feb 2019 12:59:37 +0000 (13:59 +0100)]
Don't run the tests in Appveyor.
David Given [Sat, 9 Feb 2019 12:42:09 +0000 (13:42 +0100)]
More z80ex removal.
David Given [Sat, 9 Feb 2019 12:40:36 +0000 (13:40 +0100)]
Merge pull request #149 from davidgiven/dtrg-arraysizes
i80: more code size improvements.
David Given [Sat, 9 Feb 2019 12:30:29 +0000 (13:30 +0100)]
Remove stray z80ex reference.
David Given [Sat, 9 Feb 2019 12:29:41 +0000 (13:29 +0100)]
Add rst 3 to get the address of a frame variable; lots of rule overhaulage.
Reduces Star Trek from 41821 to 41055 bytes.
David Given [Sat, 9 Feb 2019 11:25:27 +0000 (12:25 +0100)]
Ugh, typo fix.
David Given [Sat, 9 Feb 2019 11:23:42 +0000 (12:23 +0100)]
Maybe the setup script is somewhere else?
David Given [Sat, 9 Feb 2019 11:17:57 +0000 (12:17 +0100)]
Try to install cygwin packages.
David Given [Sat, 9 Feb 2019 11:04:42 +0000 (12:04 +0100)]
Another try at an AppVeyor build script.
David Given [Fri, 8 Feb 2019 23:07:33 +0000 (00:07 +0100)]
Add experimental appveyor file.
David Given [Fri, 8 Feb 2019 23:02:41 +0000 (00:02 +0100)]
Rename all files called 'aux.*' to something else; Windows can't handle them.
David Given [Fri, 8 Feb 2019 22:19:08 +0000 (23:19 +0100)]
Merge pull request #147 from davidgiven/dtrg-arraysizes
i80: better and, or, xor, sign extension code.
David Given [Fri, 8 Feb 2019 22:16:57 +0000 (23:16 +0100)]
Make sign extension much less horrible.
David Given [Fri, 8 Feb 2019 21:38:07 +0000 (22:38 +0100)]
Add tests for simple and, or, and xor; drastically improve the i80 code
generation for these.
David Given [Fri, 8 Feb 2019 20:53:56 +0000 (21:53 +0100)]
Merge pull request #145 from davidgiven/dtrg-arraysizes
Experimentally use rst 1 to optimise frame variable loads.
David Given [Fri, 8 Feb 2019 20:43:52 +0000 (21:43 +0100)]
CP/M sbrk now handles overflow correctly.
David Given [Fri, 8 Feb 2019 20:35:14 +0000 (21:35 +0100)]
Somehow the implementation of rst 2 got lost, with hilarious results. Also fix
some register corruption issues (I hope).
David Given [Fri, 8 Feb 2019 19:54:44 +0000 (20:54 +0100)]
Add a 'disassemble' command to the CP/M emulator.
David Given [Fri, 8 Feb 2019 07:09:55 +0000 (08:09 +0100)]
Fix swapped bytes in probyte which was causing junk stack frames.
David Given [Thu, 7 Feb 2019 22:45:47 +0000 (23:45 +0100)]
Merge from default.
David Given [Thu, 7 Feb 2019 22:45:08 +0000 (23:45 +0100)]
Merge pull request #146 from davidgiven/dtrg-cpmemu
Add a CP/M i80 emulator, and enable the cpm tests
David Given [Thu, 7 Feb 2019 22:36:45 +0000 (23:36 +0100)]
Build the CP/M tests (which got turned off accidentally). Add a disassembler to
the emulator debugger.
David Given [Thu, 7 Feb 2019 22:01:10 +0000 (23:01 +0100)]
Add missing file.
David Given [Thu, 7 Feb 2019 21:39:57 +0000 (22:39 +0100)]
Add the cpm emulator from Cowgol, modified to work with an 8080 emulator rather
than libz80ex; enable tests for cpm.
David Given [Thu, 7 Feb 2019 08:31:38 +0000 (09:31 +0100)]
Add rst 1 to store frame variables. Reduces Star Trek from 42339 to 41821
bytes.
David Given [Thu, 7 Feb 2019 08:09:31 +0000 (09:09 +0100)]
Fix warnings.
David Given [Thu, 7 Feb 2019 07:45:20 +0000 (08:45 +0100)]
rst 1 now takes an eight-bit parameter, not a 16 bit one. Reduces Star Trek
again from 43205 to 42339 bytes.
David Given [Wed, 6 Feb 2019 23:06:32 +0000 (00:06 +0100)]
Experimentally use rst 1 to optimise frame variable loads. Reduces Star Trek
from 43892 to 43205 bytes.
David Given [Wed, 6 Feb 2019 20:31:29 +0000 (21:31 +0100)]
Merge pull request #144 from davidgiven/dtrg-arraysizes
i80: use a helper function for cai.
David Given [Wed, 6 Feb 2019 19:36:23 +0000 (20:36 +0100)]
Use a helper function for cai --- only saves two bytes per invocation, but is
much less embarassing.
David Given [Wed, 6 Feb 2019 15:15:53 +0000 (16:15 +0100)]
Merge pull request #142 from davidgiven/dtrg-arraysizes
i80: factor out function prologue boilerplate
David Given [Wed, 6 Feb 2019 15:06:07 +0000 (16:06 +0100)]
Common out boilerplate function prologue code; shrinks Star Trek from 44256 to
43892 bytes.
David Given [Wed, 6 Feb 2019 10:50:05 +0000 (11:50 +0100)]
Run through clang-format before editing.
David Given [Wed, 6 Feb 2019 10:30:56 +0000 (11:30 +0100)]
Merge pull request #141 from davidgiven/dtrg-stray
Install the cpp.ansi man page.
David Given [Wed, 6 Feb 2019 07:43:16 +0000 (07:43 +0000)]
Merge pull request #140 from davidgiven/dtrg-arraysizes
CPM: Move the standard ret boilerplate into a helper procedure.
David Given [Wed, 6 Feb 2019 07:08:11 +0000 (08:08 +0100)]
Move the standard ret boilerplate into a helper procedure, to save a little
space.
David Given [Sat, 22 Dec 2018 22:47:49 +0000 (23:47 +0100)]
Install the cpp.ansi man page. #82.
David Given [Tue, 20 Nov 2018 09:52:44 +0000 (10:52 +0100)]
Merge pull request #136 from kernigh/kernigh-led-malloc
Fewer calls to brk() and sbrk()
George Koehler [Wed, 14 Nov 2018 21:13:54 +0000 (16:13 -0500)]
Remove code to calculate memory usage with sbrk().
In many systems, malloc() can allocate outside the brk area. The
calculation with sbrk() misses those allocations. When LLgen or ncgg
reported the memory usage, the value was probably too low.
George Koehler [Tue, 13 Nov 2018 23:05:16 +0000 (18:05 -0500)]
Switch led to malloc() and realloc().
Add USEMALLOC and enable it by default. You can switch back to brk()
by removing `#define USEMALLOC` in memory.c.
USEMALLOC tells the allocator to use malloc() and realloc(), not
brk(). This might help systems where brk() doesn't work, or where
malloc() can allocate outside the brk area.
My build shows no changes in share/ack/examples (except hilo_bas.*).
George Koehler [Tue, 13 Nov 2018 03:46:26 +0000 (22:46 -0500)]
Fix em_led -u name when memory allocator moves ALLOMODL.
Option -u was passing an offset from modulptr(0) in ALLOMODL to the
string in argv. If entername() would move ALLOMODL to make room in
ALLOGCHR, then the offset would become invalid, so the string would
get lost. This fix copies the string into ALLOMODL.
This was often not a problem because the initial size of ALLOGCHR in
mach.h is probably large enough for -u. This became a problem when I
caused the initial allocations to fail, and then only because the B
runtime uses -u.
George Koehler [Mon, 12 Nov 2018 03:51:17 +0000 (22:51 -0500)]
Switch from long to size_t when allocating memory.
Also move the declarations of `incore` and `core_alloc` to "memory.h".
Also correct SYMDEBUG to SYMDBUG. (I don't know if SYMDBUG works
because our build system never defines it.)
ind_t becomes an alias of size_t. ind_t becomes unsigned, so I edit
some code that was using negative ind_t. Some casts disappear, like
(long)sizeof(...) because the size is already a size_t. There are
changes to overflow checks. Callers with a size too big for size_t
must check it before calling the memory allocator. An overflow check
of BASE + incr in memory.c sbreak() now happens on all platforms, not
only when a pointer is smaller than a long.
My build shows no changes in share/ack/examples (except hilo_bas.*
changing with every build).
David Given [Mon, 5 Nov 2018 20:48:17 +0000 (21:48 +0100)]
Merge pull request #135 from kernigh/kernigh-mv-int
Move int to $(INSDIR)/bin/int
George Koehler [Mon, 5 Nov 2018 20:14:29 +0000 (15:14 -0500)]
Move int to $(INSDIR)/bin/int
If $(INSDIR)/bin is in PATH, then the user can run both ack(1) and
int(1), like
$ ack -mem22 -o prog prog.c
$ int prog
David Given [Sat, 22 Sep 2018 15:30:52 +0000 (17:30 +0200)]
Merge pull request #133 from davidgiven/dtrg-mips
Allow constants >INT_MAX in mcg
David Given [Sat, 22 Sep 2018 10:45:59 +0000 (12:45 +0200)]
When parsing constants which don't fit into an arith, handle overflow properly
(and don't turn them all into INT_MAX...).
David Given [Sat, 22 Sep 2018 10:04:13 +0000 (11:04 +0100)]
Merge pull request #132 from davidgiven/dtrg-mips
Teach mcg how to merge pushes
David Given [Sat, 22 Sep 2018 09:49:13 +0000 (11:49 +0200)]
Teach the code generator about the zero register and how to efficiently access
the stack.
David Given [Sat, 22 Sep 2018 09:19:50 +0000 (11:19 +0200)]
Take hreg aliases into account when finding evicted registers and performing
the register shuffle dance.
David Given [Sat, 22 Sep 2018 09:19:00 +0000 (11:19 +0200)]
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.
David Given [Thu, 20 Sep 2018 22:05:55 +0000 (23:05 +0100)]
Merge pull request #131 from davidgiven/dtrg-mips
Add an mcg-based MIPS code generator.
David Given [Thu, 20 Sep 2018 21:30:38 +0000 (23:30 +0200)]
Remove some old, hopefully unused PowerPC code. Teach the code generator about
non-volatile long registers.
David Given [Thu, 20 Sep 2018 21:24:46 +0000 (23:24 +0200)]
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.
David Given [Wed, 19 Sep 2018 22:49:31 +0000 (00:49 +0200)]
Create correctly sized csa descriptors in the Basic compiler.
David Given [Wed, 19 Sep 2018 22:39:13 +0000 (00:39 +0200)]
A few more minor optimisations.
David Given [Wed, 19 Sep 2018 22:12:03 +0000 (00:12 +0200)]
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.
David Given [Wed, 19 Sep 2018 22:06:26 +0000 (00:06 +0200)]
Fix incorrect ori encoding.
David Given [Tue, 18 Sep 2018 22:09:50 +0000 (00:09 +0200)]
Remember to save longs and doubles. Yikes.
David Given [Tue, 18 Sep 2018 21:49:31 +0000 (23:49 +0200)]
Updated READMEs with the MIPS platform.
David Given [Tue, 18 Sep 2018 21:39:04 +0000 (23:39 +0200)]
Make the MIPS boot code produce correct code.
David Given [Tue, 18 Sep 2018 21:38:37 +0000 (23:38 +0200)]
Loads and stores (except longs, which are difficult) are now loaded with two
instructions rather than three.