Commit graph

149 commits

Author SHA1 Message Date
David Given 511c3e99ee Fix a whole bunch of warnings. 2022-08-01 22:08:23 +02:00
David Given 5c2f190c29 Lots of binary mode flags. 2022-07-17 12:58:48 +02:00
David Given 25b6712e63 Rework all the ackbuilder scripts not to use wildcards, because we can't expand
them without luaposix, which isn't available (easily) on OSX or Windows.
2022-07-14 23:57:54 +02:00
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
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 67a9be26d1 Fix warnings. 2019-02-07 09:09:31 +01:00
David Given 53f7de794a Ansify. 2018-09-10 22:55:05 +02:00
David Given 911ce7ceb5 Crudely tweak some of the prototypes to please clang, which is pickier about
K&R C than gcc is.
2018-06-02 21:31:18 +02:00
George Koehler 24abaf6a25 Enable conditional expressions in splitting coercions.
ncgg has parsed the optional conditional expression (optexpr) of each
splitting coercion since commit 72b83cc in 1985; but for almost 33
years, ncg has ignored the expression in c2_expr.

Few tables had conditional coercions (I only found them in arm and
m68020), and no tables had conditional splitting coercions, so this
only becomes a problem now as I try to add a conditional splitting
coercion to powerpc.
2017-12-18 20:39:56 -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
George Koehler e04166b85d More prototypes, less register in mach/proto/ncg
Files that #include "equiv.h" must do so after including "data.h", now
that a function prototype in equiv.h uses type rl_p from data.h.

Adjust style, changing some `for(...)` to `for (...)`.  The style in
mach/proto/ncg is less than consistent; the big annoyance now is that
some files want tabs at 4 spaces, others want tabs at 8 spaces.
2017-11-13 12:44:17 -05:00
George Koehler 909b0d5bf3 Add prototypes to functions in subr.c
Put the declarations in "data.h", because that header declares the
types cost_t and token_p.  Also #include <cgg_cg.h> from "data.h" to
get types c3_p and set_p, and guard <cgg_cg.h> against multiple
inclusion.
2017-11-12 16:11:05 -05:00
George Koehler ba2a45180c Prototypes for string functions. More static. 2017-11-12 11:25:18 -05:00
George Koehler 98b27dd505 Remove old "assert.h" in mach/proto/ncg
*Important:*  You must "make clean" after checking out this commit,
because the build had copied the old "assert.h" to several places in
obj/.  If you don't "make clean", then the compiler finds the old
"assert.h" before libc <assert.h>, and the build fails because this
commit removes badassertion() in subr.c.  After "make clean", the
compiler finds libc <assert.h> and the build succeeds.
2017-11-11 19:35:48 -05:00
George Koehler 2a92f9bf4d Add a few more error checks and adjustments to reglap.
In util/ncgg, add two more errors for tables using reglap:
 - "Two sizes of reg_float can't be same size"
 - "Missing reg_float of size %d to contain %s"

In mach/proto/ncg, rename macro isregvar_size() to PICK_REGVAR(), so
the macro doesn't look like a function.  This macro sometimes doesn't
evaluate its second argument.

In mach/powerpc/ncg/mach.c, change type of lfs_set to uint32_t, and
change the left shifts from 1U<<regno to (uint32_t)1<<regno, because
1U would be too small for machines with 16-bit int.
2017-10-18 22:00:12 -04:00
George Koehler 307a8b996e Add regvar_w() and regvar_d() for use with reglap.
If the ncg table uses reglap, then regvar($1, reg_float) would have
two sizes of registers.  An error from ncgg would happen if regvar()
was in a token that allows only one size.  Now one can pick a size
with regvar_w() for word size or regvar_d() for double-word size.

Add regvar_d and regvar_w as keywords in ncgg.  Modify EX_REGVAR to
include the register size.  In ncg, add some checks for the register
size.  In tables without reglap, regvar() works as before, and ncg
ignores the register size in EX_REGVAR.
2017-10-17 12:05:41 -04:00
George Koehler aa876ff4c2 Fix reglap for procedures that use both sizes of reg_float.
After the RA phase of ego, a procedure may put single-word and
double-word values in the same reg_float.  Then ncg will use both
LOCAL and DLOCAL tokens at the same offset.

