Commit graph

3015 commits

Author SHA1 Message Date
Bill Currie
4b4cb60c65 [qfcc] Check qfo target matches compile target
Linking mixed target VMs is unlikely to end well.
2022-01-27 13:24:21 +09:00
Bill Currie
0123e12304 [qfcc] Use locals and params_start to describe stack frame
This is necessary to get statement disassembly working, and likely
debugging in general. locals is the total size of the stack frame and
thus reaches above the function-entry stack pointer, and params_start is
the local space relative start of the parameters. Thus, knowing the
function-entry stack pointer, the bottom of the locals space can be
found by subtracting params_start, and the top of the locals space by
adding (locals - params_start).
2022-01-27 11:37:37 +09:00
Bill Currie
59ee723201 [gamecode] Rename parm to param
That misspelling bothered me from the very beginning, I'd always have
trouble getting the name right when trying to access one of those fields.
2022-01-27 10:55:06 +09:00
Bill Currie
169b8cc398 [qfcc] Rewrite qfo_to_progs offset/size calculation
This gets all the sections of the progs file nicely aligned and the code
easier to read with the offset and size calculations not being spread
through the function. ivar-struct-return now works when compiled for
Ruamoko.
2022-01-26 23:18:15 +09:00
Bill Currie
faa98d8198 [gamecode] Use a struct for offset/count pairs
This cleans up dprograms_t, making it easier to read and see what chunks
are in it (I was surprised to see only 6, the explicit pairs made it
seem to have more).
2022-01-26 19:30:25 +09:00
Bill Currie
a2fd42f174 [qfcc] Align progs memory to 32 bytes in the test harness
This ensures the engine can align everything to 32 bytes.
2022-01-26 16:57:34 +09:00
Bill Currie
90b40e7e52 [qfcc] Ensure adjstk and with always come first
While I think the reason the dags code moved an instruction before
adjstk and with was they shared a constant with that instruction (which
is a different bug), this ensures other instructions cannot get
reordered in front of adjstk and with, as doing so would cause any such
instructions to access incorrect data.
2022-01-26 15:50:04 +09:00
Bill Currie
0b9b6955aa [qfcc] Implement addressing modes for return
There's still entity.field to go, but basic def and ptr + const offset
seem to work.
2022-01-26 15:48:08 +09:00
Bill Currie
982a090143 [qfcc] Mask off base register bits when printing statements
Fixes a segfault when compiling Ruamoko progs with debug output.
2022-01-26 12:26:50 +09:00
Bill Currie
06d70a32db [qfcc] Rework the functionality of address expressions
The goal was to get lea being used for locals in ruamoko progs because
lea takes the base registers into account while the constant pointer
defs used by v6p cannot. Pointer defs are still used for gobals as they
may be out of reach of 16-bit addressing.

address_expr() has been simplified in that it no longer takes an offset:
the vast majority of the callers never passed one, and the few that did
have been reworked to use other mechanisms. In particular,
offset_pointer_expr does the manipulations needed to add an offset
(unscaled by type size) to a pointer. High-level pointer offsets still
apply a scale, though.

Alias expressions now do a better job of hanling aliasing of aliases by
simply replacing the target type when possible.
2022-01-25 23:39:17 +09:00
Bill Currie
e4bb5c8048 [qfcc] Add pragma to control warning promotion
This allows me to disable -Werror in the Makefile but still have the
build tests work properly and not fail when they shouldn't.
2022-01-25 22:15:28 +09:00
Bill Currie
40f5b8a482 [qfcc] Allow short constants in expr_int
No point in generating an internal error when the value can be converted
to an int.
2022-01-25 12:47:12 +09:00
Bill Currie
8d435040e6 [qfcc] Clean up some type checkes
Using the functions keeps the code a little easier to read.
2022-01-25 12:46:14 +09:00
Bill Currie
a1acdb8951 [qfcc] Print children of uexpr and return expressions
It's possible I lost the child printing when creating the return
expressions, but dot diagrams are much more useful when they don't have
nodes with just pointer values.
2022-01-25 12:29:15 +09:00
Bill Currie
fc73cfc1e0 [qfcc] Rename pointer_expr to deref_pointer_expr
This reflects what it actually does (usually, "pointer_expr" type naming
is creating an expression that represents a pointer).
2022-01-25 12:28:53 +09:00
Bill Currie
37f08f9d4f [qfcc] Build the Ruamoko function parameters
The parameter defs are allocated from the parameter space using a
minimum alignment of 4, and varargs functions get a va_list struct in
place of the ...

An "args" expression is unconditionally injected into the call arguments
list at the place where ... is in the list, with arguments passed
through ... coming after the ...

Arguments get through to functions now, but there's problems with taking
the address of local variables: currently done using constant pointer
defs, which can't work for the base register addressing used in Ruamoko
progs.

