Commit graph

1846 commits

Author SHA1 Message Date
carl 5ec9de401d * More ANSI C portability fixes. 2019-03-24 23:53:13 +08:00
carl f7e4fac687 Revert "* Adapt to more ANSI C"
This reverts commit da0e0ac257.
2019-03-24 23:39:04 +08:00
carl a58ad2bc31 * Adapt to more ANSI C 2019-03-24 23:36:52 +08:00
carl da0e0ac257 * Adapt to more ANSI C 2019-03-24 23:35:59 +08:00
carl 56e64a1fd0 Merge remote-tracking branch 'upstream/default' into carl-ansi-part1
# Conflicts:
#	util/arch/archiver.c
#	util/led/finish.c
#	util/led/output.c
2019-03-24 21:42:56 +08:00
carl 9b6e1774ea ANSI C version
More portability fixes.
2019-03-24 17:37:49 +08:00
carl 53fa893738 ANSI C version
More portability fixes.
2019-03-24 17:11:56 +08:00
carl 7063301f8c Add additional defines for compilation. 2019-03-24 17:09:29 +08:00
carl 086a2ac9ab Add additional defines for compilation. 2019-03-24 17:09:12 +08:00
carl c5f5bace63 Add additional defines for compilation. 2019-03-24 17:08:45 +08:00
George Koehler bec236c108 Include more headers to declare functions.
This causes clang to give fewer warnings of implicit declarations of
functions.

In mach/pdp/cv/cv.c, rename wr_int2() to cv_int2() because it
conflicts with wr_int2() in <object.h>.