I add isregvar_size() to ncg.  It receives the size of the LOCAL or
DLOCAL token, and picks the register of the correct size.  This fixes
a problem where ncg got the wrong-size register and corrupted the
stack.  This problem caused one of my test programs to segfault from
stack underflow.

Also adjust how fixregvars() handles both sizes.
2017-10-15 13:15:03 -04:00
George Koehler b342b83d28 Add function prototypes to mach/proto/ncg/regvar.c 2017-10-15 11:01:18 -04:00
George Koehler 7e9348169c Add reglap to ncg. Add 4-byte reg_float to PowerPC ncg.
The new feature "reglap" allows two sizes of floating-point register
variables (reg_float), if each register overlaps a single register of
the other size.  PowerPC ncg uses reglap to define 4-byte instances
of f14 to f31 that overlap the 8-byte instances.

When ncgg sees the definition of fs14("f14")=f14, it removes the
8-byte f14 from its rvnumbers array, and adds the 4-byte fs14 in its
place.  Later, when ncg puts a variable in fs14, if it is an 8-byte
variable, then ncg switches to the 8-byte f14.  The code has
/* reglap */ comments in util/ncgg or #ifdef REGLAP in mach/proto/ncg

reglap became necessary because my commit a20b87c caused PowerPC ego
to allocate reg_float in both 4-byte and 8-byte sizes.
2017-10-14 12:40:04 -04:00
George Koehler aa47f52166 Switch error() and fatal() in mach/proto/ncg to stdarg.
This is like David Given's change to util/ncgg in d89f172.  I need
this change in mach/proto/ncg to see fatal messages, because a 64-bit
pointer doesn't fit in an int.
2017-02-16 20:26:53 -05:00
David Given c471f617b7 Ensure that memory is zero-initialised. 2017-01-16 22:45:03 +01:00
David Given 2cdcc16bc2 Fix a buffer overrun that was manifesting on OpenBSD; also fix a bounds check and some uninitialised variable problems. 2017-01-16 22:44:37 +01:00
David Given fa5675d439 Run through clang-format. 2017-01-16 21:16:33 +01:00
David Given d82df74a7a Rename addr_t to address_t to avoid clashes with the system addr_t. 2016-11-11 20:17:10 +01: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
George Koehler 65c2a8a0ae Remove stackadjust and stackoffset() from ncg.
This feature has never been used since its introduction, more than 3
years ago, in David Given's commit c93cb69 of May 8, 2013.  The commit
was for "PowerPC and M68K work".  I am not undoing the entire commit.
I am only removing the stackadjust and stackoffset() feature.

This commit removes the feature from my branch kernigh-linuxppc.  This
removal includes the mach/proto/ncg parts.  The default branch already
removed most of the feature, but kept the mach/proto/ncg parts.  That
removal happened in commit 81778b6 of May 13, 2013 (which was a merge;
git diff af0dede 81778b6).  The branch dtrg-experimental-powerpc
merged the default branch but without the removal.  That merge was
commit 4703db0f of Sep 15, 2016 (git diff 8c94b13 4703db0).  My branch
kernigh-linuxppc is off branch dtrg-experimental-powerpc, so I can no
longer get the removal by merging default.

David Given described the stackadjust feature in
  https://sourceforge.net/p/tack/mailman/message/30814691/

