Commit graph

42 commits

Author SHA1 Message Date
George Koehler e841adf970 Fix END pseudo in util/ego/sr; closes #203
The strength reduction (SR) phase mishandled the END pseudo when SR
found at least 2 different expressions in the same loop, and SR made a
new header for the loop.

Since 1987 (commit 159b84e), SR appended the new header to the end of
the procedure.  Later, SR fixed the header by adding a BRA branch to
the loop's entry, and moving the END pseudo from the previous basic
block to the header.  If SR found multiple expressions, it called
fix_header() multiple times, and tried to move the END again.  The
extra move failed assert(INSTR(e) == ps_end), or moved another line
after the END, so opt2 (the peephole optimizer) would crash.

Fix by removing fix_header() and moving the code to make_header(), so
SR adds the BRA and moves the END when it makes the header, and does
so only once for each header.

Adjust init_code(), which inserts code into a header.  Stop checking
for an empty header, because make_header() now adds BRA.  After
inserting code before BRA, don't move LP_INSTR, because later
insertions should go before BRA, not after END.
2019-11-15 11:50:05 -05:00
George Koehler 17bc9cdef7 More void, fewer clang warnings in util/ego
Most warnings are for functions implicitly returning int.  Change most
of these functions to return void.  (Traditional K&R C had no void
type, but C89 has it.)

Add prototypes to most function declarations in headers.  This is
easy, because ego declares most of its extern functions, and the
comments listed most parameters.  There were a few outdated or missing
declarations, and a few .c files that failed to include an .h with the
declarations.

Add prototypes to a few function definitions in .c files.  Most
functions still have traditional K&R definitions.  Most STATIC
functions still don't have prototypes, because they have no earlier
declaration where I would have added the prototype.

Change some prototypes in util/ego/share/alloc.h.  Functions newmap()
and oldmap() handle an array of pointers to something; change the
array's type from `short **` to `void **`.  Callers use casts to go
between `void **` and the correct type, like `line_p *`.  Function
oldtable() takes a `short *`, not a `short **`; I added the wrong type
in 5bbbaf4.

Make a few other changes to silence warnings.  There are a few places
where clang wants extra parentheses in the code.

Edit util/ego/ra/build.lua to add the missing dependency on ra*.h; I
needed this to prevent crashes from ra.
2019-11-01 15:27:16 -04:00
David Given 9e2d45b301 Rename all files called 'aux.*' to something else; Windows can't handle them. 2019-02-09 00:02:41 +01:00
David Given d1cbb9cf60 Crudely bounds check some naked fscanf("%s") parsing. Fixes #79, mostly. 2018-06-02 20:51:41 +02:00
George Koehler 9037d137f5 Add prototypes, void in util/ego/share
This uncovers a problem in il/il_aux.c: it passes 3 arguments to
getlines(), but the function expects 4 arguments.  I add FALSE as the
4th argument.  TRUE would fill in the list of mesregs.  IL uses
mesregs during phase 1, but this call to getlines() is in phase 2.
TRUE would leak memory unless I added a call to Ldeleteset(mesregs).
So I pass FALSE.

Functions passed to go() now have a `void *` parameter because
no_action() now takes a `void *`.
2017-11-15 17:19:56 -05:00
George Koehler 87a2315037 strcmp, strncmp are in <string.h>
*Important:*  Do `make clean` to work around a problem and prevent
infinite rebuilds, https://github.com/davidgiven/ack/issues/68

I edit tokens.g in util/LLgen/src, so I regenerate tokens.c.  The
regeneration script bootstrap.sh can't find LLgen, but I can run the
same command by typing the path to llgen.
2017-11-14 17:35:35 -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 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 e9233b4712 Build ego.
--HG--
branch : dtrg-buildsystem
rename : util/arch/build.mk => util/ego/build.mk
2013-05-15 21:14:06 +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
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 f371b251d2 Rationalised use of #includes to be more standards-compliant. 2006-07-22 00:46:16 +00:00
dtrg d220081198 Changed to declare symbols as extern rather than just mentioning
them without qualification.
2006-07-22 00:45:51 +00:00
ceriel 5c83e7dbb5 Header --> Id 1994-06-24 11:31:16 +00:00
ceriel 0eb2e0dc80 Fix previous 'fix' 1992-07-23 11:51:39 +00:00
ceriel 7c7475bb3a fixed lint complaint 1992-07-21 14:40:23 +00:00
ceriel 45d0d9f68f Removed # in commands 1992-06-26 12:54:57 +00:00
ceriel 35dc8e74d0 Improved lint entry 1991-10-29 09:26:01 +00:00
ceriel d9f98bc411 New installation mechanism 1991-08-27 10:18:09 +00:00
ceriel 27d53b0d33 Changed #include's 1991-03-05 12:44:05 +00:00
ceriel 79cb35ec4f Added SLI reduce 1991-02-19 16:45:57 +00:00
ceriel b3ff76d859 Changed lint flags 1990-12-17 13:52:53 +00:00
ceriel 86ace8a020 Fixed lintflags 1989-02-09 11:33:11 +00:00
ceriel 627d2060cd Added some code to reduce SLI, then decided against it 1988-06-22 10:41:52 +00:00
ceriel 102a2b1061 don't optimize when ms_gto 1987-10-02 12:52:29 +00:00
ceriel 040495ff56 fixed another bug with header blocks, and modified to use existing header
block when possible
1987-08-05 09:46:38 +00:00
ceriel 159b84ef68 bug fixes: put header block at end of procedure 1987-08-04 14:13:24 +00:00
ceriel 81b1d21c35 Initial revision 1987-04-13 10:32:47 +00:00
ceriel 6eaf182cee Added Rcs Id 1987-03-10 11:49:39 +00:00
ceriel 815166e421 Added copyright notice 1987-03-09 19:15:41 +00:00
ceriel bc1fb58cd6 SHARE --> SHR 1987-03-02 12:42:38 +00:00
ceriel 876369b2f1 Added standard entries 1987-01-13 10:30:06 +00:00
bal d5098fe70f Bug fixed: co_lfirst received wrong value for multiply-optimization. 1985-02-25 14:03:09 +00:00
bal cac6ffd8c2 ovfl_harmful and arrbound_harmful turned into ints 1985-01-23 16:25:29 +00:00
bal d32d4e6ba0 Interface of tmplocal() changed: second parameter is a long now 1985-01-23 16:23:15 +00:00
bal ffb167e8b2 lay-out enhanced; flags (CFLAGS etc.) inherited from central Makefile;
entry for compiling this phase with ack -O created.
1984-12-21 14:41:47 +00:00
bal 39891edd12 Declarations for iv and code_info added (moved from types.h).
core allocation macros added.
1984-11-30 10:27:05 +00:00
bal a6d53a6bcd "ivars" was renamed "ivvars" to avoid name conflict with sr_expr.c 1984-11-27 15:30:34 +00:00
bal df200afd46 cleaned up 1984-11-27 15:04:04 +00:00
bal 6a9e49f683 Initial revision 1984-11-26 14:51:59 +00:00