David Given
91e277e046
Predicates work; we now have prefers and requires clauses. Predicates must be
...
functions. Not convinced that semantic types are actually working --- there are
still problems with earlier statements leaving things in the wrong registers.
2016-10-01 13:56:52 +02:00
David Given
4a3a9a98dc
It doesn't really make a lot of sense to have BURG nonterminal names different
...
to register classes, so combine them. Refactor the map code.
2016-10-01 12:17:14 +02:00
David Given
3a973a19f3
Move fatal(), warning() and aprintf() into the new data module (because they're
...
really useful).
2016-09-30 19:10:30 +02:00
David Given
b32883b013
More properly keep track of register classes.
2016-09-29 22:32:43 +02:00
David Given
b27758b7de
Error check fragment rules which don't emit anything.
2016-09-29 22:14:11 +02:00
David Given
0d246c0d73
Much better handling of fragments (no run-time code needed to distinguish them
...
from registers) and better handling of individual hops within a paragraph ---
no more ghastly hacks to try and distinguish the input from the output.
2016-09-29 22:06:04 +02:00
David Given
a0131fdb47
You know what, the type inference stuff is a complete red herring. What this
...
actually needs is a more intelligent register allocator. So, remove the type
inference.
2016-09-29 19:58:02 +02:00
David Given
ba1a3656a1
You can tell whether an item already exists in the array when calling
...
array_appendu() now.
2016-09-28 23:39:00 +02:00
David Given
4572f1b774
Actually, I don't need vregs: hops work just as well. Particularly if I
...
restructure things so that I don't need to walk the blasted ir / burg tree
every time I look at an instruction.
2016-09-27 23:38:47 +02:00
David Given
e77c5164cf
Fleshed out hops and vregs. The result is almost looking like code now ---
...
uncanny.
2016-09-27 00:19:45 +02:00
David Given
f552c9c7c6
Move map into the data module.
2016-09-26 23:03:04 +02:00
David Given
c4b8e00ae2
Revamp the array module not to use nasty macros any more. Slightly more verbose
...
to use, but definitely cleaner.
2016-09-26 22:48:58 +02:00
David Given
3671892c34
Move the array library into the data module.
2016-09-26 22:24:49 +02:00
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
67eb21d428
Rename struct insn to struct em (throughout).
2016-09-25 12:29:03 +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
717b77dd0a
Instruction selection is so important the file needs a longer name.
2016-09-24 22:50:53 +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
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