Bill Currie
77806f4b1b
[qfcc] Get dag code generation mostly working
...
There's an ICE in return-ivar, but assignchain passes let alone builds.
2020-03-17 22:35:36 +09:00
Bill Currie
16bda66785
[qfcc] Add more statement types for move/memset
...
They ease the statement checks between assign/move/memset and the
pointer versions (don't need all those strcmps)
2020-03-17 21:39:49 +09:00
Bill Currie
3c2f6c8447
[qfcc] Simplify flow_analyize_pointer_operand
...
and its usage. The parts of flow_analyze_statement that use it know
where the returned operand needs to go. Unfortunately, this breaks dags
pretty hard, but that's because dags needs to learn about the fancy
assignment-type statements.
2020-03-17 21:30:16 +09:00
Bill Currie
dec2e6249e
[qfcc] Increase flow operand count to 5
...
MOVEP instructions have up to 5 operands: 2 pointers, the count, and 0-2
referenced variables (when known).
2020-03-17 21:24:12 +09:00
Bill Currie
fa2cbc72d8
[qfcc] Analyze tempop pointers in move/memset statements
2020-03-17 15:48:06 +09:00
Bill Currie
6ec92fb83b
[qfcc] Point pointer tempop to the operand
...
It turns out I need the operand itself, not just the tempop.
2020-03-17 15:47:42 +09:00
Bill Currie
0de011d0bf
[qfcc] Add some disabled additional statement info
...
It's a bit cluttered for normal debugging, but I haven't decided how to
make it optional just yet.
2020-03-17 15:23:24 +09:00
Bill Currie
0cbe438ac1
[util] Make va slight robust against chained use
...
va now cycles through a set of four dstrings rather than using just the
one. This allows for some simple chaining of va usage.
2020-03-17 15:05:58 +09:00
Bill Currie
c5cbe83f71
[qfcc] Initialize statement numbers to -1
...
This is to indicate the statement has not yet been flow analyzed.
2020-03-17 15:05:58 +09:00
Bill Currie
d02a01c282
[qfcc] Make tempop pointer strings more informative
...
Now that the address of a tempop can be taken, their op strings need to
be visible.
2020-03-17 15:05:58 +09:00
Bill Currie
28a8c1fda7
[qwaq] Implement more curses wrappers
2020-03-17 14:05:31 +09:00
Bill Currie
441e7b99bc
[qfcc] Correctly implement pointer arithmetic
2020-03-17 13:39:22 +09:00
Bill Currie
c5400c4581
[qfcc] Make anonstruct test robust against pointer math
...
I noticed that pointer math is currently incorrect in qfcc, but it would
be nice for fixing it to not break anonstruct since it is testing
something else.
2020-03-17 12:16:24 +09:00
Bill Currie
0d784d9ef4
[qfcc] Rework address expr calculation
...
This removes a bogus lea from the instruction stream (and there can be
many such).
2020-03-17 12:13:09 +09:00
Bill Currie
0d751dcdc5
[qfcc] Improve robustness of do_op_integer
2020-03-17 12:12:06 +09:00
Bill Currie
9cb3ee01d6
[qfcc] Add pointer value check
...
Extraction is a little more complicated, though, so undecided on that.
2020-03-17 11:19:12 +09:00
Bill Currie
c3f04384d5
[qfcc] Make a general integral value extractor
...
All too often I just want the value.
2020-03-17 11:18:37 +09:00
Bill Currie
80967e1471
[qfcc] Support def exprs in integral value extractors
2020-03-17 10:56:45 +09:00
Bill Currie
e4a403bbb3
[qfcc] Improve integral value extraction readability
2020-03-17 10:55:27 +09:00
Bill Currie
888192a9ea
[qfcc] Resurrect ex_def expression type
...
It turns out to be useful still as using symbol expressions isn't always
appropriate and the workarounds were getting nasty.
2020-03-17 01:42:46 +09:00
Bill Currie
fd06cd2b00
[qfcc] Analyze assignment through const pointers
...
This fixes a false-positive uninitialized warning.
2020-03-17 01:40:35 +09:00
Bill Currie
8e6baf1bde
[qfcc] Fix assigning to entity fields
...
At least for basic types. Compound types need testing.
2020-03-17 01:39:35 +09:00
Bill Currie
f9face0cef
[qfcc] Make is_indirect easier to read
2020-03-16 23:26:39 +09:00
Bill Currie
5c0c056e2c
[qfcc] Add is_entity type test helper
2020-03-16 21:07:31 +09:00
Bill Currie
ede7dd6d7e
[qfcc] Catch attempts to emit a bad operand type
2020-03-16 20:31:21 +09:00
Bill Currie
1d10136f2e
[qfcc] Treat all dereferences and indirect
...
Why I had a const pointer test on there is beyond me.
2020-03-16 20:24:22 +09:00
Bill Currie
69924fe717
[qfcc] Return correct value for is_const_ptr
...
It really helps if the logic is not inverted.
2020-03-16 20:21:07 +09:00
Bill Currie
db06300ddd
[qfcc] Make print_operand usable from gdb
...
It not emitting a \n made life difficult, especially whenever gdb
decided to make access to printf or puts awkward.
2020-03-16 20:20:07 +09:00
Bill Currie
b544a052bf
[gamecode] Bail if PR_SearchDefs is given 0 defs
...
Fixes the hang when searching for a field in progs that don't have any.
2020-03-16 14:24:48 +09:00
Bill Currie
c8e45c6cfc
[qfcc] Use operand_address in expr_deref
...
This fixes the technically correct but horrible mess of temps and
addressing when dealing with ivars, and the resulting uninitialized
temps due to the non-constant pointers (do need statement level constant
folding, though).
2020-03-16 14:24:48 +09:00
Bill Currie
b58deb5680
[qfcc] Rewrite operand_address to be much simpler
...
It now creates a pointer value and returns that rather than generating
an address statement.
2020-03-16 14:24:47 +09:00
Bill Currie
a0c28a5ac5
[qfcc] Support pointers to temp operands
...
This is necessary for correctly taking the address of operands.
2020-03-16 14:24:47 +09:00
Bill Currie
2f07d9a310
[qfcc] Improve accuracy of some more diagnostics
2020-03-16 10:42:18 +09:00
Bill Currie
0fe3fda44d
[qfcc] Fix protocol adorned id as message receiver
...
This took a bit as type_id has no class data, only protocols attached to
the type_obj_object instance, and then protocol lists can get deep.
2020-03-16 10:42:18 +09:00
Bill Currie
ea042cf87a
[qfcc] Split out the obj-qc specific expr code
2020-03-16 10:34:16 +09:00
Bill Currie
fb33a7f2a7
[qfcc] Remove "impossible" code
...
It is not possible to adorn Class with protocols, so no need to check
for them when checking if a type is a class.
2020-03-16 10:34:16 +09:00
Bill Currie
e1140d476a
[qfcc] Handle syntax errors in method protos
2020-03-15 16:19:45 +09:00
Bill Currie
e3a1413ad3
[gamecode] Tweak output for lea
2020-03-15 10:06:37 +09:00
Bill Currie
99f89840f9
[gamecode] Show containing def and relative offset
...
No more guessing when accessing structure field members. Next is ivars,
I guess.
2020-03-15 02:51:29 +09:00
Bill Currie
3d62a7f253
[gamecode] Use fuzzy bsearch to find defs by address
...
The idea is to find th def that contains the address. Had to write my
own bsearch (well... lifted from wikipedia) because libc's is exact. The
defs are assumed to be sorted (which qfcc now ensures when it writes
progs and sym files).
2020-03-15 02:48:13 +09:00
Bill Currie
968de155a1
[qfcc] Make some counts unsigned
...
How do you have -1 def?
2020-03-15 01:33:25 +09:00
Bill Currie
9a08a51ebd
[qfcc] Ensure progs defs are sorted by address
2020-03-15 01:32:38 +09:00
Bill Currie
2f9f6d3aa9
[gamecode] Relocate aux function return types
...
They are written with offsets relative to the type encodings base.
2020-03-14 23:39:14 +09:00
Bill Currie
067bc264fa
[qfcc] Set local def size in debug sym file
...
It was getting random garbage. Not good for debuggers.
2020-03-14 22:08:27 +09:00
Bill Currie
20fd5eb80c
[qfcc] Show def size when dumping defs
2020-03-14 22:07:36 +09:00
Bill Currie
327d692992
[qfcc] Correct order of @zero fields
...
This is part of what messed up float_val in the encoding for @params.
The other part is something in the linker type encoding merge code: it
may be too aggressive. It's also what messed up the size of @params.
2020-03-14 22:06:57 +09:00
Bill Currie
9492f08536
[gamecode] Print structs as well as unions
...
Much better :)
2020-03-14 21:03:01 +09:00
Bill Currie
fea6381574
[gamecode] Rework debug type handling a little
...
Type encodings are used whenever they are available. For now, if they
are not, then everything is treated as void (which prints <void>, not
very useful). Most return statements and references to .return are now
very readable (excluding structs), and only params going through "..."
are a messy union.
2020-03-14 20:44:43 +09:00
Bill Currie
877ad35a82
[qwaq] Rework the hierarchy again
...
It doesn't work right now because View unconditionally sends refresh to
its textContext, but textContext can be a draw buffer which does not
respond to refresh. Still, these changes (notably the assignment chain
in qwaq-group.r really pushed qfcc).
2020-03-14 19:45:07 +09:00
Bill Currie
72f4b8ccb5
[qfcc] Give address operands a good expression
...
That is, those created by operand_address. The dag code needs the
expression that is attached to the statement to have the correct
expression type in order to do the right thing with the operands and
aliasing, especially when generating temps. This fixes assignchain when
optimizing (all tests pass again).
2020-03-14 19:26:47 +09:00