ack.git
5 years agoWhen parsing constants which don't fit into an arith, handle overflow properly dtrg-mips
David Given [Sat, 22 Sep 2018 10:45:59 +0000 (12:45 +0200)]
When parsing constants which don't fit into an arith, handle overflow properly
(and don't turn them all into INT_MAX...).

5 years agoMerge pull request #132 from davidgiven/dtrg-mips
David Given [Sat, 22 Sep 2018 10:04:13 +0000 (11:04 +0100)]
Merge pull request #132 from davidgiven/dtrg-mips

Teach mcg how to merge pushes

5 years agoTeach the code generator about the zero register and how to efficiently access
David Given [Sat, 22 Sep 2018 09:49:13 +0000 (11:49 +0200)]
Teach the code generator about the zero register and how to efficiently access
the stack.

5 years agoTake hreg aliases into account when finding evicted registers and performing
David Given [Sat, 22 Sep 2018 09:19:50 +0000 (11:19 +0200)]
Take hreg aliases into account when finding evicted registers and performing
the register shuffle dance.

5 years agoAdd the OPTIONS clause to the mcgg grammar; add an optional pass which converts
David Given [Sat, 22 Sep 2018 09:19:00 +0000 (11:19 +0200)]
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.

6 years agoMerge pull request #131 from davidgiven/dtrg-mips
David Given [Thu, 20 Sep 2018 22:05:55 +0000 (23:05 +0100)]
Merge pull request #131 from davidgiven/dtrg-mips

Add an mcg-based MIPS code generator.

6 years agoRemove some old, hopefully unused PowerPC code. Teach the code generator about
David Given [Thu, 20 Sep 2018 21:30:38 +0000 (23:30 +0200)]
Remove some old, hopefully unused PowerPC code. Teach the code generator about
non-volatile long registers.

6 years agoFix subtle register corruption bug where aliases weren't taken into account
David Given [Thu, 20 Sep 2018 21:24:46 +0000 (23:24 +0200)]
Fix subtle register corruption bug where aliases weren't taken into account
when assigning input registers to phis, which could cause the same hreg to be
assigned to two vregs of different types. Also improve tracing.

6 years agoCreate correctly sized csa descriptors in the Basic compiler.
David Given [Wed, 19 Sep 2018 22:49:31 +0000 (00:49 +0200)]
Create correctly sized csa descriptors in the Basic compiler.

6 years agoA few more minor optimisations.
David Given [Wed, 19 Sep 2018 22:39:13 +0000 (00:39 +0200)]
A few more minor optimisations.

6 years agoThe approach I was taking to csa and csb turns out not to work --- critical
David Given [Wed, 19 Sep 2018 22:12:03 +0000 (00:12 +0200)]
The approach I was taking to csa and csb turns out not to work --- critical
edge splitting can cause new basic blocks to be added to the graph, but while
the graph itself gets properly rewritten the descriptor tables can't be updated
to take these into account, so they end up pointing at the wrong blocks. This
causes really hard-to-debug problems.

The new approach is to parse the descriptor blocks and then generate a
comparison chain. Brute force, but much easier for the compiler to reason
about.

6 years agoFix incorrect ori encoding.
David Given [Wed, 19 Sep 2018 22:06:26 +0000 (00:06 +0200)]
Fix incorrect ori encoding.

6 years agoRemember to save longs and doubles. Yikes.
David Given [Tue, 18 Sep 2018 22:09:50 +0000 (00:09 +0200)]
Remember to save longs and doubles. Yikes.

6 years agoUpdated READMEs with the MIPS platform.
David Given [Tue, 18 Sep 2018 21:49:31 +0000 (23:49 +0200)]
Updated READMEs with the MIPS platform.

6 years agoMake the MIPS boot code produce correct code.
David Given [Tue, 18 Sep 2018 21:39:04 +0000 (23:39 +0200)]
Make the MIPS boot code produce correct code.

6 years agoLoads and stores (except longs, which are difficult) are now loaded with two
David Given [Tue, 18 Sep 2018 21:38:37 +0000 (23:38 +0200)]
Loads and stores (except longs, which are difficult) are now loaded with two
instructions rather than three.

6 years agoFixed some bad mcg ir code generation: only nodes which have been appendir'd
David Given [Tue, 18 Sep 2018 21:32:53 +0000 (23:32 +0200)]
Fixed some bad mcg ir code generation: only nodes which have been appendir'd
may be used multiple times.

6 years agoAdd unsigned comparison rules.
David Given [Mon, 17 Sep 2018 22:19:40 +0000 (00:19 +0200)]
Add unsigned comparison rules.

6 years agoAdd extern declaration which I forget to check in.
David Given [Mon, 17 Sep 2018 21:59:49 +0000 (23:59 +0200)]
Add extern declaration which I forget to check in.

6 years agoAdd specialist rules for signed integer comparisons; much better code.
David Given [Mon, 17 Sep 2018 21:53:18 +0000 (23:53 +0200)]
Add specialist rules for signed integer comparisons; much better code.

6 years agoArray descriptor ranges are inclusive; adjust aar and the tests to check for
David Given [Mon, 17 Sep 2018 18:34:38 +0000 (19:34 +0100)]
Array descriptor ranges are inclusive; adjust aar and the tests to check for
this. All the tests except rotate build now!

6 years agoFix lar and sar, which were horribly, horribly broken. Add tests.
David Given [Mon, 17 Sep 2018 17:44:17 +0000 (18:44 +0100)]
Fix lar and sar, which were horribly, horribly broken. Add tests.

6 years agoFix aar; add test.
David Given [Mon, 17 Sep 2018 15:59:45 +0000 (16:59 +0100)]
Fix aar; add test.

6 years agoACK loi 1 and sti 1 load and store unsigned bytes. I think.
David Given [Mon, 17 Sep 2018 14:03:44 +0000 (15:03 +0100)]
ACK loi 1 and sti 1 load and store unsigned bytes. I think.

6 years agorotate() now generates valid code.
David Given [Mon, 17 Sep 2018 12:13:39 +0000 (13:13 +0100)]
rotate() now generates valid code.

6 years agoFix bls4.
David Given [Mon, 17 Sep 2018 11:53:27 +0000 (12:53 +0100)]
Fix bls4.

6 years agoAdded cms, and a test for it.
David Given [Mon, 17 Sep 2018 11:42:10 +0000 (12:42 +0100)]
Added cms, and a test for it.

6 years agoAdd hacky 64-bit comparisons (used by M2).
David Given [Mon, 17 Sep 2018 11:16:17 +0000 (12:16 +0100)]
Add hacky 64-bit comparisons (used by M2).

6 years agoAdded a test for set. Fix mips set implementation.
David Given [Mon, 17 Sep 2018 10:56:15 +0000 (11:56 +0100)]
Added a test for set. Fix mips set implementation.

6 years agoSet fixes; also add discrete tests for and, ior, xor.
David Given [Fri, 14 Sep 2018 13:13:35 +0000 (14:13 +0100)]
Set fixes; also add discrete tests for and, ior, xor.

6 years agoMake inn work; fix broken 64-bit loads and stores.
David Given [Fri, 14 Sep 2018 11:48:43 +0000 (13:48 +0200)]
Make inn work; fix broken 64-bit loads and stores.

6 years agoImplement a working .trp.
David Given [Fri, 14 Sep 2018 10:26:27 +0000 (12:26 +0200)]
Implement a working .trp.

6 years agoRemove la; turns out that the assembler gets upset if you ask it to
David Given [Fri, 14 Sep 2018 09:30:15 +0000 (11:30 +0200)]
Remove la; turns out that the assembler gets upset if you ask it to
generate more than one fixup per instruction (I think).

6 years agoClang-format before editing.
David Given [Fri, 14 Sep 2018 07:28:35 +0000 (09:28 +0200)]
Clang-format before editing.

6 years agoBugfix rck.
David Given [Thu, 13 Sep 2018 22:38:31 +0000 (00:38 +0200)]
Bugfix rck.

6 years agoFix csa and csb.
David Given [Thu, 13 Sep 2018 22:15:43 +0000 (00:15 +0200)]
Fix csa and csb.

6 years agoMake work with clang.
David Given [Thu, 13 Sep 2018 22:04:25 +0000 (00:04 +0200)]
Make work with clang.

6 years agoFix an incorrect instruction, and incredibly broken li handling.
David Given [Wed, 12 Sep 2018 21:59:09 +0000 (23:59 +0200)]
Fix an incorrect instruction, and incredibly broken li handling.

6 years agoConverting floats and doubles to integers now works, as much as these ever do
David Given [Wed, 12 Sep 2018 21:58:48 +0000 (23:58 +0200)]
Converting floats and doubles to integers now works, as much as these ever do
on MIPS; turns out that it can't (or at least can't in qemu) reliably turn
INT_MIN from a double to an int.

