Bill Currie
1da6eb5f51
[qfcc] Fix a typo in a comment
2020-03-27 22:17:36 +09:00
Bill Currie
653eabfdbf
[qfcc] Clean up inconsistent type building idioms
2020-03-27 22:11:18 +09:00
Bill Currie
c6483b617c
[qfcc] Remove obsolete notes
...
nil seems to have sorted himself out with the recent reworking of how
qfcc handles nil.
2020-03-27 20:52:37 +09:00
Bill Currie
4d616fab4a
[qfcc] Use the correct statement type for memset
2020-03-27 20:47:42 +09:00
Bill Currie
fdf6fac077
[qfcc] Rewrite expr_nil to use memset if necessary
...
This fixes the problem with returning nil through @param (and probably
structs in general).
2020-03-27 20:32:52 +09:00
Bill Currie
9c556c07bb
[qfcc] Add failing nil return through @param bug
...
I suspect it's general for struts, but nil really is a troubling
character sometimes.
2020-03-27 20:32:52 +09:00
Bill Currie
9e529d1508
[qfcc] Fix some incorrect test runs
...
Checking for float return when should be checking for int return.
Fortunately, the tests still passed.
2020-03-27 20:32:52 +09:00
Bill Currie
01cf28e436
[qfcc] Treat C-style function decls as prototypes
...
This removes the need for extern from the declaration.
2020-03-27 18:08:26 +09:00
Bill Currie
643711ef40
[qfcc] Pre-initialize type_object's strct pointer
...
This ensures that pointers to incomplete struct types are not
misidentified as id before the class system has been initialized.
2020-03-27 17:29:42 +09:00
Bill Currie
498dfdbfef
[qfcc] Clean up Obj-QC type struct names
...
I decided that the obj_ tag was unnecessary.
2020-03-27 15:33:53 +09:00
Bill Currie
ab3d91f0c3
[qfcc] Clean up simple type checking
...
All simple type checks are now done using is_* helper functions. This
will help hide the implementation details of the type system from the
rest of the compiler (especially the changes needed for type aliasing).
2020-03-27 15:16:41 +09:00
Bill Currie
8b1e4eea58
[qfcc] Bring back the core of type aliasing
...
No aliasing is done yet, but most of the infrastructure is there again.
2020-03-27 12:27:46 +09:00
Bill Currie
53fd55143e
[qfcc] Fix missed none->basic rename
2020-03-27 12:26:44 +09:00
Bill Currie
75394cc4f8
[gamecode,qfcc] Use enums for type encoding types
...
The enums are forced to 32 bits via bitfield spec, so can't use sizeof
on them, but this makes switch enum checks work in gcc.
2020-03-27 12:24:14 +09:00
Bill Currie
4de2c6b30e
[qfcc] Move alias expr inside call block expression
...
This fixes the trampled return value when the first expression aliases
the return result.
2020-03-26 20:16:52 +09:00
Bill Currie
98eac2afbc
[qfcc] Hide dependency generation commands
2020-03-26 20:16:32 +09:00
Bill Currie
15d4186fff
[qfcc] Show line numbers in block sub expressions
...
Seems more useful than expression index.
2020-03-26 20:15:50 +09:00
Bill Currie
5fd63b95db
[qfcc] Add a new failing test
...
The struct alias is somehow blocking the detection of the call so the
return value gets corrupted.
2020-03-26 19:22:41 +09:00
Bill Currie
1f8cc7186c
[qfcc] Hide "function" type behind an @
...
I'm not sure it's all that useful and thus it clutters the namespace.
2020-03-25 21:04:22 +09:00
Bill Currie
4cef9792f4
[util] Make hash-tables semi-thread-safe
...
They take a pointer to a free-list used for hashlinks so the hashlink
pools can be per-thread. However, hash tables that are not updated are
always thread-safe, so this affects only updates. progs_t has been set
up such that it is easy for multiple progs within one thread can share
hashlinks.
2020-03-25 15:43:16 +09:00
Bill Currie
9bfd14b687
[qwaq] Bring in qc gcd to use for debugger testing
...
It was even recent enough to compile first try.
2020-03-24 23:02:19 +09:00
Bill Currie
1a7add3f6d
Merge branch 'master' into vulkan
2020-03-20 13:04:41 +09:00
Bill Currie
298fcbbf70
[qfcc] Add ExitCode support to quake-pascal
...
gcd now passes :)
2020-03-20 12:59:25 +09:00
Bill Currie
ed03eeb8d2
[qfcc] Resync qc and qp common symbols
...
Forgot I needed to remove PAS from pascal as well.
2020-03-20 12:59:25 +09:00
Bill Currie
f64038b872
[qfcc] Add gcd.pas to the tests
2020-03-20 12:59:25 +09:00
Bill Currie
7447854d7c
[qfcc] Recover from syntax errors in abstract_decl
2020-03-19 11:01:26 +09:00
Bill Currie
4c6e1b7fc4
[qfcc] Fix some uninitialized variable warnings
...
I really wish gcc would catch more issues when not optimizing.
2020-03-18 01:51:52 +09:00
Bill Currie
0293d335d0
[qfcc] Mark known source def live for movep
...
This fixes ivar-struct-return (and qwaq).
2020-03-18 00:02:36 +09:00
Bill Currie
43ea34535e
[qfcc] Make ivar-struct-return fail
...
It turns out that assignments to struct fields are not counted as live
when the whole struct is later used via a pointer move.
2020-03-17 23:39:17 +09:00
Bill Currie
22cd39c853
[qfcc] Mark ptr assignment offset as an operand
...
This fixes structptr. All current tests pass.
2020-03-17 23:05:57 +09:00
Bill Currie
578bf9a16f
[qfcc] Set dag node value for movep
...
This fixes compilation of all tests. However, structptr still fails.
2020-03-17 22:54:27 +09:00
Bill Currie
34c9ec51bb
[qfcc] Make opcode and statement type names available
2020-03-17 22:46:23 +09:00
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
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
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
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
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
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
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
Bill Currie
025dd63493
[qfcc] Bubble right-hand assignee back up chain
...
This fixes assignchain when not optimizing. There are problems in dags,
though, with address expressions.
2020-03-14 17:48:53 +09:00
Bill Currie
97e0c23529
[qfcc] Create a nil operand
...
This is for struct assignments so they can pass the source operand back
up the assignment chain.
2020-03-14 17:47:23 +09:00
Bill Currie
eca976e5ae
[qfcc] Expose l-value checking
...
Needed for assignment chains.
2020-03-14 17:45:54 +09:00
Bill Currie
7d5644e055
[qfcc] Save operand creator return address
2020-03-14 17:44:54 +09:00
Bill Currie
51a30de9c5
[qfcc] Print accurate linenos for more ICEs
2020-03-14 16:51:54 +09:00
Bill Currie
6608c8a1f6
Revert "Support taking the address of block expressions that have a result."
...
This reverts commit c78d15b331
.
While a block expression's result may be an l-value, block expressions
are not (and their results may not be), thus taking the address of one
is not really correct. It seems the only place that tries to do so is
the assignment code when dealing with structures.
2020-03-14 13:14:25 +09:00
Bill Currie
277ff719f5
Revert "Do not lose the block expression when taking its address."
...
This reverts commit b49d90e769
.
I suspect this was a workaround for the mess in assignment chains.
However, it caused compile errors with the new implementation, and is
just bogus anyway.
2020-03-14 12:30:18 +09:00
Bill Currie
7cc51c9ca3
[qfcc] Save block expression creator's address
...
I've already found the bug that necessitated it (and the creator was
innocent), but it will help later.
2020-03-14 12:27:23 +09:00
Bill Currie
d30c895c13
[qfcc] Use correct assignment statement type
...
Just another minor detail lost in the assignment rewrite. With this, all
tests pass when optimizing.
2020-03-14 11:36:42 +09:00
Bill Currie
a98f0e04eb
[qfcc] Correct some misinformative prints
2020-03-14 01:28:00 +09:00
Bill Currie
b1459ac816
[qfcc] Move return save temp into call block
...
This fixes func-expr after the assignment rewrite. Now all tests pass
when not optimizing (something not quite right in assignchain when
optimizing).
2020-03-14 01:24:13 +09:00
Bill Currie
57134e01cd
[qfcc] Handle l-value pointer dereferences again
...
While I still hate ".=", at least it's more hidden, and the new
implementation is a fair bit cleaner (hah, goto a label in an if (0) {}
block).
Most importantly, the expression tree code knows nothing about it. Now
just to figure out what broke func-epxr. A bit of whack-a-mole, but yay
for automated tests.
2020-03-14 01:04:05 +09:00
Bill Currie
d150210888
[qfcc] Nuke PAS from orbit
...
And there was much rejoicing. I hated having to create that opcode.
2020-03-13 21:03:48 +09:00
Bill Currie
de89f2f31f
[qfcc] Fix a test that wasn't failing when it should
2020-03-13 20:47:57 +09:00
Bill Currie
f738639d68
Revert "[qfcc} Mark some more functions as pure"
...
This reverts commit 65b48c734c
.
I forgot that get_type calls convert_name, which most definitely is not
pure. Fixes the segfault in scheme.
2020-03-13 19:58:34 +09:00
Bill Currie
e22579d70e
[qfcc] Analyze memset target pointer
...
This fixes the false uninitialized warnings cause by nil migration.
2020-03-13 18:28:54 +09:00
Bill Currie
3d88c3845f
[qfcc] Move struct copy/set into statement emission
...
Doing it in the expression trees was a big mistake for a several
reasons. For one, expression trees are meant to be target-agnostic, so
they're the wrong place for selecting instruction types. Also, the move
and memset expressions broke "a = b = c;" type expression chains.
This fixes most things (including the assignchain test) with -Werror
turned off (some issues in flow analysis uncovered by the nil
migration: memset target not extracted).
2020-03-13 18:20:38 +09:00
Bill Currie
c04f1c0156
[qfcc] Really delay the conversion of nil
...
Now convert_nil only assigns the nil expression a type, and nil makes
its way down to the statement emission code (where it belongs, really).
Breaks even more things :)
2020-03-13 18:19:43 +09:00
Bill Currie
19002116c2
[qfcc] Fix missing expression types from dot_expr
2020-03-13 17:56:07 +09:00
Bill Currie
2c9c15f4c8
[qfcc] Add a type check helper for structural types
...
ie, struct/union/array. I finally though up a decent name (didn't want
to use record as that's a pascal type).
2020-03-13 17:54:05 +09:00
Bill Currie
8d10b0f4aa
[qfcc] Support compound initializers for return
2020-03-13 09:58:52 +09:00
Bill Currie
047131a737
[qfcc] Check for compound init in message args
...
I had forgotten message sending did its own type checking and thus
needed to be updated for compound initializers in message parameters.
2020-03-13 09:46:36 +09:00
Bill Currie
9c06b22719
[qfcc] Fix segfault when assigning {}
2020-03-13 01:59:35 +09:00
Bill Currie
9c5fac2226
[qfcc] Catch another assignment chain failure
2020-03-12 19:53:15 +09:00
Bill Currie
f454842361
[qfcc] Add breaking assignment chain test
...
This bug drove me nuts for several hours until I figured out what was
going on.
The assignment sub-tree is being generated, then lost. It works for
simple assignments because a = b = c -> (= a (= b c)), but for complex
assignments (those that require move or memset), a = b = c -> (b = c) (a
= c) but nothing points to (b = c). The cause is using binary
expressions to store assignments.
2020-03-12 19:47:09 +09:00
Bill Currie
4c2a6c9eb2
[qfcc] Allow implicit demotion in initializer elements
...
Notably, implicit double constants (no adorning d) being used to
initialize float struct members.
2020-03-12 19:40:17 +09:00
Bill Currie
65b48c734c
[qfcc} Mark some more functions as pure
...
I guess gcc doesn't consider recursive functions as pure, but marking
get_type as pure had a slight ripple effect.
2020-03-12 19:40:17 +09:00
Bill Currie
c743583003
[qfcc] Fix a comment
2020-03-12 19:40:17 +09:00
Bill Currie
bbfd498b74
[qfcc] Handle compound and memset dot nodes
...
compound is currently not very informative, but it's better than "bad
expression type"
2020-03-12 19:40:17 +09:00
Bill Currie
21a8559674
[qfcc] Improve handling of nil assignments
...
Especially when they result in using memset.
2020-03-12 19:40:17 +09:00
Bill Currie
e4caf50ee1
[qfcc] Update switch tables for compound initializers
...
Forgot to do a full test build (Machine.r found it)
2020-03-11 23:52:12 +09:00
Bill Currie
5d349efe78
[qfcc] Delay conversion of nil in assignments
...
It's not possible to take the address of constants (at this stage) and
trying to use a move instruction with .zero as source would result in
the VM complaining about null pointer access when bounds checking is on.
Thus, don't convert a nil source expression until it is known to be
safe, and use memset when it is not.
2020-03-11 22:57:48 +09:00
Bill Currie
be5f11f33a
[qfcc] Support the new memset instructions
2020-03-11 22:57:20 +09:00
Bill Currie
d418be31e6
[qfcc] Tweak ivar test to check old bug
...
It turns out that assigning nil to an ivar struct does not work (should,
of course).
2020-03-11 20:55:21 +09:00
Bill Currie
48a256efaa
[qfcc] Fix segfault when assigning {}
...
I had intended to check, but forgot.
2020-03-11 20:45:25 +09:00
Bill Currie
b6439e8dc1
[qfcc] Support compound init in assignment and params
...
foo({...}) and bar = {...}
2020-03-11 19:48:25 +09:00
Bill Currie
afd31ed292
[qfcc] Rename cexpr to comma_expr
...
It took me too long to figure out what cexpr was for.
2020-03-11 16:07:58 +09:00
Bill Currie
d1e83b9d48
[qfcc] Create a compound initializer expression type
...
This fixes the problem of using the return value of a function as an
element in a compound initializer. The cause of the problem is that
compound initializers were represented by block expressions, but
function calls are contained within block expressions, so def
initialization saw the block expression and thought it was a nested
compound initializer.
Technically, it was a bug in the nested element parsing code in that it
wasn't checking the result value of the block expression, but using a
whole new expression type makes things much cleaner and the work done
paves the way for labeled initializers and compound assignments.
2020-03-11 15:46:57 +09:00
Bill Currie
f10f9e157d
[qfcc] Warn about unused labels
2020-03-11 13:33:06 +09:00
Bill Currie
393e540ffa
[qfcc] Print the source name of an undefined label
...
Undefined labels generated by the compiler indicate severe trouble.
2020-03-11 13:31:12 +09:00
Bill Currie
813319efc2
[qfcc] Implement goto
...
It's just too useful when used correctly.
2020-03-11 12:53:40 +09:00
Bill Currie
4a8854d9ed
[qfcc] Add expression tracking to operands
...
Not much uses it yet, but it will make for better diagnostics.
2020-03-11 12:51:34 +09:00
Bill Currie
1cd5ea5732
[qfcc] Add support for named labels in statements
...
Yeah, I've finally decided to implement goto. Limited to function scope
of course.
2020-03-11 12:49:10 +09:00
Bill Currie
d5560434c0
[qfcc] Rename label to bool_label for clarity
...
And also so I can use `label' for source labels.
2020-03-11 11:06:09 +09:00
Bill Currie
3061f7e30e
[qfcc] Update sendv test for corrected implementation
2020-03-11 11:04:49 +09:00
Bill Currie
826f066e00
[qfcc] Be more consistent with string saving
...
Not that it really makes any difference for labels since they're
guaranteed unique, but it does remove the question of "why nva instead
of save_string?". Looking at history, save_string came after I changed
it from strdup (va()) to nva(), and then either didn't think to look for
nva or thought it wasn't worth changing.
2020-03-11 10:50:15 +09:00
Bill Currie
5535a6a509
[qfcc] Fix missing words in a comment
2020-03-11 10:49:49 +09:00
Bill Currie
9acfdea8b5
[qfcc] Improve line number binding for function calls
...
Multi-line calls (especially messages) got rather confusing to read as
the lines jumped back and forth. Now the binding is better but the dags
code is reordering the parameters sometimes.
2020-03-11 01:52:45 +09:00
Bill Currie
a013714bd0
[qfcc] Add missing header file changes
...
Oops
2020-03-08 20:11:21 +09:00
Bill Currie
89ec86f77f
[qfcc] Add option to promote of float through ...
...
The server code is not yet ready for doubles, especially in its varargs
builtins: they expect only floats. When float promotion is enabled
(default for advanced code, disabled for traditional or v6only),
"@float_promoted@" is written to the prog's strings.
2020-03-08 19:13:57 +09:00
Bill Currie
bcf75b541a
[qfcc] Build movep dest pointer correctly
...
This fixes the mangled pointer in struct-init-param.r.
2020-03-08 17:40:38 +09:00
Bill Currie
5020966be3
[qfcc] Fix ud-chain alias handling
...
That was a fair bit trickier than I thought, but now .return and .paramN
are handled correctly, too, especially taking call instructions into
account (they can "kill" all 9 defs).
2020-03-08 16:57:12 +09:00
Bill Currie
3d9410c66d
[qfcc] Force overlap to 0 for non-alias def/temops
...
Make the code behave as intended: visiting all aliases when starting
with the real def/tempop regardless of the overlap setting.
2020-03-08 16:53:28 +09:00
Bill Currie
035da472ec
[qfcc] Offset alias tempop offsets
...
Alias tempop offsets are relative to the real tempop. This fixes alias
tempops never overlapping the real tempop.
2020-03-08 16:51:01 +09:00
Bill Currie
695b3ba0d0
[qfcc] Rearrange vecexpr.r for easier debugging
...
Putting the most likely function to have problems at the top reduces
break-point shenanigans.
2020-03-08 16:50:39 +09:00
Bill Currie
d9d321f65b
[qfcc] Check for previous errors in vector exprs
...
Fixes a segfault when one of the expressions used to construct the
vector was the result of an error.
2020-03-08 15:40:07 +09:00
Bill Currie
b81d58c795
Revert "[qfcc] Correct a comment"
...
This reverts commit a2f203c840
.
There is indeed a world of difference between "any" and "only", and it
helps if I read the rest of the docs AND the code :P.
2020-03-08 14:58:57 +09:00
Bill Currie
8696e76a25
[qfcc] Handle aliases when setting use and def
...
As expected, this does not fix the mangled pointer problem in
struct-init-param.r, but it does improve the ud-chains. There's still a
problem with .return, but it's handling in flow_analyze_statement is a
bit "special" :P.
2020-03-08 12:17:56 +09:00
Bill Currie
a2f203c840
[qfcc] Correct a comment
...
There's a world of difference between "any" and "only".
2020-03-08 12:10:12 +09:00
Bill Currie
b2faca16a7
[qfcc] Rename the kill alias functions
...
Having "visit" in the name felt redundant in the end.
2020-03-08 12:08:56 +09:00
Bill Currie
c2ed6d41bd
[qfcc] Finish struct-init-param test
...
When the bug is fixed, it will pass now (does without optimization).
2020-03-08 03:55:08 +09:00
Bill Currie
e4c87091a3
[qfcc] Lots of flow analysis docs
...
And some function shuffling for grouping. I'm not satisfied with the
docs, but they're a lot more helpful than they were.
2020-03-08 03:53:53 +09:00
Bill Currie
809c103fd1
[qfcc] Shuffle some code around to be clearer
...
Doing the same thing at the end of two branches of an if/else seems off.
And doing an associative(?) set operation every time through a loop is
wasteful.
2020-03-08 03:46:52 +09:00
Bill Currie
7338689146
[qfcc] Treat offset real tempops as an error
...
tempops always have an offset field, but only those that are aliases
should ever have a non-zero offset.
2020-03-08 03:42:18 +09:00
Bill Currie
d44d956038
[qfcc] Remove a long dead function
2020-03-08 03:39:24 +09:00
Bill Currie
f56de00c21
[qfcc] Rename a field
...
depth_first is much clearer than dfo. I had to check what dfo meant too
many times in one night.
2020-03-08 03:38:45 +09:00
Bill Currie
2b15e61b28
[qfcc] Remove obsolete structure fields
...
init_vars hasn't been used for a long time.
2020-03-08 03:33:01 +09:00
Bill Currie
e524db1fc1
[qfcc] Set op type when aliasing a value
...
This fixes the ICE when attempting to compile address-cast without
optimization (just realized why, too: the assignment was optimized out
of existence).
2020-03-08 03:11:46 +09:00
Bill Currie
6ada20f685
[qfcc] Show offset for op_x_def_ofs relocs
2020-03-07 02:06:33 +09:00
Bill Currie
48514ba2f3
[qfcc] Create alias def for defs accessed via pointer
...
This the fixes the incorrect flow analysis caused by the def being seen
to have the wrong size (structure field of structure def seen through a
constant pointer). Fixes the ICE, but the pointer constant is broken
somewhere in dags, presumably.
2020-03-07 01:30:36 +09:00
Bill Currie
faa6eabfbe
[qfcc] Add a failing test for struct init to param
...
This actually took a bit to reproduce.
2020-03-06 22:28:04 +09:00
Bill Currie
f7757cf894
[qfcc] Add filename to dot output
...
It makes things so much easier when viewing the graphs
2020-03-06 21:05:53 +09:00
Bill Currie
de06efa604
[qfcc] Fix handling of nil for static initializers
...
nil is most definitely constant.
2020-03-06 20:38:40 +09:00
Bill Currie
9dbc81432a
[qfcc] Use full type for differentiating values
...
This fixes the problem of using nil for two different compound types
within the one expression. The problem is all compound types have the
same low-level type (ev_invalid) and this caused the two different nils
to have the same type when taken back up to expression level.
2020-03-06 20:33:47 +09:00
Bill Currie
07e6baf32f
[qfcc] Support { } as nil in nested initializers
...
Did top-level earlier, but forgot to add support for deeper nestings.
2020-03-06 20:32:37 +09:00
Bill Currie
9b269c2f8e
[qfcc] Fix mangled method parameters
...
Method parameters (ie, extra parameters without selector names) were
getting reversed during function type construction.
2020-03-06 17:37:58 +09:00
Bill Currie
a2cebe3cac
[qfcc] Add failing test for method parameters
2020-03-06 17:36:23 +09:00
Bill Currie
94e35b5f57
[qfcc] Clean up error messages around superclass
2020-03-05 21:10:15 +09:00