Commit graph

132 commits

Author SHA1 Message Date
George Koehler 7ab4794a05 Reduce clang warnings from ncg
If a .c file included "types.h" before "mach.h", then it missed the
declaration of mach_option().  Fix by adding "xmach.h".

Fix mach/powerpc/ncg/mach.h and mach/vc4/ncg/mach.h to use the correct
type in their printf() format strings.
2019-10-30 18:36:55 -04:00
George Koehler 36f16b0cb8 Cut down some clang warnings
Edit C code to reduce warnings from clang.  Most warnings are for
implicit declarations of functions, but some warnings want me to add
parentheses or curly braces, or to cast arguments for printf().

Make a few other changes, like declaring float_cst() in h/con_float to
be static, and using C99 bool in ego/ra/makeitems.c and
ego/share/makecldef.c.  Such changes don't silence warnings; I make
such changes while I silence warnings in the same file.  In
float_cst(), rename parameter `str` to `float_str`, so it doesn't
share a name with the global variable `str`.

Remove `const` from `newmodule(const char *)` in mach/proto/as to
silence a warning.  I wrongly added the `const` in d347207.

For warnings about implicit declarations of functions, the fix is to
declare the function before calling it.  For example, my OpenBSD
system needs <sys/wait.h> to declare wait().

In util/int, add "whatever.h" to declare more functions.  Remove old
declarations from "mem.h", to prefer the newer declarations of the
same functions in "data.h" and "stack.h".
2019-10-30 18:36:38 -04:00
George Koehler 0b0c3d5b60 Add csa 8, csb 8 for i386, m68020.
This allows `long long x; switch (x) {...}` in C.  Add test in C.

This adapts the code for csa 8 and csb 8 from the existing code for
csa 4 and csb 4, for both i386 and m68020.
2019-09-27 12:15:10 -04:00
George Koehler e867861f6d Add 8-byte long long for linux68k.
Add rules for 8-byte integers to m68020 ncg.  Add 8-byte long long to
ACK C on linux68k.  Enable long-long tests for linux68k.  The tests
pass in our emulator using musahi; I don't have a real 68k processor
and haven't tried other emulators.

Still missing are conversions between 8-byte integers and any size of
floats.  The long-long tests don't cover these conversions, and our
emulator can't do floating-point.

Our build always enables TBL68020 and uses word size 4.  Without
TBL68020, 8-byte multiply and divide are missing.  With word size 2,
some conversions between 2-byte and 8-byte integers are missing.

Fix .cii in libem, which didn't work when converting from 1-byte or
2-byte integers.  Now .cii and .cuu work, but also add some rules to
skip .cii and .cuu when converting 8-byte integers.  The new rule for
loc 4 loc 8 cii `with test_set4` exposes a bug: the table may believe
that the condition codes test a 4-byte register when they only test a
word or byte, and this incorrect test may describe an unsigned word or
byte as negative.  Another rule `with exact test_set1+test_set2` works
around the bug by ignoring the negative flag, because a zero-extended
word or byte is never negative.

The old rules for comparison and logic do work with 8-byte integers
and bitsets, but add some specific 8-byte rules to skip libem calls or
loops.  There were no rules for 8-byte arithmetic, shift, or rotate;
so add some.  There is a register shortage, because the table requires
preserving d3 to d7, leaving only 3 data registers (d0, d1, d2) for
8-byte operations.  Because of the shortage, the code may move data to
an address register, or read a memory location more than once.

The multiplication and division code are translations of the i386
code.  They pass the tests, but might not give the best performance on
a real 68k processor.
2019-09-24 13:32:17 -04:00
George Koehler 1faff418ec Teach some ncg machines to use .data8
This turns EM `con 5000000000I8` into assembly `.data8 5000000000` for
machines i386, i80, i86, m68020, powerpc, vc4.  These are the only ncg
machines in our build.

