Commit graph

6824 commits

Author SHA1 Message Date
David Given 1516657907 Crudely bolt on mcgg to mcg itself. 2016-09-24 17:20:40 +02:00
David Given 13132128a1 Parameters are parsed with getopt. Simplify, constify. 2016-09-24 16:59:49 +02:00
David Given 434eafd35d Change the predicate stuff to use costs instead; now you can use when clauses
on leaves. Remove an iburg premature optimisation (required for above).
2016-09-24 13:33:59 +02:00
David Given d96ceea08a Lots of exploratory new grammar for instruction definitions and string and
fragment emission (none of which is hooked up to anything yet).
2016-09-24 13:08:17 +02:00
David Given 960259f0b0 Add support for labelled tree nodes. 2016-09-24 12:11:30 +02:00
David Given 6643d39b2c Fix some late-night typo bugs. 2016-09-24 01:09:32 +02:00
David Given bb9aa030a5 Procedure compilation now happens after the entire EM file has been read in (so
that we can look inside data blocks which might be defined in the future...
sigh, csa and csb). csa and csb no longer generate invalid IR.
2016-09-24 01:04:00 +02:00
David Given ed67d427c9 Replaced the block splicer with a trivial block eliminator (which rewrites
jumps to blocks which contain only a jump). Don't bother storing the bb graph
in the ir nodes; we can find it on demand by walking the tree instead ---
slower, but much easier to understand and more robust. Added a terrible map
library.
2016-09-23 23:59:15 +02:00
David Given f8bbf9e87d Each pass now lives in its own source file; much cleaner. 2016-09-23 21:07:16 +02:00
David Given 9077baa850 Add a bodged in algorithm for converting basic block communication from stacked
variables to SSA. Also add dead block removal and block splicing. IR code is
much better now.
2016-09-22 23:19:29 +02:00
David Given 6a74cb2e11 Tracing cleanup. Simplified the IR code. Some more opcodes. 2016-09-22 00:15:48 +02:00
David Given 4546dd5f22 Massive grammar overhaul and refactor. Hacked in support for predicates, where
instructions can be turned on and off based on their parameters. New lexer
using a lexer. Now quite a lot of the way towards being a real instruction
selector.
2016-09-21 00:43:10 +02:00
David Given 2183c6c622 Run through clang-format. 2016-09-20 21:00:16 +02:00
David Given 03b7202e54 Strip out surplus files. Rewrite README. 2016-09-20 20:46:45 +02:00
David Given 5cb3fbb3d3 Import iburg. 2016-09-20 20:44:51 +02:00
David Given 13c117d15d Import iburg. 2016-09-20 20:37:16 +02:00
David Given 36d7d1ee4e Create hacky fake basic blocks for data fragments, used to track which
instruction labels descriptor blocks refer to; this allows csa and csb to know
where they're going.
2016-09-20 00:19:39 +02:00
David Given dcba03646b Treebuilder now gets to the bottom of my test file, merrily generating
(probably horribly broken) IR.
2016-09-19 23:30:41 +02:00
David Given 6ce2495aeb Store the EM code up front and build the basic block graph *before*
generating the IR code. Lots more IR code.
2016-09-19 23:06:59 +02:00
David Given 176cd7365c Archival checking of the half-written IR treebuilder. 2016-09-18 23:24:54 +02:00
David Given f992eb28ac ANSIise to fix warnings. 2016-09-18 00:23:42 +02:00
David Given 24380e2a93 Abstract out the EM reader; skeleton of the tree builder. 2016-09-18 00:02:16 +02:00
David Given 2eee391aef Basic skeleton of em parser. 2016-09-17 22:21:47 +02:00
David Given 52ad82f8b9 Merge pull request #3 from kernigh/ego-fix
Fix bugs with memory allocation in ego.
2016-09-10 11:25:21 +02:00
George Koehler b1d1b5e1f8 Fix bugs with memory allocation in ego.
cf/cf_loop.c and share/put.c tried to read the next pointer in an
element of a linked list after freeing the element.  ud/ud_copy.c
tried to read beyond the end of the _defs_ array: it only has
_nrexpldefs_ elements, not _nrdefs_ elements.

These bugs caused core dumps on OpenBSD.  Its malloc() put _defs_ near
the end of a page, so reading beyond the end crossed into an unmapped
page.  Its free() wrote junk bytes and changed the next pointer to
0xdfdfdfdfdfdfdfdf.
2016-09-09 23:37:43 -04:00
David Given 8c94b1316c Add unlink system call. 2016-09-04 19:23:02 +02:00
David Given 56e13e24e0 Cleanup some stray files. 2016-09-03 19:22:38 +02:00
David Given 1b8df04e58 Add modeline, fix formatting. 2016-09-03 19:17:09 +02:00
David Given 95ad06849b Updated. 2016-09-03 19:07:12 +02:00
David Given de2f99dc1a More documentation. 2016-09-03 19:01:47 +02:00
David Given ea4142daee First half of the ackbuilder documentation. 2016-09-03 01:04:16 +02:00
David Given ff9bf5b08a Makefiles are now slightly less inaccurate. Does actually seem to do sensible
incremental builds now. I loathe make.
2016-09-03 00:20:11 +02:00
David Given de7023dd61 Add an install target. 2016-09-02 23:03:57 +02: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 96e7447bfa Clean up the top level makefile. 2016-09-01 23:36:39 +02:00
David Given 2b6d251dec Fix a fun bug where, every now again, ego would get its temporary files mangled
and generate invalid calls to the optimisers.

Previously ego would generate a temporary file template that looked like
/tmp/ego.A.BB.XXXXXX, call mktemp() on it to randomise the XXXXXX, and then
replace A and BB with data.

However, it used strrchr to find the A and B. Which would fine, except when
mktemp produced an A or a B in the randomised part...

This code was written on 4 March 1991. I was 16.
2016-08-22 23:53:01 +02:00
David Given 2a95b1c5e3 Forgot to check a file in. 2016-08-22 22:45:32 +02:00
David Given 5bae29a00c ego now builds and is used.
This needed lots of refactoring to ego --- not all platforms have ego descr
files, and ego will just crash if you invoke it without one. I think originally
it was never intended that these platforms would be used at -O2 or above.

Plats now only specify the ego descr file if they have one.
2016-08-21 22:01:19 +02:00
David Given 08823a172c filenamesof() an installable now returns all installed files, not just the ones
at the top level (necessary to make a lot of the dependency stuff work when
using tools which depend on installables).
2016-08-21 21:55:21 +02:00
David Given 84ee7c9cc4 Fix linking bug where em_decode would generate binary data instead of text. 2016-08-21 20:27:52 +02:00
David Given 2b2bd93e44 Run through clang-format. 2016-08-21 20:08:05 +02:00
David Given 44b6421519 Run through clang-format. 2016-08-21 19:53:14 +02:00
David Given 671bf250f5 Run through clang-format. 2016-08-21 19:46:19 +02:00
David Given 918f300513 Run through clang-format. 2016-08-21 19:38:54 +02:00
David Given 1b66b63eae Run through clang-format. 2016-08-21 19:38:02 +02:00
David Given 3584ddb6e9 Push through clang-format. 2016-08-21 19:34:54 +02:00
David Given a4f136f999 Run through clang-format. 2016-08-21 18:51:36 +02:00
David Given 03a0b182c4 Push em_ego.c through clang-format before working on it. 2016-08-21 18:45:25 +02:00
David Given 1a7b4f8729 Build the examples when doing a normal build; this exercises the compiler as a
whole and is one step further towards a proper test suite.
2016-08-20 14:05:24 +02:00