6 years agomcg now uses dataf4 and dataf8 to emit floating point constants, and so doesn't
David Given [Wed, 12 Sep 2018 21:19:32 +0000 (23:19 +0200)]
mcg now uses dataf4 and dataf8 to emit floating point constants, and so doesn't
need flt_arith any more. (And also generates them correctly on little-endian
systems.) as now parses numbers properly, doesn't trash memory all over the
place, and can handle negative numbers.

6 years agoMake sure li works properly when loading fixed up values which end up as 0. Use
David Given [Wed, 12 Sep 2018 20:28:40 +0000 (22:28 +0200)]
Make sure li works properly when loading fixed up values which end up as 0. Use
lui rather than li to load high values.

6 years agoAdding new tokens to the assembler isn't quite as easy as I thought: ensure
David Given [Wed, 12 Sep 2018 20:27:39 +0000 (22:27 +0200)]
Adding new tokens to the assembler isn't quite as easy as I thought: ensure
that NUMBERF is stored properly in the temporary file.

6 years agoValues are more useful shown in hex.
David Given [Tue, 11 Sep 2018 21:17:09 +0000 (23:17 +0200)]
Values are more useful shown in hex.

6 years agoFix an unsubtle bug where subtractions were done backwards...
David Given [Tue, 11 Sep 2018 21:16:50 +0000 (23:16 +0200)]
Fix an unsubtle bug where subtractions were done backwards...