With the update to test-bi's printf (and a hack to qfcc for lea),
triangle.r actually works, printing the expected results (but -1 instead
of 1 for equality, though that too is actually expected). qfcc will take
a bit longer because it seems there are some design issues in address
expressions (ambiguity, and a few other things) that have pretty much
always been there.
2022-01-24 23:44:48 +09:00
Bill Currie
7e147e703c [qfcc] Copy def reg into alias def
This fixes incorrect local struct member access in Ruamoko progs.
2022-01-24 18:31:53 +09:00
Bill Currie
5cf7924352 [qfcc] Improve dags handling of auxiliary use ops
The aux use ops need to be counted and given nodes explicitly as they
may refer to defs that are not accessed by other statements other than
by aliases, and those aliases need to be marked live as well as the used
def.
2022-01-24 16:55:55 +09:00
Bill Currie
9fc8f14be6 [qfcc] Put the stack frame exprs into the statements block
dot_expr doesn't follow an expression's next pointer on its own.
make_statements was fine, which is why I didn't notice the mistake until
now.
2022-01-24 16:44:48 +09:00
Bill Currie
739c98fe21 [qfcc] Add adjstk and with to dot_expr
And be more informative with "bad" expression types (print the name if
it's just that I haven't added a printer for a valid type).
2022-01-24 16:42:13 +09:00
Bill Currie
1f802716e1 [qfcc] Pass initialize_def the symtab to use as a parameter
This takes care of an old FIXME.
2022-01-24 12:48:02 +09:00
Bill Currie
9c51c3d2e1 [gamecode] Add a data pointer passed to builtin functions
This is part of the work for #26 (Record resource pointer with builtin
function data). Currently, the data pointer gets as far as the
per-instance VM function table (I don't feel like tackling the job of
converting all the builtin functions tonight). All the builtin modules
that register a resources data block pass that block on to
PR_RegisterBuiltins.
2022-01-24 00:20:05 +09:00
Bill Currie
a6b932025c [gamecode] Provide builtins with information about their parameters
This will make it possible for the engine to set up their parameter
pointers when running Ruamoko progs. At this stage, it doesn't matter
*too* much, except for varargs functions, because no builtin yet takes
anything larger than a float quaternion, but it will be critical when
double or long vec3 and vec4 values are passed.
2022-01-23 22:27:27 +09:00
Bill Currie
e746e39738 [gamecode] Create macros for progs sizeof and alignof
I wound up needing the idioms in too many places.
2022-01-23 14:29:33 +09:00
Bill Currie
3c86660d4a [gamecode] Rename MAX_PARMS to PR_MAXPARAMS 2022-01-23 14:17:25 +09:00
Bill Currie
adf672e7b1 [qfcc] Mark the correct operand as used in stores
This fixes the lost-use test, and windows not dragging properly in
qwaq-curses. Another single-character bug-fix :P
2022-01-23 01:37:57 +09:00
Bill Currie
b6093e0728 [qfcc] Add failing test for lost var use
Storing a variable into a dereference pointer (*p = x) is not marking
the variable as used (due to a mistake while converting to Ruamoko
statement format) resulting in assignments to that variable being
dropped due to it being a dead assignment as the assignment to the
variable and the storing need to be in separate basic blocks (thus the
call in the test, though an if would have worked, I think) for the bug
to trigger.
2022-01-23 01:31:50 +09:00
Bill Currie
ec5830f70b [qfcc] "Use" the correct operands
The problem was a missed change when switching the internal statement
format to Ruamoko: I "used" the statement's operands directly rather
than the rotated ones when emitting v6p progs. Fixes a compile segfault
when NOT optimizing.
2022-01-23 00:59:38 +09:00
Bill Currie
9e4ecc14e9 [qfcc] Fix error in handling argc in test-harness
There was an out-by-one where attempting to run a program with only one
argument would result in the argument not being passed to the program
(two worked). This is actually the source of the error fixed in
9347e4f901 because test-harness.c was the
basis for qwaq's main.c
2022-01-22 15:31:26 +09:00
Bill Currie
e6fbe9fdbc [qfcc] Create .stack for Ruamoko progs
It's rather necessary :)
2022-01-21 20:47:35 +09:00
Bill Currie
2a89a678ec [qfcc] Don't allocate local defs for Ruamoko progs
They don't need the defs thanks to the stack.
2022-01-21 20:46:26 +09:00
Bill Currie
0a5101f88c [qfcc] Specify base register index for local defs
While all base registers can be used for any purpose at any time (this
is why the with instruction has hard-absolute modes: you can never get
permanently lost), qfcc currently uses the convention of register 0 for
globals and register 1 for stack locals (params, locals, function args).
The register used to access a def is stored in the def and that is used
to set the register bits in the instruction opcode.

The def code actually doesn't know anything about any conventions: it
assumes all defs are global for non-temp defs (the function code updates
the defs before emitting code) and the current function provides the
register to use for any temp defs allocated while emitting code.

Seems to work well, but debug is utterly messed up (not surprised, that
will be tricky).
2022-01-21 20:34:43 +09:00
Bill Currie
79bd4dd724 [qfcc] Set up the function stack frame
Still need to get the base register index into the instructions, but I
think this is it for basic code generation. I should be able to start
testing Ruamoko properly fairly soon :)
2022-01-21 20:00:38 +09:00
Bill Currie
616a52efb5 [qfcc] Implement flow analysis for Ruamoko calls
Thanks to the use/def/kill lists attached to statements for pseudo-ops,
it turned out to be a lot easier to implement flow analysis (and thus
dags processing) than I expected. I suspect I should go back and make
the old call code use them too, and probably several other places, as
that will greatly simplify the edge setting.
2022-01-21 17:14:10 +09:00
Bill Currie
c53127707b [qfcc] Set the return of Ruamoko calls
Of course, I had the width of opc wrong :P. But with this, it seems that
unoptimized calls should work once I get the stack frame working.
2022-01-21 13:50:21 +09:00
Bill Currie
33a3f92503 [qfcc] Move .return handling into statements.c
The means that the actual call expression is not in the statement lint
of the enclosing block expression, but just its result, whether the call
is void or not. This actually simplifies several things, but most
importantly will make Ruamoko calls easier to implement.

The test is because I had some trouble with double-calls, and is how I
found the return-postop issue :P
2022-01-21 13:09:23 +09:00
Bill Currie
64da1b603a [qfcc] Add failing test for return of postop
Commit 76b3bedb72 broke more than just the
swap test, but at least I know I need to get an edge in the dag.
Currently, the following code is generated: return and add are reversed.

    ../tools/qfcc/test/return-postop.r:8:   return counter++;
    0001 store.i counter, .tmp0
    0002 return .tmp0
    0003 add.i .tmp0, (1), counter

However, I don't want to deal with it right now, so it's marked XFAIL.
2022-01-21 12:40:59 +09:00
Bill Currie
7bc1396358 [qfcc] Split the function defspace into three spaces
Since Ruamoko now uses the stack for parameters and locals, parameters
need to come after locals in the address space (instead of before, as in
v6 progs). Thus use separate spaces for parameters and locals regardless
of the target, then stitch them together appropriately for the target.
The third space is used for allocating stack space for arguments to
called functions. It us not used for v6 progs, and comes before locals
in Ruamoko progs.

Other than the return value, and optimization (ice, not implemented)
calls in Ruamoko look like they'll work.
2022-01-21 10:20:02 +09:00
Bill Currie
a19349b242 [qfcc] Allow 0 sized highwater allocations in defspaces
This turned out to be needed for functions with no parameters (or no
locals).
2022-01-21 10:16:54 +09:00
Bill Currie
479ec07fd4 [qfcc] Implement ruamoko conversion instructions
Thanks to me having done something right 20 years ago, that was pretty
easy :). The two boolean types aren't supported yet because I haven't
decided on just how to represent their types in qfcc.
2022-01-21 10:14:14 +09:00
Bill Currie
b8b47aaf54 [qfcc] Give finish_function the finishing blow
It's been twitching for over ten years, time to put it out of its
misery.
2022-01-21 00:23:40 +09:00
Bill Currie
17dfd1492f [qfcc] Make virtual defspaces useful for highwater allocation
This seems to be the most reasonable approach to allocating space for
function call parameters without using push and pop (or adding to the
stack pointer), though it's probably good even when using push and pop
to help keep things aligned.
2022-01-20 20:54:12 +09:00
Bill Currie
2b7a8387e7 [qfcc] Get void return statements working
My little test program now builds with the Ruamoko ISA :)

    void cp (int *dst, int *src, int count)
    {
	while (count--) {
	    *dst++ = *src++;
	}
    }