In util/ack, rename F_OK to F_TRANSFORM because it conflicts with F_OK
for access() in <unistd.h>.
2019-03-22 15:59:35 -04:00
George Koehler dd328215d8 Use %zu to print size_t count
This silences a compiler warning.
2019-03-22 14:09:50 -04:00
carl b3814af1ba * Bugfix of "rename" across volumes, now simply copies the file instead. 2019-03-17 23:19:16 +08:00
carl 8b525f59c3 + ANSI C conversion 2019-03-17 22:46:32 +08:00
carl 3ac4504a5a + ANSI C conversion 2019-03-17 22:46:32 +08:00
carl 5a18b85b3f + ANSI C conversion 2019-03-17 22:46:32 +08:00
carl 75909230c9 + ANSI C conversion 2019-03-17 22:46:32 +08:00
carl f7ba3eec50 Remove CMake changes and generic sed scripts so they are move to a separate branch. 2019-02-21 00:43:04 +08:00
carl d825e962ed Better ANSI C compatibility and portability:
+ Addition of function prototypes and include files.
+ Change function definitions to ANSI C style.
+ Initial support for CMake
2019-02-19 00:54:24 +08:00
carl cc27fd471d Better ANSI C compatibility and portability:
+ Addition of function prototypes and include files.
+ Change function definitions to ANSI C style.
+ Initial support for CMake
.
2019-02-19 00:54:23 +08:00
carl e70690c510 + Addition of scripts to generate compiler include files. 2019-02-19 00:54:23 +08:00
carl 910643ccbb Better ANSI C compatibility and portability:
+ Addition of function prototypes and include files.
+ Change function definitions to ANSI C style.
+ Initial support for CMake
2019-02-19 00:54:23 +08:00
carl 10717cc791 Better ANSI C compatibility and portability:
+ Addition of function prototypes and include files.
+ Change function definitions to ANSI C style.
- Remove support for generating K&R code.
- Remove mkstemp and replace by tmpnam (more portable but less safe)
2019-02-19 00:54:23 +08:00
carl 42bbdec82d Better ANSI C compatibility and portability - part 1:
+ Addition of function prototypes.
+ Change function definitions to ANSI C style.
2019-02-19 00:54:23 +08:00
carl f49a5a24f7 * Initial support of CMake 2019-02-19 00:54:23 +08:00
carl 58d0c33784 * Initial support of CMake 2019-02-19 00:54:23 +08:00
David Given 245478a030 Fix memory corruption when using -R; the values being stored in the list
weren't freeable when they should have been.
2019-02-15 23:40:42 +01:00
David Given e976e10708 Reformat before editing. 2019-02-15 23:24:10 +01:00
David Given 813595358c More common symbol removal. 2019-02-10 14:09:52 +01:00
David Given d37749750d More common symbol fixing. 2019-02-10 14:03:55 +01:00
David Given 58698bed19 Removed a whole bunch of old strcpy() prototypes in favour of <string.h>. 2019-02-10 13:20:04 +01:00
David Given c8c48221b3 Second try at removing common symbols. 2019-02-10 13:11:03 +01:00
David Given 8a7077d5a9 Change the way external symbols are defined to avoid COMMON symbols, which
don't work on OSX very well.
2019-02-10 12:57:22 +01:00
David Given 020e910560 Remember that we need to update the generated file in LLgen, as it's not
self-bootstrapping...
2019-02-10 12:38:33 +01:00
David Given 65e544c35a Don't prototype strcpy as it makes OSX sad. 2019-02-10 12:28:42 +01: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 80bfbd17b7 Add missing file. 2019-02-07 23:01:10 +01:00
David Given 7473601172 Add the cpm emulator from Cowgol, modified to work with an 8080 emulator rather
than libz80ex; enable tests for cpm.
2019-02-07 22:39:57 +01:00
George Koehler 33c0573598 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.
2018-11-14 16:13:54 -05:00
George Koehler 1c8434e33a 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.*).
2018-11-14 15:15:45 -05:00
George Koehler 4fdfa3177e 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.
2018-11-14 12:35:38 -05:00
George Koehler f09f14cd4d 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).
2018-11-14 12:33:25 -05:00
George Koehler df855248a0 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
2018-11-05 15:14:29 -05:00
David Given bbb708717a 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.
2018-09-22 11:19:00 +02:00
David Given ba0849c87c Remove la; turns out that the assembler gets upset if you ask it to
generate more than one fixup per instruction (I think).
2018-09-14 11:30:15 +02:00
David Given ac33bdd031 Clang-format before editing. 2018-09-14 09:28:35 +02:00
David Given 5264db860d Values are more useful shown in hex. 2018-09-11 23:17:09 +02:00
David Given ee328a0572 Merge from default. 2018-09-09 18:58:07 +02:00
David Given ec46643124 Allow the ELF processor flags to be set. Generate MIPS ELF executables, not
PowerPC ones.
2018-09-09 14:29:34 +02:00
David Given 5dfef6f180 Rework relocations again: add RELO2HI and RELO2HISAD for the high two bytes of
a word.
2018-09-09 14:11:11 +02:00
David Given b3b7c684c6 Simplify MIPS relocations. Add RELS2 (for generic high-word relocations). Add
support for MIPS branch-and-jump relocations.
2018-09-09 12:23:59 +02:00
David Given 83cf1be6a8 mcgg now checks that registers have at most one type attribute set. 2018-09-03 22:03:57 +02:00
David Given a023fd8591 Better error reporting for unterminated strings. 2018-09-02 18:55:44 +02:00
David Given 5f83fd85dc Don't try to use acct() on cygwin (which doesn't support it). Fixes: #111 2018-09-01 10:41:31 +02:00
David Given 205c8d0a35 Run through clang-format. 2018-06-23 23:46:44 +02:00
David Given a0c6fea32c Replace fake-varargs, which doesn't work on 64-bit machines, with real varargs. 2018-06-22 22:29:52 +02:00
David Given 60b7d8de6e
Merge pull request #96 from kernigh/kernigh-emu-1
Fixes to build emulators, ass, int on OpenBSD
2018-06-20 22:30:01 +02:00
David Given 6ae38887a7 It appears that the parameter to lol technically has to be word aligned; having
a non-word aligned parameter is illegal (but most of the toolchain accepts it).
So, word align data structures for em22.
2018-06-12 20:54:15 +09:00
George Koehler a000c62808 Get moncalls.c to compile on OpenBSD.
Remove some declarations (not all correct) and #include <errno.h>,
<time.h>, and <unistd.h> to get the correct declarations.

