Commit graph

24 commits

Author SHA1 Message Date
David Given ed91ea4371 When parsing constants which don't fit into an arith, handle overflow properly
(and don't turn them all into INT_MAX...).
2018-09-22 12:45:59 +02:00
David Given ac856f3b09 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.
2018-09-20 00:12:03 +02:00
David Given 8c3670483f Get top working with the PowerPC; use it to eliminate useless branches and
moves.
2016-10-29 23:37:11 +02:00
David Given e3ebf986e9 More opcodes. 2016-10-29 13:32:09 +02:00
David Given b22780c075 More opcodes, including the difficult and fairly stupid los/sts. 2016-10-23 22:24:08 +02:00
David Given 3520704ea8 Add support for floating point constants. 2016-10-18 22:29:42 +02:00
David Given a8ee82d197 Stop passing proc around, and use a global instead --- much cleaner. 2016-10-15 23:19:44 +02:00
David Given 7aa60a6451 Register spilling to the stack frame works, more or less. 2016-10-15 22:53:56 +02:00
David Given 9504aec2bd Function termination gets routed through an exit block; we now have prologues
and epilogues. mcgg now exports some useful data as headers. Start factoring
out some of the architecture-specific bits into an architecture-specific file.
2016-10-15 18:38:46 +02:00
David Given 5ad3aa8595 Add a pile of new instructions used by Pascal; I'm going to need to think about
how locals and the local base are handled.
2016-10-15 13:07:59 +02:00
David Given 8fedf5a0a8 Added support for the op_bXX conditional branch instructions. 2016-10-04 23:28:16 +02:00
David Given b298c27c63 Refactor mcg.h as it's getting a bit big; keep track of register variables. 2016-10-02 00:30:33 +02:00
David Given 3474e20274 Deal with malformed mes instructions emitted by ego. 2016-10-01 23:13:39 +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 67eb21d428 Rename struct insn to struct em (throughout). 2016-09-25 12:29:03 +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 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 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 24380e2a93 Abstract out the EM reader; skeleton of the tree builder. 2016-09-18 00:02:16 +02:00