Calls are broken (unimplemented), and non-void returns are not likely to
work either (only partially implemented).
2022-01-20 18:40:55 +09:00
Bill Currie
6487fe7ea7 [qfcc] Allow -1 width to match with 0
I initially wanted them to be separate, but return (and other
instructions where width is encoded in one of the operands) made that
difficult.
2022-01-20 18:39:06 +09:00
Bill Currie
54d776f243 [qfcc] Take operand width into account
Operand width is encoded in the instruction opcode, so the width needs
to be accounted for in order to select the correct instruction. With
this, my little test generates correct code for the ruamoko ISA (except
for return, still fails).
2022-01-20 16:49:07 +09:00
Bill Currie
b2ddae46b2 [qfcc] Show raw opcode when dumping instructions
Allows checking the correct instruction has been selected (it's not:
getting 4-component instructions instead of 1)
2022-01-20 15:34:43 +09:00
Bill Currie
74d00d0a3c [qfcc] Update store statements for change in B mode
Ruamoko store instructions are now always indexed and thus need a 0 for
unindexed references, but v6 stores still have no-index addressing.
2022-01-20 15:34:16 +09:00
Bill Currie
a5a8017220 [qfcc] Switch internal statement format to ruamoko
For the most part, it wasn't too bad as it's just a rotation of the
operands for some instructions (store, assign, branch), but dealing with
all the direct accesses to specific operands was a small pain. I am very
glad I made all those automated tests :)
2022-01-20 13:08:05 +09:00
Bill Currie
19baae6969 [qfcc] Dump emitted statements when verbosity >= 2
I wish I had done this years (decades, even!) ago. It makes checking the
output so much easier.
2022-01-20 13:08:05 +09:00
Bill Currie
a4ebd6aa58 [gamecode] Fix a few missed opcode renames
if and ifnot became ifnz and ifz, and return_v lost its tail (it was
always redundant, except in dags, and that's fixed with a pointer check).
2022-01-20 13:07:57 +09:00
Bill Currie
143030fec4 [gamecode] Use text for all v6p opcode names
This makes the v6p instruction table consistent with the ruamoko
instruction table, and clears up some of the ugliness with the load,
store, and assign instructions (. .= and = are now spelled out). I think
I'd still prefer an enum code (faster) but at least this is more
readable.
2022-01-20 09:26:01 +09:00
Bill Currie
30008aeb13 [qfcc] Fix a missed address expression conversion
Found while testing operator renaming.
2022-01-20 00:42:29 +09:00
Bill Currie
105d57f5e7 [qfcc] Improve handling of type names as variables
This is allowed in C so long as the scopes are different.
2022-01-19 23:17:49 +09:00
Bill Currie
07c4d28638 [qfcc] Handle bare "short"
Missed this case in duplicate_type. Allows "short foo" and
"sizeof(short)" (even though qfcc and the engine have two ideas of the
size: I expect trouble later).
2022-01-19 21:23:11 +09:00
Bill Currie
9f42cf726b [qfcc] Clean up duplicate specifier check code
I don't like the name, but having two identical copies of code is never
a good thing, especially something that big.
2022-01-19 21:20:31 +09:00
Bill Currie
df890432b7 [qfcc] Add support for unsigned, long, etc
long is ignored for double, and v6p progs are stuck with 32 bits for
longs (don't feel like extending v6p any further), but the basics are
there for Ruamoko.

short is ignored for ints because the minimum size is 32, and signed is
just noise for ints anyway (and no chars, so...).

unsigned, however, is finally implemented properly (or at least seems to
be working correctly: tests pass after getting things compiling again,
and lt.u is used where it should be :)
2022-01-19 18:08:58 +09:00
Bill Currie
e11fa77a34 [qfcc] Use pr_type_names to generate is_TYPE
This means basic types will always have a check function automatically.
2022-01-19 18:07:54 +09:00
Bill Currie
380cb3ba7f [qfcc] Clean up the type tables for binary expressions
More index labels and remove the null entries since they're not needed
with the labels.
2022-01-19 10:52:07 +09:00
Bill Currie
17add5e00f [qfcc] Use pr_type_names to create basic type defs
This takes care of the type structs and the ev_* to type map.
2022-01-18 22:59:53 +09:00
Bill Currie
57fe669099 [qfcc] Shorten type_function and type_pointer names
To type_func and type_ptr to match the ev type names.
2022-01-18 22:34:52 +09:00
Bill Currie
068c04ece6 [gamecode] Add ev_ushort and partial support
Really, only just enough to get everything compiling (which does include
vkgen running correctly).
2022-01-18 22:08:37 +09:00
Bill Currie
6df79b2b06 [qfcc] Correct xdef structures and usage in test
Attempting to add ev_ushort caused ptraliasenc to break, but that was
because it was already broken: I had implemented the scan of the xdef
table incorrectly, thus adding only 1 ev type resulted in the walked
pointer being out of phase with its data due to it first passing over
the type encodings (which is why adding long and ulong didn't cause any
obvious trouble).
2022-01-18 21:42:53 +09:00
Bill Currie
5b97aa3897 [qfcc] Use index labels for the type arrays
The one place that needed it most... constfold.c
2022-01-18 21:22:18 +09:00
Bill Currie
cd30408675 [gamecode] Rename ev_quat to ev_quaternion
I much prefer the full name, though the short version is easier to type.
2022-01-18 17:05:12 +09:00
Bill Currie
e9e54d08c0 [gamecode] Rename func_t to pr_func_t
Even more consistency.
2022-01-18 15:36:58 +09:00
Bill Currie
afd1eb775b [gamecode] Rename ev_pointer to ev_ptr
Rather short (no worse than ev_int, though) but more consistency is
usually a good thing.
2022-01-18 14:36:06 +09:00
Bill Currie
cfe7c44df0 [gamecode] Rename ev_integer to ev_int
And other related fields so integer is now int (and uinteger is uint). I
really don't know why I went with integer in the first place, but this
will make using macros easier for dealing with types.
2022-01-18 13:27:19 +09:00
Bill Currie
2df64384c1 [gamecode] Clean up string_t and pointer_t
They are both gone, and pr_pointer_t is now pr_ptr_t (pointer may be a
little clearer than ptr, but ptr is consistent with things like intptr,
and keeps the type name short).
2022-01-18 12:11:14 +09:00
Bill Currie
0bd05c71ac [gamecode] Use unsigned for entity values
I don't know why they were ever signed (oversight at id and just
propagated?). Anyway, this resulted in "unsigned" spreading a bit, but
all to reasonable places.
2022-01-16 22:15:18 +09:00
Bill Currie
66528e34fc [qfcc] Give return expressions their own type
Very simple for now (just the return value if not a void return), but
that's the last of the statements masquerading as expressions.
2022-01-09 16:28:08 +09:00
Bill Currie
563de20208 [qfcc] Give branch expressions their own type
This includes calls and unconditional jumps, relative and through a
table. The parameters are all lumped into the one object, with some
being unused by the different types (eg, args and ret_type used only by
call expressions). Just having nice names for the parameters (instead of
e1 and e2) makes it nice, even with all the sub-types lumped together.

No mysterious type aliasing bugs this time ;)
2022-01-09 14:02:16 +09:00
Bill Currie
4111d44dcc [gamecode] Move progs auxiliary headers into a subdirectory
Just another step along the road of tidying up the QF include directory
(and desirable for generated data).
2022-01-09 00:26:52 +09:00
Bill Currie
63795e790b [qfcc] Clean out some old code
The move operator names are definitely obsolete (due to dropping the
expressions a year or two ago) and the precedence checks seem to be
handled elsewhere. Memset and state expressions went away a while back
too.
2022-01-08 21:21:31 +09:00
Bill Currie
14352ea65a [qfcc] Really fix those type aliasing bugs
Found the cause: revered to wrong case for template code :/
2022-01-08 18:49:35 +09:00
Bill Currie
62d58a2255 Revert "[qfcc] Fix another type aliasing bug"
This reverts commit d14f695c68.