Disable mount(2), umount(2), and stime(2) because BSD (around
4.3BSD-Reno) lost compatibility with these Unix v7 functions.
2018-06-10 19:05:42 -04:00
George Koehler 250777d1ca Rename setmode() to set_mode() to avoid BSD prototype.
4.4BSD added a non-standard function setmode() to <unistd.h>; its
prototype is not compatible.
2018-06-10 19:04:51 -04:00
David Given d623440c77 Add the core of a simple em22 platform. Unfortunately it doesn't work; the old
em libmon vanished decades ago (or never existed), and also ass appears to have
a different idea of what the em opcodes are to everything else and gets
confused.
2018-06-10 20:25:48 +09:00
David Given e7124f3e3f File cleanup. 2018-06-09 21:21:28 +09:00
David Given a12181748b Make ass and int built with clang --- surprisingly easy. 2018-06-09 21:18:50 +09:00
David Given 59b383afd0 Make the em interpreter build --- again, lots of warnings, so it probably won't
work on clang. I have no idea whether it runs or not as building a e.out
program is quite hard and needs a special platform.
2018-06-09 21:13:31 +09:00
David Given d10a594c04 Get ass running --- it's very K&R and almost certainly won't build on clang,
but it works on gcc.
2018-06-09 14:10:45 +09:00
David Given 9dede01efe Fix bogus test.
Fixes: #89.
2018-06-05 09:41:31 +09:00
David Given 342a321c87 Fix bogus test.
Fixes: #90
2018-06-05 09:20:46 +09:00
David Given d1cbb9cf60 Crudely bounds check some naked fscanf("%s") parsing. Fixes #79, mostly. 2018-06-02 20:51:41 +02:00
David Given 05ddefad65 Adopt a copy of Minix 2's ed; this allows the ACK's antiquated ed scripts to
run with a minimum of tweaking. Rewriting them for modern ed looks really hard.

Fixes: #84
2018-06-02 18:02:51 +02:00
David Given aabf0bdd69
Merge pull request #73 from kernigh/kernigh-pr
better code from PowerPC ncg and mcg
2018-03-13 13:57:28 +01:00
George Koehler 85fcbde22f Check LOI expressions to prevent a read after free.
CS eliminates outer expressions before inner ones, as `x * y * z`
before `x * y`.  It does this by reversing the order of expressions in
the code.  This almost always works, but it sometimes doesn't work if
a STI changes the value number of a LOI.  In code like `expr1 LOI
expr2 STI expr2 LOI`, CS might eliminate the inner `expr2` before the
outer `expr2 LOI`.  This caused a read after free because the
occurrence of `expr2 LOI` pointed to the eliminated lines of `expr2`.

This bug went unnoticed until my recent changes caused CS to crash
with a double free.  I did not get the crash in OpenBSD, but I saw the
crash in Travis, then David Given reproduced the crash in Linux.  See
the discussion in https://github.com/davidgiven/ack/pull/73
2018-03-12 20:58:31 -04:00
George Koehler ebba76e08f Don't read INSTR(l) after oldline(l) frees it.
This bug got in my way while I was looking for another read-after-free
bug in the CS phase.
2018-03-11 20:10:13 -04:00
David Given 4cb4bdc85f There are two places where names are added to the global symbol table; one via
the -U command line option, and one via file scanning. Turns out only the
second would increment the number of global names, so adding names with -U
would cause names found via scanning to fall off the end of the list! This
wouldn't cause linker errors because fixups don't use the list, but would cause
the generated symbol table in the output to be incorrect.
2018-03-11 12:37:23 +01:00
George Koehler 12643f1740 Solve some gcc warnings in ego.
Some of these are from gcc -Wimplicit
2018-03-08 18:51:07 -05:00
George Koehler b1b737ed6c Optimize procedures that do both a / b and a % b.
Enable this in CS for PowerPC; disable it for all other machines.
PowerPC has no remainder instruction; the back end uses division to
compute remainder.  If CS finds both a / b and a % b, then CS now
rewrites a % b as a - b * (a / b) and computes a / b only once.  This
removes an extra division in the PowerPC code, so it saves both time
and space.

I have not considered whether to enable this optimization for other
machines.  It might be less useful in machines with a remainder
instruction.  Also, if a % b occurs before a / b, the EM code gets a
DUP.  PowerPC ncg handles this DUP well; other back ends might not.
2018-03-05 13:32:06 -05:00
George Koehler f26259caac Check AAR earlier to prevent LOI/STI unknown size.
In ego, the CS phase may convert a LAR/SAR to AAR LOI/STI so it can
optimize multiple occurrences of AAR of the same array element.  This
conversion should not happen if it would LOI/STI a large or unknown
size.

cs_profit.c okay_lines() checked the size of each occurrence of AAR
except the first.  If the first AAR was the implicit AAR in a LAR/SAR,
then the conversion happened without checking the size.  For unknown
size, this made a bad LOI -1 or STI -1.  Fix by checking the size
earlier: if a LAR/SAR has a bad size, then don't enter it as an AAR.