6 years agoFix a subtle thinko which was causing bits 2-3 of jump targets to be reset.
David Given [Tue, 11 Sep 2018 21:16:30 +0000 (23:16 +0200)]
Fix a subtle thinko which was causing bits 2-3 of jump targets to be reset.

6 years agoAdd huge numbers of failing tests.
David Given [Mon, 10 Sep 2018 21:40:03 +0000 (23:40 +0200)]
Add huge numbers of failing tests.

6 years agoAdd the bitset helpers. We now have enough helpers for the tests to run (and
David Given [Mon, 10 Sep 2018 21:37:28 +0000 (23:37 +0200)]
Add the bitset helpers. We now have enough helpers for the tests to run (and
massively fail).

6 years agoDo some cleanup; ha16[] and friends can now be used with li.
David Given [Mon, 10 Sep 2018 21:37:04 +0000 (23:37 +0200)]
Do some cleanup; ha16[] and friends can now be used with li.

6 years agoReplaced some incorrect hi16s with ha16s.
David Given [Mon, 10 Sep 2018 21:21:54 +0000 (23:21 +0200)]
Replaced some incorrect hi16s with ha16s.

6 years agoAdded some more very untested helper functions.
David Given [Mon, 10 Sep 2018 21:20:52 +0000 (23:20 +0200)]
Added some more very untested helper functions.

6 years agoAdd the .dataf4 and .dataf8 directives to the assembler --- manually converting
David Given [Mon, 10 Sep 2018 20:56:18 +0000 (22:56 +0200)]
Add the .dataf4 and .dataf8 directives to the assembler --- manually converting
floats and doubles to bytes is not fun. It might even work!

6 years agoAnsify.
David Given [Mon, 10 Sep 2018 20:55:05 +0000 (22:55 +0200)]
Ansify.

6 years agoClang-format before editing.
David Given [Mon, 10 Sep 2018 20:42:30 +0000 (22:42 +0200)]
Clang-format before editing.

6 years agoClang-format before editing.
David Given [Mon, 10 Sep 2018 20:37:04 +0000 (22:37 +0200)]
Clang-format before editing.

6 years agoClang-format before editing.
David Given [Mon, 10 Sep 2018 20:25:14 +0000 (22:25 +0200)]
Clang-format before editing.

6 years agoLots more untested helper functions.
David Given [Sun, 9 Sep 2018 23:08:25 +0000 (01:08 +0200)]
Lots more untested helper functions.

6 years agoAdded some more incredibly untested helper functions.
David Given [Sun, 9 Sep 2018 22:21:16 +0000 (00:21 +0200)]
Added some more incredibly untested helper functions.

6 years agoMerge from default.
David Given [Sun, 9 Sep 2018 16:58:07 +0000 (18:58 +0200)]
Merge from default.

6 years agoThinko fix.
David Given [Sun, 9 Sep 2018 16:57:44 +0000 (18:57 +0200)]
Thinko fix.

6 years agoUse the correct ELF processor flags; align properly.
David Given [Sun, 9 Sep 2018 16:57:35 +0000 (18:57 +0200)]
Use the correct ELF processor flags; align properly.

6 years agoCall proper Linux system calls proper-like.
David Given [Sun, 9 Sep 2018 16:57:12 +0000 (18:57 +0200)]
Call proper Linux system calls proper-like.

6 years agoRemember to preserve input registers if we're going to be reading from them
David Given [Sun, 9 Sep 2018 16:53:49 +0000 (18:53 +0200)]
Remember to preserve input registers if we're going to be reading from them
after writing to the output register.

6 years agoCall atexit handlers properly, avoiding a NPE and seg fault every time a
David Given [Sun, 9 Sep 2018 16:51:00 +0000 (18:51 +0200)]
Call atexit handlers properly, avoiding a NPE and seg fault every time a
program exits.

6 years agoYikes! Turns out that FPU registers are only 32 bits wide, and doubles are
David Given [Sun, 9 Sep 2018 16:25:00 +0000 (18:25 +0200)]
Yikes! Turns out that FPU registers are only 32 bits wide, and doubles are
stored in pairs, just like on the PowerPC!

6 years agoAllow the ELF processor flags to be set. Generate MIPS ELF executables, not
David Given [Sun, 9 Sep 2018 12:29:34 +0000 (14:29 +0200)]
Allow the ELF processor flags to be set. Generate MIPS ELF executables, not
PowerPC ones.

6 years agoRework relocations again: add RELO2HI and RELO2HISAD for the high two bytes of
David Given [Sun, 9 Sep 2018 12:11:11 +0000 (14:11 +0200)]
Rework relocations again: add RELO2HI and RELO2HISAD for the high two bytes of
a word.

6 years agoFix some niggling issues --- we have our first binary now!
David Given [Sun, 9 Sep 2018 10:24:22 +0000 (12:24 +0200)]
Fix some niggling issues --- we have our first binary now!

6 years agoSimplify MIPS relocations. Add RELS2 (for generic high-word relocations). Add
David Given [Sun, 9 Sep 2018 10:23:59 +0000 (12:23 +0200)]
Simplify MIPS relocations. Add RELS2 (for generic high-word relocations). Add
support for MIPS branch-and-jump relocations.

6 years agoWarning fix.
David Given [Sun, 9 Sep 2018 10:22:59 +0000 (12:22 +0200)]
Warning fix.

6 years agoAdded some very untested csa and csb implementations, based on the PowerPC
David Given [Sat, 8 Sep 2018 21:12:57 +0000 (23:12 +0200)]
Added some very untested csa and csb implementations, based on the PowerPC
ones.

6 years agoAdded hi[] and lo[] functions to the assembler; fix things enough that we now
David Given [Sat, 8 Sep 2018 20:42:06 +0000 (22:42 +0200)]
Added hi[] and lo[] functions to the assembler; fix things enough that we now
get to the point of failing to link programs.

6 years agoRework floating point conversion. Bash enough of the table into workingness
David Given [Sat, 8 Sep 2018 20:06:38 +0000 (22:06 +0200)]
Rework floating point conversion. Bash enough of the table into workingness
that the libraries build now.

6 years agoPrecisely one stack hreg gets allocated for each vreg/congruence group for
David Given [Sat, 8 Sep 2018 16:59:55 +0000 (18:59 +0200)]
Precisely one stack hreg gets allocated for each vreg/congruence group for
eviction; this prevents us from having to worry about moving values from stack
slot to stack slot, which is hard.

6 years agoMIPS appears to hate converting unsigneds to floats and vice versa.
David Given [Wed, 5 Sep 2018 21:53:38 +0000 (23:53 +0200)]
MIPS appears to hate converting unsigneds to floats and vice versa.

6 years ago(Slightly) better errors on phi congruence group mismatches.
David Given [Wed, 5 Sep 2018 21:53:08 +0000 (23:53 +0200)]
(Slightly) better errors on phi congruence group mismatches.

6 years agoWe attempt to compile the first library function; we fail.
David Given [Tue, 4 Sep 2018 22:13:01 +0000 (00:13 +0200)]
We attempt to compile the first library function; we fail.

6 years agoAdded library skeletons.
David Given [Tue, 4 Sep 2018 22:07:07 +0000 (00:07 +0200)]
Added library skeletons.

6 years agoAdded a boot.o based on the PowerPC one.
David Given [Tue, 4 Sep 2018 22:00:13 +0000 (00:00 +0200)]
Added a boot.o based on the PowerPC one.

6 years agoThe examples all compile now (probably incorrectly, and the libc doesn't
David Given [Tue, 4 Sep 2018 21:55:28 +0000 (23:55 +0200)]
The examples all compile now (probably incorrectly, and the libc doesn't
compile yet).

6 years agoLots of assembler and rule bugfixing.
David Given [Tue, 4 Sep 2018 21:43:24 +0000 (23:43 +0200)]
Lots of assembler and rule bugfixing.

6 years agoAdded li and la instructions.
David Given [Mon, 3 Sep 2018 20:47:41 +0000 (22:47 +0200)]
Added li and la instructions.

6 years agoAdd in floating point support to the code generator.
David Given [Mon, 3 Sep 2018 20:06:05 +0000 (22:06 +0200)]
Add in floating point support to the code generator.

6 years agomcgg now checks that registers have at most one type attribute set.
David Given [Mon, 3 Sep 2018 20:03:57 +0000 (22:03 +0200)]
mcgg now checks that registers have at most one type attribute set.

6 years agoAdd some painfully untested FPU instructions.
David Given [Sun, 2 Sep 2018 19:36:09 +0000 (21:36 +0200)]
Add some painfully untested FPU instructions.

6 years agoThe MIPS backend is still full of holes, and cut-and-pasted PowerPC code, but
David Given [Sun, 2 Sep 2018 16:57:25 +0000 (18:57 +0200)]
The MIPS backend is still full of holes, and cut-and-pasted PowerPC code, but
is beginning to look like an actual code generator.

6 years agoBetter error reporting for unterminated strings.
David Given [Sun, 2 Sep 2018 16:55:44 +0000 (18:55 +0200)]
Better error reporting for unterminated strings.

6 years agoMerge pull request #120 from davidgiven/dtrg-no
David Given [Sun, 2 Sep 2018 11:15:11 +0000 (13:15 +0200)]
Merge pull request #120 from davidgiven/dtrg-no

Remove the built-in preprocessor in cemcom.ansi

6 years agoRemove stray #include.
David Given [Sun, 2 Sep 2018 10:54:53 +0000 (12:54 +0200)]
Remove stray #include.

6 years agoRip out the built-in preprocessor from cemcom.ansi, now it's no longer used.
David Given [Sun, 2 Sep 2018 10:50:50 +0000 (12:50 +0200)]
Rip out the built-in preprocessor from cemcom.ansi, now it's no longer used.

6 years agoDisable the built-in preprocessor in cemcom.ansi; the external preprocessor is
David Given [Sun, 2 Sep 2018 10:39:00 +0000 (12:39 +0200)]
Disable the built-in preprocessor in cemcom.ansi; the external preprocessor is
always run. Fix a bug in block skipping in the preprocessor.

6 years agoImplement single-line C++-style comments.
David Given [Sun, 2 Sep 2018 10:14:59 +0000 (12:14 +0200)]
Implement single-line C++-style comments.

Fixes: #118

6 years agoRun through clang-format before editing.
David Given [Sun, 2 Sep 2018 10:04:33 +0000 (12:04 +0200)]
Run through clang-format before editing.

6 years agoRun through clang-format before editing.
David Given [Sun, 2 Sep 2018 09:49:40 +0000 (11:49 +0200)]
Run through clang-format before editing.

6 years agoRun files through clang-format before editing.
David Given [Sun, 2 Sep 2018 09:36:15 +0000 (11:36 +0200)]
Run files through clang-format before editing.

6 years agoConvert CRLF into LF on read; this should avoid problems with parsing CRLF files.
David Given [Sun, 2 Sep 2018 09:30:20 +0000 (11:30 +0200)]
Convert CRLF into LF on read; this should avoid problems with parsing CRLF files.

Fixes #117.

6 years agoRun files through clang-format before editing.
David Given [Sun, 2 Sep 2018 09:16:06 +0000 (11:16 +0200)]
Run files through clang-format before editing.

6 years agoAdd a completely non-tested table-based MIPS assembler.
David Given [Sat, 1 Sep 2018 17:35:31 +0000 (19:35 +0200)]
Add a completely non-tested table-based MIPS assembler.

6 years agoMerge.
David Given [Sat, 1 Sep 2018 13:34:36 +0000 (15:34 +0200)]
Merge.

6 years agoThe default installation location should be /usr/local.
David Given [Sat, 1 Sep 2018 13:34:01 +0000 (15:34 +0200)]
The default installation location should be /usr/local.

6 years agoMerge pull request #112 from davidgiven/dtrg-te
David Given [Sat, 1 Sep 2018 09:49:28 +0000 (11:49 +0200)]
Merge pull request #112 from davidgiven/dtrg-te

Add tea-ci CI for Windows builds