Bill Currie
388b6e6e8f
Add set_size ().
...
Return the number of members in the set.
2012-11-15 13:44:07 +09:00
Bill Currie
8567508963
Rewrite set_first() and add set_next().
...
set_first() now returns a pointer to a setstate_t struct that holds the
state necessary for scanning a set. set_next() will automatically delete
the state block when the end of the set is reached. set_delstate() is also
provided to allow early termination of the scan.
2012-11-15 13:44:07 +09:00
Bill Currie
2da038ce0f
Bring back dot_flow.c.
...
However, it produces simplified flow graphs (ie, just nodes and edges, no
statements, though later on data flow information will be added).
2012-11-15 13:44:07 +09:00
Bill Currie
8b374305d2
Rename dot_flow.c and print_flow.
...
They're now dot_sblock.c and print_sblock. The new names both better
reflect their purpose and free up "flow" for outputting the real flow
analysis graphs.
2012-11-15 13:44:07 +09:00
Bill Currie
c483770121
Rework flow.c with the aim of graph reduction.
...
Much of the data recently added to sblock_t has been moved to flownode_t.
No graph reduction is carried out yet, but the initial (innermost level)
graph has been built.
2012-11-15 13:44:07 +09:00
Bill Currie
da446fd343
Detect natural loops.
...
Non-nested loops that have the same head-node are merged into one loop.
However, loop nesting is not currently detected (next step).
2012-11-15 13:44:07 +09:00
Bill Currie
8fb958603c
Add set_first.
...
It returns the first element of a set. If the set is empty, -1 (unsigned)
is returned.
2012-11-15 13:44:07 +09:00
Bill Currie
4cc8d4a04b
Fix an apparent snafu in set_test.
...
It looks like a bit of case&paste where I forgot to change != to &.
2012-11-15 13:44:07 +09:00
Bill Currie
1fead50f4e
Calculate the dominators of each node in the flow graph.
...
The dominators are represented by sets using the node numbers.
2012-11-15 13:44:07 +09:00
Bill Currie
964ea7f9fe
Add set_as_string for debug output.
2012-11-15 13:44:07 +09:00
Bill Currie
d2fab28d01
Implement set_is_member.
...
Oops, forgot that one.
2012-11-15 13:44:06 +09:00
Bill Currie
7853bf1859
Calculate a node's successors and predecessors.
...
The dot graphs are a little odd (arrow heads on the wrong end of the
predecessor edges), but things seem to be correct.
2012-11-15 13:44:06 +09:00
Bill Currie
739ebc522c
Begin working on flow analysis.
...
For now, variable and flow graph node maps are built.
2012-11-15 13:44:06 +09:00
Bill Currie
f30010b367
Add some docs to function.h
2012-11-15 13:44:06 +09:00
Bill Currie
5acf474882
Double quote dag labels.
...
Dot interprets escape sequences in non-html string, and needs the quotes to
be escaped, so quote the result of operand_string. Unfortunately,
operand_string uses quote_string and quote_string returns a static pointer,
so some hoop-jumping is necessary.
2012-11-15 13:44:06 +09:00
Bill Currie
cdc790d0c8
Add a set type and support code.
2012-11-15 13:44:06 +09:00
Bill Currie
60d03dbdd9
Fix the naive opcode checks.
...
Confusing . with .=, and < and <= with more <MOVE etc isn't good.
2012-11-15 13:44:06 +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
a22260030a
Use value for pointer operands.
...
This allows daglabels on pointer operands without a redundant daglabel
pointer.
2012-11-15 13:44:06 +09:00
Bill Currie
0c58cd9067
Generate only one daglabel for value operands.
...
As each value is now unique, their labels can also be unique, which will
improve CSE.
2012-11-15 13:44:06 +09:00
Bill Currie
16869cabd1
Fix a slew of uninitialized data problems.
...
Bah, structs on stacks... good fun :P
2012-11-15 13:44:06 +09:00
Bill Currie
01c8aaae8c
Add some error checking for attaching identifiers.
2012-11-15 13:44:06 +09:00
Bill Currie
0ccf4093e4
Handle attached identifier labels correctly.
...
I'd forgotten I had the prev field. Makes for much cleaner code.
2012-11-15 13:44:06 +09:00
Bill Currie
0cedf0d13a
Fix a bunch of mis-uses of an expressions's value.
...
The value field really should be treated as constant.
2012-11-15 13:44:06 +09:00
Bill Currie
28ce35f1c1
Make values independent objects.
...
values are now uniquely allocated (for the current object file). With
this, constants in dags will work.
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
39506881c0
Fix the completely bogus handling of "x" in dag creation.
...
That made a complete mashup of attached identifiers :P
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
aa72f263ec
Use an extra temp for v6 float modulo.
...
It seems the dag creation algorithm doesn't like "a = a op a", so use
"b = a op a" instead. Since I plan on fixing temp leaks anyway, this won't
be a problem (also, few people even use qfcc's v6 float modulo :P).
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
7b2e426545
Support temp operands in dags.
2012-11-15 13:44:05 +09:00
Bill Currie
9bc65ffedb
Start actually trying to build dags.
...
Temporary variables aren't being handled correctly (treated as constants),
but it looks like a good start.
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
8015e1b1e9
Put the dags stuff into a qfcc sub-section.
...
Not much point writting docs if they can't be found.
2012-11-15 13:44:05 +09:00
Bill Currie
aa2943709e
Start work on building dags from basic blocks.
...
Doesn't compile and the design is in flux anyway, but I want to get back to
iqm.
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
Bill Currie
d5c831b6da
Add a little test case for accessing types.
...
Using ruamoko to access ruamoko type encodings is actually quite pleasant
:)
2012-11-15 13:40:11 +09:00
Bill Currie
ee8247ec61
Support using enums as array indices.
2012-11-15 13:39:23 +09:00
Bill Currie
f18a4d3c4a
Support pointer - pointer.
2012-11-15 13:38:57 +09:00
Bill Currie
552142497e
Support progs.dat when dumping type encodings.
...
Knock up a quick and dirty progs-to-qfo "converter" (strings and types
only) to re-use the qfo types dumper.
2012-11-15 11:58:13 +09:00
Bill Currie
9691b50f0f
Make .type_encodings more useful.
...
Rather than just a pointer, it is now a struct with a pointer and size
indicating the extent of the type encodings block.
2012-11-15 11:57:16 +09:00
Bill Currie
74ac4ee142
Fix a misplaced line.
2012-11-15 11:00:51 +09:00
Bill Currie
39c1034afb
Relocate the data in the type encodings space.
...
Because of the way it is used, the data in the type encodings space needs
to always be correct (ie, relocated), even for partially linked object
files.
2012-11-14 20:37:19 +09:00
Bill Currie
453ac11bc3
Correct some comments.
2012-11-14 17:13:14 +09:00
Bill Currie
2685d38059
More paranoia when dumping qfo type encodings.
2012-11-14 16:32:41 +09:00
Bill Currie
3b3e013d4a
Do not demand a defined def is actually global.
...
Rather, only that it is neither external nor local. The idea was to catch
myself swapping the arguments to resolve_external_def, but for some reason
I decided type encoding defs would not be global (save game reasons?).
2012-11-14 15:50:55 +09:00
Bill Currie
acc188d62b
Ressurect the builtin symbol type fixup.
...
I was a little overzealous when gutting process_type_space :P
2012-11-14 15:49:19 +09:00
Bill Currie
9d7b8a4cf2
Add optional arguments to the todo list.
...
Interesting alternative to overloaded functions.
2012-11-14 14:55:36 +09:00