This Modula-2 code showed the bug.  Given M.def:

    DEFINITION MODULE M;
    TYPE S = SET OF [0..95];
    PROCEDURE F(a: ARRAY OF S; i, j: INTEGER);
    END M.

and M.mod:

    (*$R-*) IMPLEMENTATION MODULE M;
    FROM SYSTEM IMPORT ADDRESS, ADR;
    PROCEDURE G(s: S; p, q: ADDRESS; t: S); BEGIN
      s := s; p := p; q := q; t := t;
    END G;
    PROCEDURE F(a: ARRAY OF S; i, j: INTEGER); BEGIN
      G(a[i + j], ADR(a[i + j]), ADR(a[i + j]), a[i + j])
    END F;
    END M.

then the bug caused an error:

    $ ack -mlinuxppc -O3 -c.e M.mod
    /tmp/Ack_b357d.g, line 57: Argument range error

The bug had put LOI -1 in the code, then em_decode got an error
because -1 is out of range for LOI.

Procedure F has 4 occurrences of `a[i + j]`.  The size of `a[i + j]`
is 96 bits, or 12 bytes, but the EM code hides the size in an array
descriptor, so the size is unknown to CS.  The pragma `(*$R-*)`
disables a range check on `i + j` so CS can work.  EM uses AAR for the
2 `ADR(a[i + j])` and LAR for the other 2 `a[i + j]`.  EM pushes the
arguments to G in reverse order, so the last `a[i + j]` in Modula-2 is
the first LAR in EM.

CS found 4 occurrences of AAR.  The first AAR was an implicit AAR in
LAR.  Because of the bug, CS converted this LAR 4 to AAR 4 LOI -1.
2018-03-02 16:06:21 -05:00
George Koehler a7bb4ec4b1 Fixes for compiling ego with -DTRACE
- In share/debug.c, undo my mistake in commit 9037d13 by changing
   vfprintf back to fprintf in OUTTRACE.

 - In ud/ud.c, move the trace output from stdout to stderr, because
   stdout has ego's output file, which becomes opt2's input file.  If
   trace output goes to stdout, it gets prepended to the output file,
   and opt2 errors with "wrong input file".

I also edit both build.lua files so ego depends on its header files;
this part isn't needed for -DTRACE.

One can now use -DTRACE by adding it to the cflags in both build.lua
files.
2018-03-01 13:19:38 -05:00
David Given 4b5a7fee14 Made the cgg and the cg code generator work; use this to beat the PDP/11
backend into shape. It now generates binaries --- no idea whether they work or
not.
2018-02-23 22:31:46 +01:00
George Koehler 0a6d3de7fe Use prototypes in ego/cs, ego/sp. 2018-02-05 16:09:30 -05:00
George Koehler 88207db638 Use <stdarg.h> in util/misc/convert.c
I made a syntax error in some .e file, and em_encode dumped core
because a 64-bit pointer didn't fit in a 32-bit int.  Now use stdarg
to pass pointers to error() and fatal().

Stop using the number of errors as the exit status.  Many systems use
only the low 8 bits of the exit status, so 256 errors would become 0.

Also change modules/src/print to accept const char *buf
2017-12-06 17:09:12 -05:00
David Given 6d91bdbbbd
Merge pull request #69 from kernigh/kernigh-stdc
use libc assert, strcmp; declare more functions; fewer clang warnings
2017-11-19 12:00:40 +01:00
George Koehler 11d48be49e Fix my typo from commit 5bbbaf4. 2017-11-17 15:46:24 -05:00
George Koehler d99a0682fc Switch ego to libc <assert.h>
I also tried, in types.h, to switch ego to libc <stdbool.h>, but that
causes an infinite loop in the IL phase.
2017-11-15 19:48:53 -05: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
David Given caa9df5449 LLgen won't update the output file timestamp if the file contents doesn't
change, which confuses ninja no end. Fix this.

Fixes: #68
2017-11-15 19:41:39 +01:00
George Koehler 5bbbaf4919 Use size_t and void with memory allocation in ego.
alloc.h now needs to #include <stdlib.h> to find type size_t and
function free().
2017-11-14 20:35:18 -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
George Koehler fbff3a4790 Check each format string in tabgen.c
Silence warning from clang at `if (ch2 = ...)`

