ack.git
7 years agoBigraph now uses hash tables to hold edges inside vertices, rather than linked
David Given [Sat, 17 Dec 2016 09:18:51 +0000 (10:18 +0100)]
Bigraph now uses hash tables to hold edges inside vertices, rather than linked
lists.

7 years agoMassive graph performance boost by checking to see whether an edge already
David Given [Fri, 16 Dec 2016 23:21:27 +0000 (00:21 +0100)]
Massive graph performance boost by checking to see whether an edge already
exists in the hash table before trying to add it.

7 years agoMore porting to the set and graph libraries; no longer maintain a set of
David Given [Fri, 16 Dec 2016 22:25:10 +0000 (23:25 +0100)]
More porting to the set and graph libraries; no longer maintain a set of
vertices, as it's easier and faster to fetch from the interference or
preference graphs.

7 years agoFix warning.
David Given [Fri, 16 Dec 2016 22:23:41 +0000 (23:23 +0100)]
Fix warning.

7 years agoAdd hashtable/set_empty to go with _reset, which removes all items from the
David Given [Fri, 16 Dec 2016 21:16:45 +0000 (22:16 +0100)]
Add hashtable/set_empty to go with _reset, which removes all items from the
table but doesn't free the bucket array or reset the size --- saves an
allocation when reusing the hashtable.

7 years agoFix crash when enumerating uninitialised hashtables.
David Given [Fri, 16 Dec 2016 21:12:28 +0000 (22:12 +0100)]
Fix crash when enumerating uninitialised hashtables.

7 years agoConvert to the set API.
David Given [Fri, 16 Dec 2016 20:12:35 +0000 (21:12 +0100)]
Convert to the set API.

7 years agoConvert to use the set API.
David Given [Fri, 16 Dec 2016 20:08:28 +0000 (21:08 +0100)]
Convert to use the set API.

7 years agoConvert to use the set API.
David Given [Fri, 16 Dec 2016 20:04:31 +0000 (21:04 +0100)]
Convert to use the set API.

7 years agoConvert to use set and graph APIs.
David Given [Fri, 16 Dec 2016 20:01:40 +0000 (21:01 +0100)]
Convert to use set and graph APIs.

7 years agoExpand the graph and set APIs.
David Given [Fri, 16 Dec 2016 20:00:47 +0000 (21:00 +0100)]
Expand the graph and set APIs.

7 years agoThe hash table now automatically resizes when it gets full.
David Given [Fri, 16 Dec 2016 17:09:58 +0000 (18:09 +0100)]
The hash table now automatically resizes when it gets full.

7 years agoAdd a set-based hashtable; change the register allocator to use it for vertices.
David Given [Fri, 16 Dec 2016 15:45:52 +0000 (16:45 +0100)]
Add a set-based hashtable; change the register allocator to use it for vertices.

7 years agoSwitch completely away from pmap_bi to the new bigraph module.
David Given [Fri, 16 Dec 2016 15:00:05 +0000 (16:00 +0100)]
Switch completely away from pmap_bi to the new bigraph module.