Found the cause: revered to wrong case for template code
2022-01-08 18:48:54 +09:00
Bill Currie
134f5ca6a4 Revert "[qfcc] Fix some type aliasing bugs"
This reverts commit da210db720.

Found the cause: revered to wrong case for template code
2022-01-08 18:48:23 +09:00
Bill Currie
65b6c366c3 [qfcc] Give assignment expressions their own type
This is getting easier (know where to look, I guess). Nicely, I found
the source of those weird type aliasing bugs :)
2022-01-08 18:44:29 +09:00
Bill Currie
d14f695c68 [qfcc] Fix another type aliasing bug
This one exposed by the address expression cleanup.
2022-01-08 16:54:08 +09:00
Bill Currie
fa482e8ee5 [qfcc] Give address expressions their own type
Definitely a pain to get working after the switch, but definitely worth
the effort. Still exposing type aliasing bugs.
2022-01-08 16:52:24 +09:00
Bill Currie
cf8061c4d3 [qfcc] Mark opcode_get as pure
Because gcc told me to :P
2022-01-08 12:14:27 +09:00
Bill Currie
da210db720 [qfcc] Fix some type aliasing bugs
I have no idea why sorting out expression aliasing exposed these type
aliasing bugs, but it did. All tests *build* again (and pass).
2022-01-08 12:10:30 +09:00
Bill Currie
23c9a317f8 [qfcc] Give alias expressions their own type
While this was a pain to get working, that pain only went to prove the
value of using proper "types" (even if only an enum) for different
expression types: just finding all the places to edit was a chore, and
easy to make mistakes (forgetting bits here and there).

Strangely enough, this exposed a pile of *type* aliasing bugs (next
commit).
2022-01-08 12:06:52 +09:00
Bill Currie
420d55406f [qfcc] Add a rule to build the qfcc tests
This makes it easier to build and run (by hand) the tests when things
aren't working.
2022-01-08 03:09:15 +09:00
Bill Currie
f5be54b6d2 [qfcc] Sanitize expr type enum
Got tired of dealing with out of date string tables.
2022-01-07 23:12:20 +09:00
Bill Currie
479d82f380 [qfcc] Create separate instruction init and lookup
v6 vs v6p are more or less as before, with ruamoko added in. qfcc will
now try (and fail, due to the opcode table opnames being wrong) to
create ruamoko progs when given the ruamoko target option.
2022-01-07 19:56:15 +09:00
Bill Currie
14d95f81d1 [gamecode] Remove PR_Opcode_Init
It was idempotent, then it became impotent. Now it's just not needed.
2022-01-07 19:25:34 +09:00
Bill Currie
7e303a1151 [qfcc] Hide details about instruction type
At this stage, I doubt emit.c will need to know the details of the
target (v6, v6p, ruamoko) since the instruction formats are identical,
just different meanings for the opcode itself.
2022-01-07 19:05:26 +09:00
Bill Currie
d9ccf3a394 [qfcc] Remove a pile of stale externs
Those opcode pointers haven't been used for years.
2022-01-07 18:54:59 +09:00
Bill Currie
2d245b8cdc [qfcc] Replace [no-]v6only with target=
This allows v6, v6p (older QF VM) or ruamoko (new QF VM) to be targeted.
Currently defaults to v6p to allow QF to continue building without too
much hassle.
2022-01-07 18:34:05 +09:00
Bill Currie
fe153b5b22 [qfcc] Add progs version to qfo and check in linker
While qfcc dealing sensibly with mixed target VMs in the object files
has always been an outstanding issue, with the new instruction set it
has become a priority. Most importantly, this should allow QF to
continue building while I work on qfcc targeting the new IS.
2022-01-07 17:56:05 +09:00
Bill Currie
c96cb1f302 [qfcc] Fix some stale documentation comments
It does little good for documentation to refer to fields that don't
exist (because a certain someone forgot to change the docs when changing
the field names, I wonder who :P).
2022-01-07 15:59:06 +09:00
Bill Currie
c9b2a740a0 [gamecode] Add etypes for long and ulong
And partial implementations in qfcc (most places will generate an
internal error (not implemented) or segfault, but some low-hanging fruit
has already been implemented).
2022-01-05 22:32:07 +09:00
Bill Currie
8a2788c267 [gamecode] Add PROG_V6P_VERSION and bump PROG_VERSION
This allows the VM to select the right execution loop and qfcc currently
still produces only the old IS (it doesn't know how to deal with the new
IS yet)
2022-01-03 13:56:43 +09:00
Bill Currie
0c17c6dc24 [gamecode] Rename the old opcodes
To reflect their basis on v6 progs instructions, they sport the v6p tag
where the p is for "plus" due to the QuakeForge extensions.
2022-01-02 21:30:02 +09:00
Bill Currie
f56fd6ffb6 [qfcc] Preserve requested alignment if larger
build_struct was unconditionally setting the type's alignment. This was
not a problem before because no types were requesting alignments larger
than those requested by their members (for structs). However, with the
upcoming new instruction set, quaternions need to be 4-word aligned.
2022-01-02 11:44:48 +09:00
Bill Currie
365762b8a6 [gamecode] Switch to using indexed initializers
The opcode table is a nightmare to maintain, but this does clean it up
and speed up opcode lookups since they can now be indexed. Of course, it
turns out I had missed adding several instructions, so had to fix that,
and qfcc needed a bit of a re-jigger to get the opcode out of the table.
2021-12-31 19:16:02 +09:00
Bill Currie
be474d9937 [gamecode] Remove the wart from def and function names
I never liked the leading s_ (though I guess it means one is supposed to
interpret the int as a string pointer, but meh).
2021-12-31 15:02:31 +09:00
Bill Currie
44c48feb56 [qfcc] Add attached node's parents to source edges
The assignment to the node's variable must come after any uses of that
node, which the node's parent set indicates. In the swap test, this was
not a problem as the node had no parents, and in the link order test, it
just happened(?) to work.
2021-12-28 09:23:14 +09:00
Bill Currie
8433905015 [qfcc] Extend reachable to the label node's parents
While using just the label node's reachable set was sufficient for a
simple swap (t = a; a = b; b = t;), it is not sufficient for
read-before-write dependencies such as found in linked-list building:

    { o = array[ind]; o.next = obj; obj = o; }

