Commit Graph

9001 Commits

Author SHA1 Message Date
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 206ab9a997 Whitespace. 2012-11-14 20:54:35 +09:00
Bill Currie 9a53531d3b Fix a braino in Object's -init.
I'd forgotten AutoreleasePool doesn't like receiving -retain when I did the
retainCount change, and thus Object's -init was a little too naive.
2012-11-14 20:45:29 +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
Bill Currie ef7678fcec Use DWARF debugging with recent gcc.
Oh, wow, I wish I'd known about it before. C macro evaluation in gdb!!!
*sob*
2012-11-14 14:51:23 +09:00
Bill Currie 33eb3f2418 A bit of pointer saftey in add_defs.
Directly accessing odef after can be dangerous (probably not here, but
hey), so use the defref instead.
2012-11-14 13:25:30 +09:00
Bill Currie 00c87434bf A touch of whitespace. 2012-11-14 13:25:03 +09:00
Bill Currie 281e203545 Make process_data_def use the correct def tables.
Fixes the bogus redefined errors when entity fields are used.

Also, rename extern_defs and defined_defs to extern_data_defs and
defined_data_defs (more consistent with the other tables).
2012-11-14 13:14:54 +09:00
Bill Currie e05c12e16d Make linker_add_def take a pointer for the value.
While it looks like I might not use it for the type encodings, it should be
useful in the future.
2012-11-14 13:12:58 +09:00
Bill Currie 51236b0693 Fix the incorrect type space reloc offsets.
The problem was caused by add_relocs and process_loose_relocs adjusting the
reloc offset based on the reloc's space's base address. This is fine for
most relocs, but as relocs for the type space have already been adjusted by
process_type_space, those relocs must be left alone by add_relocs and
process_loose_relocs. As a bonus, the duplicate code has been refactored
into a separate function :)
2012-11-14 10:29:45 +09:00
Bill Currie 31739f4dbf Rewrite the type_space processing.
Now each encoding is copied across def by def using memcpy, with the
expectation that any references to other types will be handled via the
reloc system. Unfortunately, it seems there's an off-by-4 (hmm, suspicious
number...) in the reloc offsets, but I'll look into that after I get some
sleep.
2012-11-13 21:55:54 +09:00
Bill Currie 8625964634 Fix some careless inernal_error changes.
Back when I did the abort->internal_error change, I wasn't paying attention
and forgot I should use linker_internal_error in linker.c.
2012-11-13 21:51:16 +09:00
Bill Currie f80a74228c Add (and use) alloc_data for work qfo data allocations.
defspace_alloc_loc can cause a realloc which will break the work qfo space
data pointers, so wrap it with alloc_data, which updates the appropriate
pointers and sizes.
2012-11-13 21:48:46 +09:00
Bill Currie 5b7b49b100 Add a QFO_TYPE macro to get a qfot_type_t pointer.
In the end, it wasn't used, but it could be handy in the future.
2012-11-13 21:45:54 +09:00
Bill Currie d782622e74 Be more paranoid when dumping qfo type encodings. 2012-11-13 21:24:48 +09:00
Bill Currie f002f3ad7a Escape strings for reloc dumps.
Line feeds messing up the output wasn't nice :P.
2012-11-13 21:14:51 +09:00
Bill Currie 1dd8f34190 Refactor process_def.
The field/data def handling has been moved into process_data_def and
process_field def. The code for handling external defs has been moved into
its own function (extern_def()),

In passing, rename add_space to add_data_space, since it is limited to
handling data spaces.
2012-11-13 13:16:45 +09:00