The instruction stackadjust would add a value to the offset, and the
function stackoffset() would return this offset.  One would use this
to track sp - fp, then omit the frame pointer by not keeping fp in a
register.
2016-10-07 20:52:13 -04: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 612e38f1c6 Remove the old make-based build system, plus some big chunks of horribly
obsolete protomake build system.
2016-09-02 22:17:51 +02:00
David Given 4d24666432 Move util/data into modules/src/em_data, for consistency with the other
modules.
2016-08-14 14:09:38 +02:00
David Given 38fa6941d5 linux68k builds now. 2016-08-14 11:34:18 +02:00
David Given b50dc4214a Add check for undefined variables. Find undefined variables. Fix undefined
variables.
2016-08-05 00:01:55 +02:00
David Given 5e84be70fd Massive ackbuilder refactor --- cleaner and more expressive. Lists
are automatically flattened (leading to better build files), and the
list and filename functions are vastly more orthogonal.
2016-08-04 23:51:19 +02:00
David Given a8a9d1bbfa yacc, ncgg; platform ncg builds now. 2016-07-26 23:35:30 +02:00
David Given 88bd7ce126 Remove defunct pmfiles.
--HG--
branch : default-branch
2016-06-03 13:56:50 +02:00
David Given ff0c78cc78 Merge from default.
--HG--
branch : dtrg-videocore-branch-branch
2016-03-13 21:13:09 +01:00
David Given 3d5e72e20b Newer versions of GNU Make have a new function which collides with a
variable we're using; change the name of the variable.
2015-03-22 12:09:46 +01:00
David Given a46ee91859 Fix warning.
--HG--
branch : dtrg-videocore
2013-05-19 23:18:36 +01:00
David Given e5f6d5acfa Fix buffer overrun looking up type information for op_lab pseudoops (as
they're not EM opcodes, we shouldn't look them up in em_flags!).
2013-05-16 22:02:59 +01:00
David Given 11377070fd Update distribution files.
--HG--
branch : dtrg-buildsystem
2013-05-15 23:46:15 +01:00
David Given 8fbce949f5 Now describe the make-based build system in the README.
--HG--
branch : dtrg-buildsystem
2013-05-15 23:12:05 +01:00
David Given a68b117e96 Add missing dependency.
--HG--
branch : dtrg-buildsystem
2013-05-14 14:55:29 +01:00
David Given 07453d184a Top, topgen, aelflod. Moved the libraries back into the platform-specific
directories --- wrangling descr files was too hard. C programs can be built
for cpm, pc86, linux386, linux68k!

--HG--
branch : dtrg-buildsystem
rename : util/ack/build.mk => util/led/build.mk
rename : util/LLgen/build.mk => util/topgen/build.mk
2013-05-13 23:26:15 +01:00
David Given 442306d557 Split off some of the platform-independent stuff (such as as and ncg).
--HG--
branch : dtrg-buildsystem
rename : plat/pc86/build.mk => mach/i386/build.mk
rename : plat/pc86/build.mk => mach/i80/build.mk
rename : plat/pc86/build.mk => mach/i86/build.mk
rename : plat/pc86/build.mk => mach/m68020/build.mk
rename : plat/pc86/build.mk => mach/powerpc/build.mk
2013-05-13 22:12:46 +01:00
David Given b0c238eb5d Made a start on building the runtimes for each platform and language; the
Linuxes all build.

--HG--
branch : dtrg-buildsystem
rename : modules/src/em_mes/build.mk => modules/src/read_em/build.mk
rename : plat/pc86/build.mk => plat/linux386/build.mk
rename : plat/pc86/build.mk => plat/linux68k/build.mk
rename : plat/pc86/build.mk => plat/linuxppc/build.mk
rename : util/ack/build.mk => util/misc/build.mk
2013-05-12 23:51:55 +01:00
David Given c1aca7dae5 First milestone of replacing the build system.
--HG--
branch : dtrg-buildsystem
rename : lang/cem/cpp.ansi/Parameters => lang/cem/cpp.ansi/parameters.h
2013-05-12 20:45:55 +01: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
dtrg b611731ec3 Updated .distr files for the new release. 2007-02-25 12:51:55 +00:00
dtrg 5c5f711cbb Done a major overhaul of the way target include files are installed and
how platform libraries are built. The ARCH pm variable has now been
renamed PLATFORM (which is more accurate) and a different ARCH
variable added, which represents the CPU family rather than the
hardware platform.
2007-02-20 00:46:10 +00:00
dtrg c21ba9ed0f Updated to work with the new version of pm. 2006-11-11 22:59:52 +00:00