The assignment to o.next uses obj, but that use is hidden because obj's
reachable nodes does not include o thus assigning o to obj causes the
array dereference to be assigned directly to obj and thus o.next winds
up pointing to o instead of whatever obj was. The parent nodes of obj's
node are its users, so any new assigned to obj must come after those
parents as well as any node reachable by obj's node.

Fixes a runaway loop error when adding a frikbot to the server.
2021-12-27 14:25:55 +09:00
Bill Currie
4ad84b3786 [qfcc] Add a test for use/write dependencies
I ran into this with frikbot causing an infinite loop due to incorrectly
linked objects.
2021-12-27 14:17:12 +09:00
Bill Currie
44dd183d55 [qfcc] Make it a little easier to see extra info
instead of having to find an #if 0, just uncomment the define.
2021-12-27 14:15:51 +09:00
Bill Currie
95991e0d77 [qfcc] Check switch test expression early
Avoids a segfault when the test expression has errors.
2021-12-27 00:47:35 +09:00
Bill Currie
3059aa7979 [qfcc] Preserve input qfo data in qfo_to_progs
qfo_to_progs was modifying the space data pointers in the input qfo,
making it impossible to reuse the qfo. However, qfo_relocate_refs needs
the updated pointers, thus do a shallow copy of the qfo and its spaces
(but not any of the data)
2021-12-27 00:27:15 +09:00
Bill Currie
dcf8beeccc [qfcc] Remove a union wart from qfo_mspace_t 2021-12-26 20:37:01 +09:00
Bill Currie
1d3970bc38 [qfcc] Allow extern builtin function declarations
build_builtin_function does the right thing, and it was only legacy
syntax functions that were affected anyway. Certainly, external
variables should not be initialized, but klik uses @extern { } wrapped
around several builtin functions and I had added the feature to allow
just this as it is rather convenient.
2021-12-26 15:01:38 +09:00
Bill Currie
22c67fc268 [qfcc] Use flow analysis for dealloc check
I decided that the check for whether control reaches the end of the
function without performing some necessary action (eg, invoking
[super dealoc] in a derived -dealoc) is conceptually the return
statement using a pseudo operand and the necessary action defining that
pseudo operand and thus is the same as checking for uninitialised
variables. Thus, add a pseudo operand type and use one to represent the
invocation of [super alloc], with a special function to call when the
"used" pseudo operand is "uninitialised".

While I currently don't know what else pseudo operands could be used
for, the system should be flexible enough to add any check.

Fixes #24
2021-12-25 17:04:26 +09:00
Bill Currie
f903211362 [qfcc] Make operand union anonymous
This one was easy enough and gets rid of that little o. wart.
2021-12-25 12:40:24 +09:00
Bill Currie
7c24f116b4 [qfcc] Rename tmpaddr to pseudo_addr
I want to use the function's pseudo address that was used for managing
aliased temporary variables for other pseudo operands as well. The new
name seems to better reflect the variable's purpose even without the
other pseudo operands as temporary variables are, effectively, pseudo
operands until they are properly allocated.
2021-12-25 12:21:59 +09:00
Bill Currie
79b760b1d0 [qfcc] Add failing test for multi-path dealloc
This test checks for control reaching the end of the function without
invoking [super dealloc] in all paths.
2021-12-24 22:45:43 +09:00
Bill Currie
8385046486 [qfcc] Warn when super dealloc invocation is missing
Forgetting to invoke [super dealloc] in a derived class's -dealloc
method has caused me to waste far too much time chasing down the
resulting memory leaks and crashes. This is actually the main focus of
issue #24, but I want to take care of multiple paths before I consider
the issue to be done.

However, as a bonus, four cases were found :)
2021-12-24 22:45:43 +09:00
Bill Currie
ff1cdb6f89 [qfcc] Give select expressions their own type
While get_selector does the job of getting a selector from a selector
reference expression, I have long considered lumping various expression
types under ex_expr to be a mistake. Not only is this a step towards
sorting that out, it will make working on #24 easier.
2021-12-24 22:45:43 +09:00
Bill Currie
bdd3870d2f [qfcc] Add failing test for dealloc warning
I have gotten tired of chasing memory leaks caused by me forgetting to
add [super dealloc] to my dealloc methods, so getting qfcc to chew me
out when I do seems to be a good idea (having such a warning would have
saved me many hours, just as missing return warnings have).
2021-12-24 22:45:43 +09:00
Bill Currie
bdc9e9c39f [qfcc] Unalias types before checking for equality
Fixes a bogus redefinition when going from struct declaration to
typedef.
2021-12-24 06:45:13 +09:00
Bill Currie
3b1acf8a7b [qfcc] Correct some errors in the man page 2021-11-29 11:38:54 +09:00
Bill Currie
7ed12e2f37 [qfcc] Fix static function declarations
I'm surprised it took this long for static not working to cause a
problem.
2021-09-24 19:49:55 +09:00
Bill Currie
6144100d9b [qfcc] Check init exists before checking compound
Fixes a segfault that occurred during a parse error in a def
initializer.
2021-09-24 19:44:14 +09:00
Bill Currie
49c3dacbbc [util] Rename set_size to set_count
After seeing set_size and thinking it redundant (thought it returned the
capacity of the set until I checked), I realized set_count would be a
much better name (set_count (node->successors) in qfcc does make much
more sense).
2021-07-27 11:52:21 +09:00
Bill Currie
342ba65f57 [qfcc] Handle aliased field types
Fixes use of structs as entity fields. The test is currently
compile-only.
2021-07-24 18:09:54 +09:00
Bill Currie
6b38a17cf1 [gamecode] Clean up state imlementations
This makes the code easier to read. Also, yay for automated tests:
caught a mistyped time :)
2021-07-15 16:55:02 +09:00
Bill Currie
ef6dd422e5 [qfcc] Add source line number to statement blocks
For statement dot blocks.
2021-07-06 18:06:47 +09:00
Bill Currie
ddc6f6bcb0 [qfcc] Un-dereference src expression early for movep
The VM has no pointer to direct reference move instruction.

