Commit graph

23 commits

Author SHA1 Message Date
Bill Currie
386a729209 Remove dead nodes from dags.
Dead nodes are those that generate unused values (unassigned leaf nodes,
expressions or destinationless move(p) nodes). The revoval is done by the
flow analysis code (via the dags code) so that any pre and post removal
flow analysis and manipulation may be done (eg, available expressions).
2012-12-25 17:07:58 +09:00
Bill Currie
84a68b139e Rename set_iter_t's value to element.
Correct terminology and all :)
2012-12-21 14:09:00 +09:00
Bill Currie
998868e53c Maybe make dags a little easier to read. 2012-12-11 19:50:31 +09:00
Bill Currie
e0c92b6089 Rename set_iter_t's member to value.
Makes more sense now that the membership of the value depends on the
inversion of the set.
2012-12-06 21:11:38 +09:00
Bill Currie
eb8fd55677 Move set.c into libQFutil.
Also move the ALLOC/FREE macros from qfcc.h to QF/alloc.h (needed to for
set.c).

Both modules are more generally useful than just for qfcc (eg, set
builtins for ruamoko).
2012-12-06 20:52:53 +09:00
Bill Currie
c5f2e3c4ad Make dag dumping from gdb easier. 2012-11-21 15:03:44 +09:00
Bill Currie
bedde02307 Make flow graphs with dags easier to read.
The node contents are now the dag rather than the dag being attached to the
node.
2012-11-21 13:43:03 +09:00
Bill Currie
0c3aeb30aa Reuse tempary variables.
Now that I've got nice code, it was worth doing. Unfortunatly, bsearch
style switch statements have problems.
switch.r:14: BUG: temp users went negative: <tmp 0x21b6840:-1>
switch.r:14: BUG: temp users went negative: <tmp 0x21b6840:-2>
switch.r:14: BUG: temp users went negative: <tmp 0x21b6840:-3>
switch.r:14: BUG: temp users went negative: <tmp 0x21b67d0:-1>
2012-11-18 19:10:18 +09:00
Bill Currie
8fe71f2146 Display a dagnode's extra dependency edges. 2012-11-18 12:55:44 +09:00
Bill Currie
d3f010a81b Fix the flow-dag connections in the flow graphs. 2012-11-18 11:34:01 +09:00
Bill Currie
af4e56bba8 Topologically sort the dag.
It doesn't make any difference yet, but that's because I need to add extra
edges indicating iter-node dependencies. However, the sort does seem to
work for its limited input.
2012-11-18 09:23:01 +09:00
Bill Currie
12133bc02f Rewrite dags to use sets.
While things are quite broken now (very incorrect code is being generated),
the dag is much easier to work with. The dag is now stored in an array of
nodes (the children pointers are still used for dagnode operands), and sets
are used for marking node parents, attached identifiers and (when done,
extra edges).
2012-11-17 21:14:42 +09:00
Bill Currie
43d77900d5 Rewrite dag_gencode to use statement/node types.
It now seems to generate correct code for each node. However, node order is
still incorrect in places (foo++ is being generated as ++foo). quattest.r
actually executes and produces the right output :)
2012-11-16 22:09:49 +09:00
Bill Currie
c1776fc2ad Make the dags in flow graphs a little easier to read. 2012-11-16 12:42:57 +09:00
Bill Currie
783b4082a1 Produce tidier dag dumps. 2012-11-15 13:44:08 +09:00
Bill Currie
dc9d2a982e Make the returned dag a linked list of root-nodes.
A dag can have mulitple "root" nodes (ie, nodes with no parents).
2012-11-15 13:44:06 +09:00
Bill Currie
c57df8b5f3 Print all dag nodes in a dag.
Dags can have multiple roots, so only recursing once could miss much of the
dag.
2012-11-15 13:44:06 +09:00
Bill Currie
dbf1aa8f72 Attach dags to statement blocks.
Now, if a dag is attached to a statement block, it will be included in the
flowgraph with that statement block.
2012-11-15 13:44:06 +09:00
Bill Currie
24553867a4 Use dashed lines for attached identifiers in dags. 2012-11-15 13:44:06 +09:00
Bill Currie
d9354255a3 Avoid double-printing dag nodes. 2012-11-15 13:44:05 +09:00
Bill Currie
b7b6294d87 Fix some dag printing goofs.
Typo and no node recursion.
2012-11-15 13:44:05 +09:00
Bill Currie
60108c688c Change dags from binary to trinary.
I'd forgotten some instructions take three inputs that can benefit from
CSE.
2012-11-15 13:44:05 +09:00
Bill Currie
0fefeb73fe Initial support for basic block dags.
Currently, only dumping to dot, but that seems to be a very sensible place
to start: debug support.
2012-11-15 13:44:05 +09:00