Commit graph

50 commits

Author SHA1 Message Date
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 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
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
George Koehler 5301cceee3 Declare machine-dependent functions in mach/proto/ncg
This breaks all machines because the declared return type void
disagrees with the implicit return type int (when I compile mach.c
with clang).  Unbreak i386, i80, i86, m68020, powerpc, vc4 by adding
the return types to mach.c.  We don't build any other machines; they
are broken since commit a46ee91 (May 19, 2013) declared void prolog()
and commit fd91851 (Nov 10, 2016) declared void mes(), with both
declarations in mach/proto/ncg/fillem.c.

Also fix mach/vc4/ncg/mach.c where type full is long, so fprintf()
must use "%ld" not "%d" to print full nlocals.
2017-11-13 14:23:44 -05:00
David Given fd91851005 Add enough return types to the K&R C that the ACK builds (on Linux) using clang
now.
2016-11-10 22:04:18 +01:00
David Given f67c98e239 Distributions are a pain --- let's not bother any more. Instead, we just tag
the repository and download a complete snapshot, old and ancient stuff and all.
2016-09-02 23:00:38 +02:00
George Koehler 0131ca4d46 Delete 689 undead files.
These files "magically reappeared" after the conversion from CVS to
Mercurial.  The old CVS repository deleted these files but did not
record *when* it deleted these files.  The conversion resurrected these
files because they have no history of deletion.  These files were
probably deleted before year 1995.  The CVS repository begins to record
deletions around 1995.

These files may still appear in older revisions of this Mercurial
repository, when they should already be deleted.  There is no way to fix
this, because the CVS repository provides no dates of deletion.

See http://sourceforge.net/mailarchive/message.php?msg_id=29823032
2012-09-20 22:26:32 -04: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 c7edcc34d6 New installation mechanism 1991-08-27 10:47:25 +00:00
ceriel 22378eaff8 produce commons for newlbss 1991-03-18 15:06:01 +00:00
ceriel 0d65b92220 removed -i flag 1991-02-19 16:57:39 +00:00
eck 4ef2c70ed3 added stackheight message handling 1990-07-18 14:53:19 +00:00
eck 78d3e500fb added CPP variable to Makefile 1989-10-20 11:05:00 +00:00
ceriel c820d77690 new floating point constant mechanism 1989-07-10 16:52:02 +00:00
ceriel 2f7e414d42 corrected lint entry 1988-06-28 14:36:21 +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
ceriel 69843cf9ce Added -DNDEBUG to Makefile, table now kills regvars 1987-07-06 15:28:59 +00:00
ceriel d41028a664 pass EMHOME to nested make 1987-06-30 18:30:45 +00:00
ceriel 81b1d21c35 Initial revision 1987-04-13 10:32:47 +00:00
ceriel 96d15a6c05 minor mod 1987-04-03 11:18:49 +00:00
ceriel 410bfa3cb2 "word" is always a "long" 1987-04-02 10:04:25 +00:00
ceriel 88db8b43da Added distr entry 1987-03-19 10:12:51 +00:00
ceriel 5537abbdfb Added copyright notice 1987-03-10 01:26:51 +00:00
ceriel 815166e421 Added copyright notice 1987-03-09 19:15:41 +00:00
ceriel 0d1c90a23e Adapted to new assembler 1987-02-09 16:49:13 +00:00
ceriel ebd44261fe cc --> $(CC), added -O flag to CFLAGS 1987-01-28 12:49:42 +00:00
ceriel e77bde5e75 Added TABLEFLAGS and CGGFLAGS. 1987-01-12 15:10:49 +00:00
ceriel 031d26deb4 Preprocess table. 1987-01-12 14:50:25 +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
keie 815b0e0f0f *** empty log message *** 1985-02-12 14:20:30 +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 cd78a1a27a case 8 and case 6 deleted in switch of function 'prolog' 1985-01-21 14:17:11 +00:00
garde d8d2068664 Initial revision 1985-01-17 14:31:34 +00:00