Fixes #9
2021-06-30 20:05:27 +09:00
Bill Currie
9d140d1d15 [qfcc] Use {>...} for unnamed alias types
The ... is the encoding of the aliased type. Avoids (null) in the
encoding. Fixes #10.
2021-06-30 11:00:05 +09:00
Bill Currie
a3aebc983b [qfcc] Add dependency edges for moved labels
When moving an identifier label from one node to another, the first node
must be evaluated before the second node, which the edge guarantees.
However, code for swapping two variables

    t = a; a = b; b = t;

creates a dependency cycle. The solution is to create a new leaf node
for the source operand of the assignment. This fixes the swap.r test
without pessimizing postop code.

This takes care of the core problem in #3, but there is still room for
improvement in that the load/store can be combined into a move.
2021-06-29 14:42:16 +09:00
Bill Currie
76b3bedb72 [qfcc] Revert "Kill dag leaf nodes on assignment."
This reverts commit 2fcda44ab0.

Killing the node is not the correcgt answer as it blocks many
optimization opportunities. The correct answer is adding edges to
describe the temporal dependencies. Of course, this breaks the swap.r
test.
2021-06-29 12:09:35 +09:00
Bill Currie
5291cfb03d [qfcc] Keep track of reachable dag nodes
In order to correctly handle swap-style code

    { t = a; a = b; b = t; }

edges need to be created for each of the assignments moving an
identifier lable, but the dag must remain acyclic (the above example
wants to create a cycle). Having the reachable nodes recorded makes
checking for potential loops a quick operation.
2021-06-29 09:41:03 +09:00
Bill Currie
0d1fad12f0 [qfcc] Add some comments 2021-06-29 09:12:57 +09:00
Bill Currie
d50f2c3145 [qfcc] Correctly check for constant op
Identifiers can be constants. I don't remember quite what it fixed other
than some bogus kill relations in the dags (which might have caused
issues later).
2021-06-28 20:25:26 +09:00
Bill Currie
38a6ccdc85 [qfcc] Use indexed initializers for expr functions
This will make adding new expression types easier (though the current
reason for doing so has been abandoned for now).
2021-06-28 18:12:15 +09:00
Bill Currie
365e298908 [qfcc] Make internal_error const correct
This way it can be used with const expr objects.
2021-06-28 18:12:15 +09:00
Bill Currie
13b4b44e35 [qfcc] Handle l and ll integer suffixes
They're ignored, but allow recent vulkan headers to compile.
Fixes #13
2021-06-13 13:25:18 +09:00
Bill Currie
927a446bd3 [qfcc] Ensure type src type is a class
If the src type is not a class, there is no inheritance chain to walk.
Fixes a segfault when returning self after a syntax error in the
following:

    +(EditStatus *)withRect:(Rect)rect
    {
	return [[[self alloc] initWithRect:rect]:
    }

    -setCursorMode:(CursorMode)mode
    {
	cursorMode = mode;
	return self;
    }
2021-06-09 12:08:13 +09:00
Bill Currie
88c9517629 [qfprogs] Dump class ivars when dumping modules 2021-06-04 14:59:15 +09:00
Bill Currie
88ff254f42 Get QF cross-compiling using MXE/mingw32
This includes -win clients (no clue if anything actually works yet).
2021-03-27 20:09:37 +09:00
Bill Currie
a9bd436837 [build] Autoconfiscate printf format attribute
I don't know if gnu_printf is appropriate for all cases, but it is
needed for mingw32.
2021-03-27 19:52:59 +09:00
Bill Currie
238e80c89b [build] Fix selective build of tools
A couple of things get built when they shouldn't (eg, vkgen) but this
gets the build system back to its pre-non-recursive-make
configurability.
2021-03-26 16:11:29 +09:00
Bill Currie
c9f1d770e0 Merge master into csqc-improvements
That was a mess
2021-03-25 22:01:31 +09:00
Bill Currie
66fda1fddb Rewrite edict access.
The server edict arrays are now stored outside of progs memory, only the
entity data itself (ie data accessible to progs via ent.fld) is stored in
progs memory. Many of the changes were due to code accessing edicts and
entity fields directly rather than through the provided macros.
2021-03-25 18:13:48 +09:00
Bill Currie
bc763da9f6 [qfcc] Fix a typo in the man page 2021-02-09 15:02:22 +09:00
Bill Currie
84dc73da2c [test] Get the tests building again
They happen to all pass, which is nice :)
2021-02-05 21:43:12 +09:00
Bill Currie
0bfb60775e [util] Ensure hunk allocs are cache alligned
This doesn't seem to make much difference in the vulkan renderer, but it
certainly doesn't hurt.
2021-02-03 13:19:19 +09:00
Bill Currie
7970525ef4 [util] Make va thread-safe
It now takes a context pointer (opaque data) that holds the buffers it
uses for the temporary strings. If the context pointer is null, a static
context is used (making those uses of va NOT thread-safe). Most calls to
va use the static context, but all such calls have been formatted
consistently so they are easy to find when it comes time to do a full
audit.
2021-01-31 16:05:48 +09:00
Bill Currie
c7da999b6a [qfcc] Use local_expr only for local variables
ie, not function-scope static variables.
2021-01-13 18:08:30 +09:00
Bill Currie
1205c935d0 [qfcc] Add failing test for static init
The function local static init is being treated as a non-static init
(ie, initialized each call).
2021-01-13 16:47:49 +09:00
Bill Currie
0c1699fdbb Fix a pile of double semicolons 2021-01-09 20:42:23 +09:00
Bill Currie
0426879bf6 [qfcc] Check returned type instead of expr type
Block expressions hide ex_error, but get_type() always returns null when
it finds one (which it does by recursing into block expression), so just
check the type itself.
2021-01-04 14:54:04 +09:00
Bill Currie
ab04a1915e [build] Fix a pile of gcc 10 issues
gcc got stricter about array accesses, complicating progs macros, and
much better at detecting buffer overflows.
2020-12-21 14:14:29 +09:00
Bill Currie
4a8818f0b6 [qfcc] Clean up some excess includes 2020-08-17 14:36:08 +09:00
Bill Currie
550b9c3bb2 [qfcc] Fix silent make rules flex and bison 2020-08-17 14:35:20 +09:00
Bill Currie
f544a6f0b0 [qfcc] Treat null method return type as id
This prevents a segfault when the method's return type is undefined.
2020-07-05 16:53:35 +09:00
Bill Currie
aa8aaaaca9 [build] Support silent rules for qfcc 2020-06-26 10:52:06 +09:00
Bill Currie
ed42557dd1 [qfcc] Reset flowvars for aliased global variables
When a global variable is accessed via only an alias in a function the
actual def's flowvar would remain in the state it was from the last
function that accessed the global normally. This would result in invalid
flowvar accesses which can be difficult to reproduce (thus no test
case).
2020-06-25 22:45:12 +09:00
Bill Currie
6d5ffa9f8e [build] Move to non-recursive make
There's still some cleanup to do, but everything seems to be working
nicely: `make -j` works, `make distcheck` passes. There is probably
plenty of bitrot in the package directories (RPM, debian), though.