i80 and i86 get con_mult(sz) for sz == 4 and sz == 8.  The other
machines only get sz == 8, because they have 4-byte words, and ncg
only calls con_mult(sz) when sz is greater than the word size.  The
tab "\t" after .data4 or .data8 is like the tabs in the con_*() macros
of mach/*/ncg/mach.h.

i86 now uses .data4, like i80.  Also, i86 and i386 now use the numeric
string without converting it to an integer and back to a string.
2019-08-13 15:37:05 -04:00
David Given 94867d24b7 Ensure that procedure labels are word aligned (required by the EM spec). 2019-06-17 22:26:31 +02:00
George Koehler 760da1f421 Fix build with gcc.
gcc gave an error because the `char *` parameter doesn't match the
`const char *` in the prototype of regsave().  clang didn't give an
error.  I added the prototype in commit 5301cce.
2017-11-17 17:52:37 -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
David Given 38fa6941d5 linux68k builds now. 2016-08-14 11:34:18 +02:00
David Given c93cb69959 Check in incomplete Linux PowerPC and M68K work.
--HG--
branch : dtrg-experimental-powerpc
2013-05-08 00:48:48 +01: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
ceriel 384c4bc698 Fixed bug with 4-byte sets on 2-byte machines 1998-09-03 12:51:38 +00:00
ceriel 1db6a3029b Header --> Id 1994-06-24 14:02:31 +00:00
ceriel 17efc329f8 Separated the m68020 syntax from the table, so that we can also create
a m68000 code generator producing m68020 syntax
1992-11-16 17:24:25 +00:00
ceriel d18493b0ac Some minor modifications reflecting some changes in the peephole optimizer 1992-09-01 10:19:21 +00:00
ceriel b2cca56e16 Accept -gdb option 1992-03-27 17:36:49 +00:00
ceriel 53c4951b29 Do not use '#endif/#else xxx'; it is not allowed for ANSI C 1991-12-17 15:05:43 +00:00
ceriel a1fc266ca5 Same for mach.h 1991-09-18 19:19:35 +00:00
ceriel 998d11379c whichone.h in <> so that -I option determines which one to take 1991-09-18 18:23:36 +00:00
ceriel 564cbc6eba Only call NOP routine when debugging table 1991-09-04 10:55:52 +00:00
ceriel bbb4d40669 Include whichone.h with <> so that the -I options decide which one is included 1991-08-28 14:13:14 +00:00
ceriel c7edcc34d6 New installation mechanism 1991-08-27 10:47:25 +00:00
ceriel e4136ac8e5 There was no RCK 2 due to a preprocessor-directive error 1991-04-24 14:09:20 +00:00
ceriel 2fef7f7389 Added LOS 4 and STS 4 1991-04-19 12:02:52 +00:00
ceriel 8b67c1f800 Fix to fix 1991-03-25 13:16:02 +00:00
ceriel 043ad764b8 Yet another fix: this time for AND/IOR/XOR/COM ? 1991-03-25 11:39:27 +00:00
ceriel 6f4da1d70a bug fix for SET instruction on m68k2 1991-03-22 18:23:55 +00:00
ceriel 0d65b92220 removed -i flag 1991-02-19 16:57:39 +00:00
eck 530e1a3b6d fixed error for m68k2 1990-12-13 08:31:44 +00:00
eck cb6ca0cf40 fixed nasty bug with sets that were used in kill-parts 1990-12-12 17:17:04 +00:00
ceriel d9be4de96a Fixed RMU 4 1990-12-07 11:25:45 +00:00
ceriel fb143bcdb5 Some corrections and simplifications 1990-11-16 16:31:40 +00:00
ceriel ba69e4279d Added support for DBX; Unfortunately, DBX still does not like it; GDB does 1990-11-13 17:00:51 +00:00
eck cc04440b5c added patterns 1990-11-13 10:03:55 +00:00
eck 05ddeafbfd fixed labeldefs so that registers are killed
replaced 'cms <w>' bij 'cmi <w>'
1990-10-29 17:05:35 +00:00
eck 54cc752a9e fixed bugs with ext_[wl] arguments, changed reusage of registers 1990-10-26 16:52:43 +00:00
eck bd4bc1cad0 replaced some move's by move_i's 1990-09-14 14:30:07 +00:00
eck ee652e6908 changed stacheight to topeltsize 1990-09-04 17:13:37 +00:00
eck bee5d97eac fixed some bugs in new pattern 1990-08-28 15:01:17 +00:00
eck dc500c3463 fixed some strange constructions 1990-08-24 16:20:57 +00:00
eck 0bf7d60080 several improvements + fixes 1990-08-22 16:26:21 +00:00
eck b4a2b975a0 added m68k2 stuff, added patterns 1990-08-20 13:55:38 +00:00
eck 4ef2c70ed3 added stackheight message handling 1990-07-18 14:53:19 +00:00
ceriel 56858bb480 bug fix: wrong procedure was called 1990-06-27 09:29:55 +00:00
ceriel 74147d2b4a ignore NOP 1990-05-17 19:40:15 +00:00
ceriel f95fae24fc moved a coercion 1990-04-23 13:38:19 +00:00
ceriel 3553a28b78 fix: still sometimes assumed that a move to address register sets condition codes 1990-03-26 14:47:26 +00:00
ceriel 9d4e978a1e fixed problems with overflow bit in condition codes 1990-02-27 16:21:47 +00:00