7 years agoEnsure that cflags is honoured when linking cprograms. (Needed for -pg to
David Given [Thu, 15 Dec 2016 23:34:57 +0000 (00:34 +0100)]
Ensure that cflags is honoured when linking cprograms. (Needed for -pg to
work.)

7 years agoArchival checkin: partial conversion to using bigraph for the interference and
David Given [Thu, 15 Dec 2016 23:34:15 +0000 (00:34 +0100)]
Archival checkin: partial conversion to using bigraph for the interference and
preference graphs.

7 years agoActually, let's not split phis on entry just yet; because we split vregs one at
David Given [Thu, 15 Dec 2016 23:33:50 +0000 (00:33 +0100)]
Actually, let's not split phis on entry just yet; because we split vregs one at
a time, splitting several in a row just causes half of them to interfere with
the other half, which doesn't really help.

7 years agoAdd hashtable and work-in-progress bigraph modules.
David Given [Thu, 15 Dec 2016 23:32:22 +0000 (00:32 +0100)]
Add hashtable and work-in-progress bigraph modules.

7 years agoFix an embarrassing but safe mistake where 3x the space was being allocated for
David Given [Thu, 15 Dec 2016 23:01:21 +0000 (00:01 +0100)]
Fix an embarrassing but safe mistake where 3x the space was being allocated for
arrays.

7 years agoEnsure we cover all vregs, even pathalogical cases (e.g. phis which are never
David Given [Wed, 14 Dec 2016 22:14:13 +0000 (23:14 +0100)]
Ensure we cover all vregs, even pathalogical cases (e.g. phis which are never
used).

7 years agoSpillable vregs now get simplified, if possible.
David Given [Tue, 13 Dec 2016 23:27:19 +0000 (00:27 +0100)]
Spillable vregs now get simplified, if possible.

7 years agoMuch more aggressive splitting.
David Given [Tue, 13 Dec 2016 23:26:58 +0000 (00:26 +0100)]
Much more aggressive splitting.

7 years agoMerge in warning fixes (properly, this time).
David Given [Mon, 12 Dec 2016 22:58:54 +0000 (23:58 +0100)]
Merge in warning fixes (properly, this time).

7 years agoMerge from trunk.
David Given [Mon, 12 Dec 2016 22:58:24 +0000 (23:58 +0100)]
Merge from trunk.

7 years agoAdd pmap_contains_bi() and pmap_remove_bi().
David Given [Mon, 12 Dec 2016 22:56:49 +0000 (23:56 +0100)]
Add pmap_contains_bi() and pmap_remove_bi().

7 years agoFix warnings.
David Given [Mon, 12 Dec 2016 22:55:49 +0000 (23:55 +0100)]
Fix warnings.

7 years agoCleanup for correctly assigning bbs when tinkering with IRs.
David Given [Mon, 12 Dec 2016 22:55:24 +0000 (23:55 +0100)]
Cleanup for correctly assigning bbs when tinkering with IRs.

7 years agoWire up the new passes.
David Given [Mon, 12 Dec 2016 22:54:59 +0000 (23:54 +0100)]
Wire up the new passes.

7 years agoAdd infrastructure for new, special move hops.
David Given [Mon, 12 Dec 2016 22:54:25 +0000 (23:54 +0100)]
Add infrastructure for new, special move hops.

7 years agoFix warnings.
David Given [Mon, 12 Dec 2016 22:53:33 +0000 (23:53 +0100)]
Fix warnings.

7 years agoGets much further at allocating registers now; the register graph is (possibly)
David Given [Mon, 12 Dec 2016 22:51:05 +0000 (23:51 +0100)]
Gets much further at allocating registers now; the register graph is (possibly)
correctly simplified and spilt, although it still fails on mandelbrot.c.

7 years agoNothing uses phi congruence any more (replaced by register allocator anode
David Given [Mon, 12 Dec 2016 22:49:42 +0000 (23:49 +0100)]
Nothing uses phi congruence any more (replaced by register allocator anode
coalescing), so remove the pass that calculated it.

7 years agoDon't record use-def data; we have a pass now that does this for us.
David Given [Mon, 12 Dec 2016 22:47:05 +0000 (23:47 +0100)]
Don't record use-def data; we have a pass now that does this for us.

7 years agoRename the locals SSA pass to be more clearly named.
David Given [Mon, 12 Dec 2016 22:45:52 +0000 (23:45 +0100)]
Rename the locals SSA pass to be more clearly named.

7 years agoAlways insert phis, even if we don't technically need one (saves time later).
David Given [Mon, 12 Dec 2016 22:45:13 +0000 (23:45 +0100)]
Always insert phis, even if we don't technically need one (saves time later).

7 years agoMove the dominance frontier calculation into graph.c for cleanness (thought we
David Given [Mon, 12 Dec 2016 22:44:12 +0000 (23:44 +0100)]
Move the dominance frontier calculation into graph.c for cleanness (thought we
were going to use this in several places, but turned out not to).

7 years agoAdd standard functions for rewriting IRs (because we do that in several
David Given [Mon, 12 Dec 2016 22:43:22 +0000 (23:43 +0100)]
Add standard functions for rewriting IRs (because we do that in several
places).

7 years agoFix warnings.
David Given [Mon, 12 Dec 2016 22:42:10 +0000 (23:42 +0100)]
Fix warnings.

7 years agoIR imports are now analysed and split so that all IRs imported from another
David Given [Mon, 12 Dec 2016 22:38:18 +0000 (23:38 +0100)]
IR imports are now analysed and split so that all IRs imported from another
block come via a phi and from a direct predecessor. Add a separate pass for
calculate use-def data on vregs. Add a pass for (attempting to) split vregs
before and after instructions.

7 years agoMerge in warning fixes.
David Given [Mon, 12 Dec 2016 22:30:08 +0000 (23:30 +0100)]
Merge in warning fixes.

7 years agoMerge from default.
David Given [Mon, 12 Dec 2016 22:29:55 +0000 (23:29 +0100)]
Merge from default.

7 years agoFix a warning.
David Given [Mon, 12 Dec 2016 20:17:01 +0000 (21:17 +0100)]
Fix a warning.

7 years agoRun lang/basic/lib through clang-format.
David Given [Mon, 12 Dec 2016 20:16:32 +0000 (21:16 +0100)]
Run lang/basic/lib through clang-format.

7 years agoAnsify function definitions.
David Given [Mon, 12 Dec 2016 20:15:25 +0000 (21:15 +0100)]
Ansify function definitions.

7 years agoMerge pull request #27 from kernigh/pr-qemu-doze
David Given [Sun, 11 Dec 2016 22:17:12 +0000 (23:17 +0100)]
Merge pull request #27 from kernigh/pr-qemu-doze

Teach qemuppc to halt the cpu on _exit().

7 years agoConvert the inn test to work with the test library and not import InOut; it now
David Given [Sun, 11 Dec 2016 22:06:37 +0000 (23:06 +0100)]
Convert the inn test to work with the test library and not import InOut; it now
runs on qemuppc again. Reenable qemuppc tests.

7 years agoMerge pull request #28 from kernigh/pr-set-ppc
David Given [Sun, 11 Dec 2016 21:25:04 +0000 (22:25 +0100)]
Merge pull request #28 from kernigh/pr-set-ppc

add Modula-2 set operations to PowerPC ncg

7 years agoAdd Modula-2 set operations to PowerPC ncg.
George Koehler [Sat, 10 Dec 2016 17:23:07 +0000 (12:23 -0500)]
Add Modula-2 set operations to PowerPC ncg.

This provides and, ior, xor, com, zer, set, cms when defined($1) and
ior, set when !defined($1).  I don't provide the other operations
!defined($1) because our Modula-2 compiler hasn't used them.

I wrote a Modula-2 example in
https://gist.github.com/kernigh/add79662bb3c63ffb7c46d01dc8ae788

Put a dummy comment in mach/powerpc/libem/build.lua so git checkout
will touch that file.  Without the touch, the build system doesn't see
the new *.s files.

7 years agoAdd some missing clauses to los, sts, aar, inn, cmi, cmu.
George Koehler [Sat, 10 Dec 2016 00:49:50 +0000 (19:49 -0500)]
Add some missing clauses to los, sts, aar, inn, cmi, cmu.

We only implement 'los 4', 'sts 4', 'cmi 4', 'cmu 4', not for sizes
other than 4.  Add clause $1==4.

We only implement inn when defined($1).

The rule for aar needs 'kills ALL' because it kills many registers,
like other rules that call libem.

7 years agoAdd a move from CONST smalls(%val) to GPR.
George Koehler [Fri, 9 Dec 2016 23:40:14 +0000 (18:40 -0500)]
Add a move from CONST smalls(%val) to GPR.

This allows 'move {CONST, $1}, R3' with a small enough $1 to emit one
instruction (addi) instead of two instructions (addis, ori).  The
CONST token confusingly isn't in the CONST_ALL set.

7 years agoFix ass to match the EM spec.
George Koehler [Fri, 9 Dec 2016 22:32:42 +0000 (17:32 -0500)]
Fix ass to match the EM spec.

The spec says, "ASS w: Adjust the stack pointer by w-byte integer".
The w argument "can either be given as argument or on top of the
stack."  Therefore, 'ass 4' would pop the 4-byte integer from the
stack, but 'ass' would pop the size w from the stack, then pop the
w-byte integer.

PowerPC ncg wrongly implemented 'ass' as if it was 'ass 4'.  Fix it to
accept only 'ass 4'.

7 years agoRemove the bogus rules for 'lor 2' and 'str 2'.
George Koehler [Fri, 9 Dec 2016 22:00:56 +0000 (17:00 -0500)]
Remove the bogus rules for 'lor 2' and 'str 2'.

These instructions would load or store the EM heap pointer.  They
don't work.  Programs must use brk() or sbrk() in libsys.

The last file to use 'lor 2' and 'str 2' was lang/pc/libpc/sav.e in
the Pascal library.  Commit c084f9f deleted the file, so we no longer
need rules 'lor 2' or 'str 2' to build the ACK.

7 years agoFill in a hint for enabling the COMMENT macro.
George Koehler [Fri, 9 Dec 2016 21:58:47 +0000 (16:58 -0500)]
Fill in a hint for enabling the COMMENT macro.

If you want to enable comments in the .s file, change

    #define COMMENT(n) /* comment {LABEL, n} */

to

    #define COMMENT(n) comment {LABEL, n}

7 years agoRemove trailing whitespace in mach/powerpc/ncg/table
George Koehler [Fri, 9 Dec 2016 21:36:42 +0000 (16:36 -0500)]
Remove trailing whitespace in mach/powerpc/ncg/table

7 years agoFix typo: msr0 should be msr.
George Koehler [Fri, 9 Dec 2016 21:04:21 +0000 (16:04 -0500)]
Fix typo: msr0 should be msr.

7 years agoTeach qemuppc to halt the cpu on _exit().
George Koehler [Wed, 7 Dec 2016 23:11:12 +0000 (18:11 -0500)]
Teach qemuppc to halt the cpu on _exit().

Without this, qemu-system-ppc spins the host cpu until I close its
window.  I assume the default G3 emulation.  The emulator yields the
host cpu if I set certain flags in hid0 then msr.  The hid0 flag can
be any of DOZE, NAP, SLEEP, so I just set all 3.  I encode mfmsr and
mtmsr with .data4, because our assembler doesn't know instructions for
supervisor mode.

Also move some common symbols from .rom to .bss.  Our assembler puts
common symbols in any section.

Also clean up the file.  Delete a comment about linuxppc that is wrong
here.  Delete redundant .extern because .define is the same.

7 years agoAllow mfspr, mtspr with a register number.
George Koehler [Wed, 7 Dec 2016 22:28:00 +0000 (17:28 -0500)]
Allow mfspr, mtspr with a register number.

PowerPC has a few hundred special-purpose registers.  The assembler
had only accepted the names "xer", "lr", "ctr".  Most programs use
only those three SPRs.  If I add more names, they would almost never
get used, and they might conflict with labels.

I want to use "mfspr r3, 0x3f0" and "mtspr 0x3f0, r3" in
plat/qemu/boot.s to access register hid0 from supervisor mode.

7 years agoMerge pull request #25 from davidgiven/dtrg-inn
David Given [Tue, 6 Dec 2016 21:24:31 +0000 (22:24 +0100)]
Merge pull request #25 from davidgiven/dtrg-inn

Fix endianess issue with inn.

7 years agoAdd a test for #22.
David Given [Tue, 6 Dec 2016 21:07:22 +0000 (22:07 +0100)]
Add a test for #22.

7 years agoDisable qemuppc tests; turns out qemu-system-ppc won't load more than the first
David Given [Tue, 6 Dec 2016 21:06:17 +0000 (22:06 +0100)]
Disable qemuppc tests; turns out qemu-system-ppc won't load more than the first
4kB of a kernel...

7 years agoFix redirection so stray stderr output from qemu doesn't cause mysterious test
David Given [Tue, 6 Dec 2016 21:05:14 +0000 (22:05 +0100)]
Fix redirection so stray stderr output from qemu doesn't cause mysterious test
failures.

7 years agoinn was assuming that bitfields were arrays of bytes, when actually they're
David Given [Tue, 6 Dec 2016 20:45:20 +0000 (21:45 +0100)]
inn was assuming that bitfields were arrays of bytes, when actually they're
arrays of words (which makes the LSB move on big-endian systems).

7 years agoMerge pull request #23 from kernigh/pr-osx
David Given [Tue, 6 Dec 2016 15:28:24 +0000 (16:28 +0100)]
Merge pull request #23 from kernigh/pr-osx

new platforms osx386 and osxppc

7 years agoDon't share as, ncg, top between Linux and Mac OS X. kernigh-osx
George Koehler [Tue, 6 Dec 2016 01:13:29 +0000 (20:13 -0500)]
Don't share as, ncg, top between Linux and Mac OS X.

Telling osx386 and osxppc to build and run their own tools, not to
reuse the tools from linux386 and linuxppc.  This wastes time to build
identical tools, but it removes some bogus dependencies.  OS X tools
had wrongly depended on Linux descr files and aelflod; now they don't.

Discussion in https://github.com/davidgiven/ack/pull/23

7 years agoAdd pmap_remove_either().
David Given [Mon, 5 Dec 2016 23:12:41 +0000 (00:12 +0100)]
Add pmap_remove_either().

7 years agoAdd array_replace().
David Given [Mon, 5 Dec 2016 23:11:40 +0000 (00:11 +0100)]
Add array_replace().

7 years agoFix some shell issues that would occasionally cause hangs if no tests failed. kernigh-pr-osx
David Given [Mon, 5 Dec 2016 20:06:38 +0000 (21:06 +0100)]
Fix some shell issues that would occasionally cause hangs if no tests failed.

7 years agoClean up how the language libraries refer to plat headers; they should be using
David Given [Mon, 5 Dec 2016 20:05:24 +0000 (21:05 +0100)]
Clean up how the language libraries refer to plat headers; they should be using
the +pkg forms of the rules and getting the headers via the paths in descr,
rather than depending on the +headers version.

7 years agoChange dependency from simplerule{} with a dependency but no outputs to an
David Given [Mon, 5 Dec 2016 19:33:26 +0000 (20:33 +0100)]
Change dependency from simplerule{} with a dependency but no outputs to an
installable; otherwise, the dependency would be built, but the result wouldn't
get added to the header path and so wouldn't be seen.

7 years agoMerge branch 'pr-osx' of https://github.com/kernigh/ack into kernigh-pr-osx
David Given [Mon, 5 Dec 2016 19:14:54 +0000 (20:14 +0100)]
Merge branch 'pr-osx' of https://github.com/kernigh/ack into kernigh-pr-osx

7 years agoCreate Mach-o files with mode 0777 to allow executing them.
George Koehler [Sat, 3 Dec 2016 22:52:24 +0000 (17:52 -0500)]
Create Mach-o files with mode 0777 to allow executing them.

Until now, I was always doing chmod +x before running my files on the
Mac.  Now files get created +x.  There's no change when overwriting
an existing file.  I needed to gmake clean my build to remove the
example programs without +x, so cvmach can create them with +x.

7 years agoWrite README files for osx386 and osxppc.
George Koehler [Sat, 3 Dec 2016 22:17:44 +0000 (17:17 -0500)]
Write README files for osx386 and osxppc.

7 years agoRemove bad overflow check from plat/osx/libsys/brk.c
George Koehler [Sat, 3 Dec 2016 22:07:51 +0000 (17:07 -0500)]
Remove bad overflow check from plat/osx/libsys/brk.c

If I want to check for overflow, then I should check it before I do
base + incr, not after.

Now that I have no check, I am passing the overflowed base + incr to
brk1(), where it will probably fail the nbreak < segment check.

7 years agoWrite a manual page for cvmach(6).
George Koehler [Fri, 2 Dec 2016 23:04:06 +0000 (18:04 -0500)]
Write a manual page for cvmach(6).

This manual is in the new mdoc(7) format.  All existing ack manuals
use the old man(7) format.  This might be a problem if someone can't
display mdoc(7) files.

The build system doesn't install the cvmach(6) manual; that might
happen later.  The current build system installs manuals in two
different places, and doesn't install some manuals, so I don't know
what to do.

7 years agoMerge from default.
David Given [Thu, 1 Dec 2016 23:26:10 +0000 (00:26 +0100)]
Merge from default.

7 years agoMerge pull request #21 from davidgiven/dtrg-tests
David Given [Thu, 1 Dec 2016 23:24:44 +0000 (00:24 +0100)]
Merge pull request #21 from davidgiven/dtrg-tests

Run all tests, even if some fail, and produce a test summary at the end of the build.

7 years agoTypo fix.
David Given [Thu, 1 Dec 2016 23:18:44 +0000 (00:18 +0100)]
Typo fix.

7 years agoDon't fail to build if all tests are skipped.
David Given [Thu, 1 Dec 2016 23:14:40 +0000 (00:14 +0100)]
Don't fail to build if all tests are skipped.

7 years agoUI tweaks to the test summary.
David Given [Thu, 1 Dec 2016 23:10:33 +0000 (00:10 +0100)]
UI tweaks to the test summary.

7 years agoReport skipped, failed and timed out tests.
David Given [Thu, 1 Dec 2016 23:00:31 +0000 (00:00 +0100)]
Report skipped, failed and timed out tests.

7 years agoMark skipped tests in the logs (so we can get stats on them later).
David Given [Thu, 1 Dec 2016 22:14:29 +0000 (23:14 +0100)]
Mark skipped tests in the logs (so we can get stats on them later).

7 years agoRun all tests, even the ones which fail, and emit a test summary right at the
David Given [Thu, 1 Dec 2016 22:03:30 +0000 (23:03 +0100)]
Run all tests, even the ones which fail, and emit a test summary right at the
end of the build (and fail then).

7 years agoMerge pull request #20 from davidgiven/dtrg-tests
David Given [Thu, 1 Dec 2016 21:23:09 +0000 (22:23 +0100)]
Merge pull request #20 from davidgiven/dtrg-tests

Replace the hacky pipeline in testdriver.sh with a bespoke tool.

7 years agoFix signal unsafety in testdriver.c.
David Given [Thu, 1 Dec 2016 21:05:22 +0000 (22:05 +0100)]
Fix signal unsafety in testdriver.c.

7 years agoMerge from default.
David Given [Wed, 30 Nov 2016 21:07:29 +0000 (22:07 +0100)]
Merge from default.

7 years agoMerge pull request #18 from kernigh/pr-util-ack
David Given [Wed, 30 Nov 2016 21:00:55 +0000 (22:00 +0100)]
Merge pull request #18 from kernigh/pr-util-ack

util/ack: use DEFAULT_PLATFORM, allow non-ASCII filenames, other changes

7 years agoWrite a powerpc.descr for ego and use it with osxppc.
George Koehler [Wed, 30 Nov 2016 20:29:19 +0000 (15:29 -0500)]
Write a powerpc.descr for ego and use it with osxppc.

No change to linuxppc and qemuppc.  They continue to run ego without
any descr file.

I copied m68020.descr to powerpc.descr and changed some numbers.  My
numbers are guesses; I know little about PowerPC cycle counts, and
almost nothing about ego.  This powerpc.descr causes most of the
example programs to shrink in size (without descr -> with descr):

  65429 -> 57237  hilo_b.osxppc        -8192
  36516 -> 32420  hilo_c.osxppc        -4096
  55782 -> 51686  hilo_mod.osxppc      -4096
  20096 -> 20096  hilo_p.osxppc            0
   8813 ->  8813  mandelbrot_c.osxppc      0
  93355 -> 89259  paranoia_c.osxppc    -4096
  92751 -> 84559  startrek_c.osxppc    -8192

(Each file has 2 Mach segments, then a symbol table.  Each segment
takes a multiple of 4096 bytes.  When the code shrinks, we lose a
multiple of 4096 bytes.)

I used "ack -mosxppc -O6 -c.so" to examine the assembly code for
hilo.mod and mandelbrot.c, both without and with descr.  This reveals
optimizations made only with descr, from 2 ego phases: SP (stack
pollution) and RA (register allocation).  In hilo.mod, SP deletes some
instructions that remove items from the stack.  These items get
removed when the function returns.  In both hilo.mod and mandelbrot.c,
RA moves some values into local variables, so ncg can make them into
register variables.  This shrinks code size, probably because register
variables get preserved across function calls.  More values stay in
registers, and ncg emits shorter code.

I believe that the ego descr file uses (time,space) tuples but the ncg
table uses (space,time) tuples.  This is confusing.  Perhaps I am
wrong, and some or all tuples are backwards.  My time values are the
cycle counts in latency from the MPC7450 Reference Manual (but not
including complications like "store serialization").

In powerpc.descr, I give the cost for saving and restoring registers
as if I was using chains of stw and lwz instructions.  Actually ncg
uses single stmw and lmw instructions with at least 2 instructions.
The (time,space) for stmw and lmw would be much less than the
(time,space) for chains of stw and lwz.  But this ignores the pipeline
of the MPC7450.  The chains of stw and lwz may run faster than stmw
and lmw in the pipeline, because the throughput may be better than the
latency.  By using the wrong values for (time,space), I'm trying to
tell ego that stmw and lmw are not better than chains of stw and lwz.

7 years agoDeclare raise() for Mac OS X.
George Koehler [Wed, 30 Nov 2016 19:33:40 +0000 (14:33 -0500)]
Declare raise() for Mac OS X.

This prevents the warning, "implicit declaration of function raise",
in programs that call raise().  I forgot to declare it because the
function raise() is in libc but the declaration goes in libsys.

7 years agoReplace the hacky and broken pipeline in testdriver.sh with a custom-written
David Given [Tue, 29 Nov 2016 19:59:43 +0000 (20:59 +0100)]
Replace the hacky and broken pipeline in testdriver.sh with a custom-written
tool in C; much more robust and easier to understand, as well as avoiding the
dependency on timeout (which isn't Posix).

7 years agoEnable top and make other tweaks in plat/osxppc/descr
George Koehler [Tue, 29 Nov 2016 01:58:51 +0000 (20:58 -0500)]
Enable top and make other tweaks in plat/osxppc/descr

David Given made top for PowerPC.  Copy the asopt phase (running top)
from linuxppc to osxppc.

Remove CC_ALIGN=-Vr to become compatible with Apple's gcc.  Apple uses
left adjustment for bitfields; the first bitfield is on the left side
(the big end), not the right side.

Remove unused variables C_LIB and OLD_C_LIB; the file libc-ansi.a
doesn't exist.

Change MACHOPT_F from -m10 to -m3.  This means to use no more than 3
adds and shifts to optimize a multiply by a constant.  I pick -m3
because -m4 can use too many instructions.  At -m4, the compiler
rewrites

    n * 14

as

    s = n << 1
    (s << 3) + (0 - s)

This means (n * 16 - n * 2), but even at ack -O6, the compiler doesn't
rewrite (a + (0 - b)) as (a - b).  The compiler emits 5 instructions:
2 of rlinmw for 2 left shifts, then addi to load 0 in a register, subf
to subtract from that 0, then add.  These 5 instructions cost 5 cycles
on the MPC7450, using the cycle counts from mach/powerpc/ncg/table.

At -m3, (n * 14) becomes 2 instructions: addi to load 14 in a register
and mullw to multiply.  This also costs 5 cycles (because mullw costs
4 cycles), but uses less space.

7 years agoWhile fiddling with mcg, change qemuppc back to using ncg (so that everything
David Given [Mon, 28 Nov 2016 22:39:09 +0000 (23:39 +0100)]
While fiddling with mcg, change qemuppc back to using ncg (so that everything
still builds).

7 years agoBasic building and initial coalescing of the interference graph now works.
David Given [Mon, 28 Nov 2016 22:38:38 +0000 (23:38 +0100)]
Basic building and initial coalescing of the interference graph now works.

7 years agoAdd a routine for adding bidirectional edges to a graph.
David Given [Mon, 28 Nov 2016 22:38:01 +0000 (23:38 +0100)]
Add a routine for adding bidirectional edges to a graph.

7 years agoMerge branch 'default' into kernigh-osx
George Koehler [Mon, 28 Nov 2016 21:20:56 +0000 (16:20 -0500)]
Merge branch 'default' into kernigh-osx

This brings in David Given's PowerPC changes, including the addition
of the modern code generator (mcg) for PowerPC.

Resolve minor conflicts in top build.lua and util/led/main.c

7 years agoAdd getdirentries() and stat() for Mac OS X.
George Koehler [Mon, 28 Nov 2016 19:32:49 +0000 (14:32 -0500)]
Add getdirentries() and stat() for Mac OS X.

Also add fstat() and lstat().  I don't #define the constants for
st_mode or d_type, but I provide enough to get the block size of a
file and to list the names in a directory.  Some fields of struct stat
get truncated, see XXX in plat/osx/include/sys/stat.h.

In struct dirent, the inode field might be d_ino or d_fileno.  I
picked d_ino because Apple's sys/dirent.h uses d_ino (but Apple's
manual pages use d_fileno).

7 years agoUse heaps to reduce memory usage a bit.
David Given [Sat, 26 Nov 2016 22:07:41 +0000 (23:07 +0100)]
Use heaps to reduce memory usage a bit.

7 years agoSuppress spurious message when testdriver probes for a testing method.
David Given [Sat, 26 Nov 2016 20:50:56 +0000 (21:50 +0100)]
Suppress spurious message when testdriver probes for a testing method.

7 years agoUpdated the README.
David Given [Sat, 26 Nov 2016 18:25:02 +0000 (19:25 +0100)]
Updated the README.

7 years agoMerge pull request #17 from davidgiven/dtrg-tests
David Given [Sat, 26 Nov 2016 11:59:13 +0000 (12:59 +0100)]
Merge pull request #17 from davidgiven/dtrg-tests

Refactor the tests so they run for several plats.

7 years agoUse command -v rather than hash to detect commands (command is Posix and works
David Given [Sat, 26 Nov 2016 11:53:36 +0000 (12:53 +0100)]
Use command -v rather than hash to detect commands (command is Posix and works
on OpenBSD).