The vc project files have been removed since those versions are way out
of date and quakeforge is pretty much dependent on gcc now anyway.

Most of the old Makefile.am files  are now Makemodule.am.  This should
allow for new Makefile.am files that allow local building (to be added
on an as-needed bases).  The current remaining Makefile.am files are for
standalone sub-projects.a

The installable bins are currently built in the top-level build
directory. This may change if the clutter gets to be too much.

While this does make a noticeable difference in build times, the main
reason for the switch was to take care of the growing dependency issues:
now it's possible to build tools for code generation (eg, using qfcc and
ruamoko programs for code-gen).
2020-06-25 11:35:37 +09:00
Bill Currie
31abf6f955 [qfcc] Fix some wrong fall-through cases
This fixes the unary minus issue for now. unary_expr needs a rewrite,
though: it's just horrible.
2020-04-08 21:23:57 +09:00
Bill Currie
d5604aef73 [qfcc] Add failing test for unary minus
Producing a void type... very odd.
2020-04-08 21:12:56 +09:00
Bill Currie
2bec2527b4 [gamecode] Re-expose PR_LoadStrings
It's required for qfprogs now that PR_LoadDebug reads strings early.
2020-04-04 14:33:49 +09:00
Bill Currie
7c5c462587 [qfcc] Write debug data space to sym file
This should keep things nicely extensible, since additional data can be
done in the data space and found using defs. This gets the compilation
units into the sym file.
2020-04-03 21:25:47 +09:00
Bill Currie
9400b9b115 [qfcc] Add a leading . to the compile_unit def 2020-04-03 19:56:07 +09:00
Bill Currie
453c646d85 [qfcc] Improve dependency checks for tests
They worked well if there was only one source file in the test, but
failed if there were two or more. While only typelinker needed the
enhanced macros, I got them all because I generally copy the nearest
block when adding a new test thus it's best if they're all "correct".
2020-04-03 19:54:25 +09:00
Bill Currie
718f243f69 [qfcc] Relocate loose string relocs when linking
This helps make partially linked object files make more sense when
looking at strings in data spaces.
2020-04-03 15:58:22 +09:00
Bill Currie
049b8f392c [qfcc] create a compilation unit for debug data
The compilation unit stores the directory from which qfcc was run and
any source files mentioned. This is similar to dwarf's compilation unit.
Right now, this is the only data in the new debug space, but more might
come in the future so it seems best to treat the debug space separately
in the object files.
2020-04-03 15:07:13 +09:00
Bill Currie
65e7df44d3 [qfcc] Add function to see if a string is in a pool
Makes for a nice string set.
2020-04-03 14:22:44 +09:00
Bill Currie
9089744290 [qfcc] Add a function to safely get cwd
getcwd is assumed to use malloc if its buff param is null. This may need
fixing in the future, but it's in one spot. The result in "saved" in the
non-progs pool.
2020-04-03 14:22:31 +09:00
Bill Currie
4b34bf3d95 [qfcc] Take optional space param for emit_structure
If the space param is null, the far data space is used.
2020-04-03 14:16:16 +09:00
Bill Currie
f8d9b720de [qfcc] Free data spaces between compiliations 2020-04-03 14:14:34 +09:00
Bill Currie
d69db50cf9 [qfcc] Remove path stripping
It never really helped sort out the path issues when using build
directories. It worked well enough for single directory projects, but
things got messy very quickly, especially when mixing ruamoko libs with
external progs. A better method based on dwarf is coming.
2020-04-03 00:50:06 +09:00
Bill Currie
5d06596814 [qfcc] Fix test harness after .ctor change 2020-04-03 00:20:39 +09:00
Bill Currie
a09eabeb4d [qfcc] Fix some const attribute warnings
Try to anticipate gcc's warnings and it one-ups you :P
2020-04-01 21:17:13 +09:00
Bill Currie
17bb408b57 [qfcc] Clean up stray dags edges
Killed nodes can leave stray (dangling) edges that cause some confusion
in the dot graphs and may cause problems later on down the track, so
ensure there are no dangling edges.
2020-04-01 16:06:45 +09:00
Bill Currie
199b3e82d9 [qfcc] Add killer node to replacement node's edges
When an operand refers to a killed node, it needs to be evaluated AFTER
the killing node is evaluated. This fixes the double-alias bug.
2020-04-01 16:05:26 +09:00
Bill Currie
4c79c9ffaf [qfcc] Do a dags pre-pass to give operands leafs
The reason double-alias fails is when the double assignment occurs, the
int operands don't yet have leaf nodes and thus the nodes cannot be
killed. This doesn't fix the bug.
2020-04-01 16:03:12 +09:00
Bill Currie
842125faf8 [qfcc] Add a failing test for aliased live vars
I'm not sure if it's due more to doubles or unions, but the bug was
found via double. It seems the dags code generator doesn't see that the
assignment to the union's double field kills the two int fields.