Delete `|| rm %{outs}` in build.lua, because it hid the exit status of
tabgen, so if tabgen failed, the build continued and failed later.
2017-11-13 20:59:03 -05:00
George Koehler ca4bd38206 Delete old "assert.h" files; use libc <assert.h>.
Edit build.lua for programs losing their private assert.h, so they
depend on a list of .h files excluding assert.h.

Remove modules/src/assert; it would be a dependency of cpp.ansi but we
didn't build it, so cpp.ansi uses the libc assert.

I hope that libc <assert.h> can better report failed assertions.  Some
old "assert.h" files didn't report the expression.  Some reported a
literal "x", because traditional C expanded the macro parameter x in
"x", but ANSI C89 doesn't expand macro parameters in string literals.
2017-11-09 22:22:13 -05:00
George Koehler 0fc0faef08 Restore an assignment deleted in commit 789f79b.
Because of the accidental deletion, mcgg on my machine followed a
garbage pointer, and never wrote calls to emit_fragment.

A wrong call to `data->emit_reg(0, 0)` instead of the correct
`data->emit_fragment(0)` caused PowerPC mcg to emit an empty string
instead of `8(fp)`, causing a syntax error in PowerPC as.

The wrong `data->emit_reg(0, 0)` called the function emit_reg() in
mach/proto/mcg/pass_instructionselection.c, but that function
unfortunately has `if (vreg) { ... }`.  The call had vreg == NULL
because the fragment wasn't a vreg, but emit_reg() ignored the problem
and emit nothing.
2017-11-07 23:52:52 -05:00
George Koehler 50a7031007 Don't use '-' in option string to getopt().
@dram reported a build failure in FreeBSD at
https://github.com/davidgiven/ack/issues/1#issuecomment-273668299

Linux manual for getopt(3) says:
> If the first character of optstring is '-', then each nonoption
> argv-element is handled as if it were the argument of an option with
> character code 1....
>
> The use of '+' and '-' in optstring is a GNU extension.

GNU/Linux and OpenBSD handle '-' in this special way, but FreeBSD
seems not to.  If '-' is not special, then em_ego can't find its input
file, so the build must fail.  This commit stops using '-' in both
em_b and em_ego, but doesn't change mcg.

Also fix em_ego -O3 to not act like -O4.
2017-10-29 23:25:07 -04:00
George Koehler 3d6ee435cf Fix pattern that was rewriting func(! var, var) as func(1).
Bug reported by Rune, see
 - https://sourceforge.net/p/tack/mailman/message/35809953/
 - https://github.com/davidgiven/ack/issues/62

In EM code, beq and bne pop 2 values and compare them, but teq and tne
pop only 1 value and compare it with zero.  We need cms to compare 2
values; other patterns may convert cmi or cmu to cms.
2017-10-29 14:53:33 -04:00
George Koehler cb8b28c088 For DIAGOPT, change outshort(patno) to outshort(lino - 1).
This is more useful when looking for patterns; lino - 1 is probably
the line number in the patterns file.  DIAGOPT is off by default but
one can edit optim.h to enable it.

The other changes just clean up whitespace.
2017-10-29 14:18:47 -04:00
George Koehler c567532eee mktab depends on some of the *.h files.
If I edit optim.h to #define DIAGOPT then mktab must get rebuilt.
2017-10-28 21:41:59 -04:00
George Koehler c261e2efaf Add .pas as a Pascal suffix.
Requested by @dram in https://github.com/davidgiven/ack/issues/41
2017-10-28 11:59:35 -04: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 73ad5a227d Rename RELOLIS to RELOPPC_LIS.
This relocation is specific to PowerPC.  @davidgiven suggested the
name RELOPPC_LIS in
https://github.com/davidgiven/ack/pull/52#issuecomment-279856501

Reindent the list in h/out.h and util/led/ack.out.5 because
RELOLIS_PPC is a long name.  I use spaces and no tabs because the tabs
looked bad in the manual page.
2017-10-18 15:39:31 -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 d6e9eac785 Merge branch 'default' into kernigh-linuxppc
This merges several fixes and improvements from upstream.  This
includes commit 5f6a773 to turn off qemuppc.  I see several failing
tests from qemuppc; this merge will hide the test failures.
2017-10-14 13:50:49 -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