Commit graph

1590 commits

Author SHA1 Message Date
David Given cc176e5183 Keep more data around about ir instructions. Implement a half-baked type
inference routine to propagate information about floats up the tree, so we know
whether to put floats into special registers as early as possible.
2016-09-26 22:12:46 +02:00
David Given 416b13fd76 Start factoring out the hardware op code. 2016-09-25 23:29:59 +02:00
David Given 39aa672422 Sort of keep track of registers and register classes. Start walking the
generated instruction tree --- holy cow, they look like instructions!
2016-09-25 22:17:14 +02:00
David Given bde5792b1a Collapse several rule arrays into one; actually generate the array properly. 2016-09-25 17:14:54 +02:00
David Given bcc74ba18d Stupid stringlist is stupid. Use a proper data structure, properly abstracted
out (so other things can use it).
2016-09-25 12:18:39 +02:00
David Given 9f78e0b36b Rethink the way patterns are mapped to rules; generate emitters (probably
badly).
2016-09-25 11:49:51 +02:00
David Given 7c028bdd45 We now record the code fragments to be emitted by each rule. 2016-09-25 00:21:46 +02:00
David Given 629e0ddfc6 Some instruction selection is now happening. 2016-09-24 22:46:08 +02:00
David Given c8fcbe282a More grammar changes. 2016-09-24 19:03:55 +02:00
David Given 2acc4ed29d IR codes are now owned by mcgg; ir terminals are inserted into the table during
compilation (so you can refer to them).
2016-09-24 18:31:35 +02:00
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 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
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 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 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 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 53c9731036 aal doesn't build the ranlib table if you don't set -DAAL. 2016-08-20 14:04:46 +02:00
David Given f561b94b49 Print hex numbers actually properly this time. 2016-08-20 14:02:12 +02:00
David Given 7b8d9e2d0e Fix compiler warnings and 64bitisms. 2016-08-14 23:01:12 +02:00
David Given a42939df50 LED builds now. 2016-08-14 14:40:01 +02:00
David Given 4d24666432 Move util/data into modules/src/em_data, for consistency with the other
modules.
2016-08-14 14:09:38 +02:00
David Given 262c5fedcf Biggish refactor to break cycles; my build rules were full of them. cpm builds,
which requires top and topgen.
2016-08-14 01:39:40 +02:00
David Given 0d77cb8279 We can build our first C file. 2016-08-07 21:56:53 +02:00
David Given 5e84be70fd Massive ackbuilder refactor --- cleaner and more expressive. Lists
are automatically flattened (leading to better build files), and the
list and filename functions are vastly more orthogonal.
2016-08-04 23:51:19 +02:00
David Given b2bb4ce3b2 Builds libend (the simplest library). Becoming obvious I need to rework the way
ackbuilder deals with lists.
2016-07-30 00:39:22 +02:00
David Given 363d13cc2f C preprocessor; tabgen; now the pc86 boot.s builds using the ack
toolchain.
2016-07-29 00:22:49 +02:00
David Given f9c77fca03 Replace the hacky cflags variable with an equally hacky but vastly
more useful magic vars variable.
2016-07-27 00:10:15 +02:00
David Given cdeea836f2 Replaced the fairly complex environment code with a much simpler
emitter object.
2016-07-26 23:43:31 +02:00
David Given a8a9d1bbfa yacc, ncgg; platform ncg builds now. 2016-07-26 23:35:30 +02:00
David Given bff5c4019c Baby steps towards building a platform --- make the assembler work.
Add ackbuilder support for C preprocessor files and yacc.
2016-07-24 00:50:02 +02:00
David Given 2770a83837 More programs, more libraries. src/modules build files are now saner. 2016-07-23 00:30:31 +02:00