The test passes when NOT optimizing.
2020-04-01 13:49:58 +09:00
Bill Currie
dff0fd983c [qfcc] Fix missed t enum cleanup 2020-03-30 19:02:54 +09:00
Bill Currie
0de9b02726 [qfcc] Catch declarations of arrays of class
They're still static instances.
2020-03-30 19:02:41 +09:00
Bill Currie
ddec80edc1 [qfcc] Make type encoding union anonymous
I'd do more, but things get messy with direct access to unions that I
want to be anonymous.
2020-03-30 11:10:05 +09:00
Bill Currie
d4de1d7418 [qfcc] Do full type encoding relocation early
Because type aliases need to be unaliased, the type pointers in the type
encodings need to be correct when it comes to linking defs and
functions. This fixes the linking errors in ruamoko/game.
2020-03-29 18:19:36 +09:00
Bill Currie
188a1ea105 [qfcc] Add more comments to the linker
It's a horribly hairy beast to understand, especially anything to do
with relocs and type encodings.
2020-03-29 18:18:27 +09:00
Bill Currie
c6d5ceab0e [qfcc] Make things clearer about relocated types
I was very uncertain about the validity of messing with the old type
encoding that way, but adding the check to ensure the type has been
processed never fired, so it seems ok. And the comments help me a lot :)
2020-03-29 16:47:45 +09:00
Bill Currie
62b6e95746 [qfcc] Show a marker at first unbound reloc 2020-03-29 14:54:28 +09:00
Bill Currie
361b3ff422 [qfcc] Treat alias nodes in alias-free branch as ICE 2020-03-29 11:49:07 +09:00
Bill Currie
218cca71b8 [qfcc] Take special care when aliasing aliased types
When aliasing a type that already has aliases, the top node needs to be
replaced if it is unnamed, or the alias-free branch of the new node
needs to reach around to the alias-free branch of the existing node.
This fixes the bogus param counts in qwaq.
2020-03-29 11:29:15 +09:00
Bill Currie
78962cb205 [qwaq] Use append_type in field/pointer/array_type
This fixes the missing alias chain splitter, allowing scheme to compile
again.
2020-03-29 10:27:16 +09:00
Bill Currie
6f871a8af9 [qfcc] Unalias def types before checking
This fixes the typelinker test, but not the linking error in
ruamoko/game that it was supposed to represent. I guess there's
something more going on (maybe type encoding relocation issues).
2020-03-29 00:58:02 +09:00
Bill Currie
8ba3ab89d5 [qfcc] Add failing aliased type linking test 2020-03-28 23:30:05 +09:00
Bill Currie
c13162e41e [qfcc] Rearrange type initialization
Fixes #6
It turned out that the problem with @zero was caused by initial type
chaining occurring before the structures had been initialized and thus
the linker's @zero type encoding string was incorrect: {?=} instead of
{tag @zero-}, thus when the actual type encoding supplied by an object
file came along (with the correct encoding string), it wasn't found.
2020-03-28 22:53:35 +09:00
Bill Currie
31ea3814bb [qfcc] Decouple type encoding from the pr struct
This will allow encoding types correctly in the linker.
2020-03-28 22:15:06 +09:00
Bill Currie
54a9305dbf [qfcc] Use right object for sizeof
Since the bitfield has been abandoned, can use sizeof on the field
again.
2020-03-28 22:02:42 +09:00
Bill Currie
ac9f3404ef [qfcc] Improve string quoting when dumping strings
Not knowing if a blank line is an empty string or spaces...
2020-03-28 21:46:46 +09:00
Bill Currie
1cd7bd2bf0 [qfcc] Use correct meta for zerolinker test
Still fails, of course :)
2020-03-28 21:31:04 +09:00
Bill Currie
7218af6be4 [qfcc] Print qfo def type address 2020-03-28 21:19:20 +09:00
Bill Currie
262c6a61f5 [qfcc] Add failing test for linker zero/param issue
This tests issue #6
2020-03-28 21:11:42 +09:00
Bill Currie
f224eadbb8 [qfcc] Rework QuakeC function type manging
It is now "consistent" with the rest of the type building in that it
uses find_type(append_type(return, params)) like the C version, thus
allowing append_type to do its thing with type aliases. This fixes the
overload test.
2020-03-28 19:01:49 +09:00
Bill Currie
b6ea47dca6 [qfcc] Add failing function overload test
This is a bit of a weird one because it's a combination of the aliasing
code and mixing C prototypes with QuakeC function definitions, and the
function type rebuilding in qc-parse.y not being very "consistent" in
its abuse of the type system.
2020-03-28 18:58:08 +09:00
Bill Currie
eacdd0d3de [qfcc] Make file_basename accessible and more usable 2020-03-28 18:55:51 +09:00
Bill Currie
69037fe5eb [qfcc] Strip alias info off function params
For now. This fixes many problems but does lose type aliasing info from
function parameters.
2020-03-28 18:55:51 +09:00
Bill Currie
da39e675b8 [qfcc] Copy type chain for type aliases
The full_type branch of an alias splitter (alias with null name) needs
to mirror the clean side up to the type alias. It is causing problems
with functions, but that's expected because parameters complicate
things.
2020-03-28 18:55:51 +09:00
Bill Currie
ec3c2426ff [qfcc] Add type dot dumping
It's not connected up yet because I'm unsure of just where to put things
(it gets messy fast), but just being able to see the structure of
complex types is nice.
2020-03-28 16:22:44 +09:00
Bill Currie
8479cad8a8 [qfcc] Record alias-free type in function_t
This eases type unaliasing on functions a little.

Still more to to go, but this fixes a really hair-pulling bug: linux's
heap randomiser was making the typedef test fail randomly whenever
typedef.qfo was compiled.
2020-03-28 15:10:14 +09:00
Bill Currie
1eef2a8b5e [qfcc] Implement type aliasing again
When a type is aliased, the alias has two type chains: the simple type
chain with all other aliases stripped, and the full type chain. There
are still plenty of bugs in it, but having the clean type chain takes
care of the major issue that was in the previous attempt as only the
head of the type-chain needs to be skipped for type comparison.

Most of the bugs are in finding the locations where the head needs to be
skipped.
2020-03-28 12:10:23 +09:00
Bill Currie
734f10d43e [qfcc] Dump local defs for qfo functions 2020-03-28 12:06:34 +09:00
Bill Currie
e31f03fd36 [qfcc] Add type aliasing test again 2020-03-28 09:59:01 +09:00