Commit graph

9572 commits

Author SHA1 Message Date
Bill Currie
2317811f2b Don't allocate space for locals for builtin functions.
While the symtab is needed for debug info, there is no need for any actual
data to be allocated for a builtin function's locals.
2012-12-15 13:13:40 +09:00
Bill Currie
f3e2e239b8 Use the class name in type encodings.
After all that effort getting the class def initialized early enough for
type encodings to work, it proved to be a problem: just including a header
with an interface in it would cause linker errors if there was no
implementation available (even if the class is never used).
2012-12-15 12:21:22 +09:00
Bill Currie
101ca22b5a Fix a couple of warnings found by the mxe gcc.
Finally, a recent gcc for our mingw builds :)
2012-12-14 17:07:53 +09:00
Bill Currie
fb00391749 Update the mingw cross scripts for MXE.
I got MXE to build (took only an envvar and a couple packages, yay doc
reading), so I thought it time to update the scripts to use it (they assume
/opt/mxe).
2012-12-14 17:03:52 +09:00
Bill Currie
461572e6ad Fix constant folding for vectors and quaternions with floats. 2012-12-14 12:48:09 +09:00
Bill Currie
732d6a1520 Provide emulation for vector / float and quaternion / float.
The VM doesn't have such instructions, so emulate them via
vector * (1 / float) and quaternion * (1 / float).
2012-12-14 12:30:30 +09:00
Bill Currie
dc55034708 Mark aliases as live when a label is attached to a leaf node.
This fixes the lost return values in the menus.
2012-12-13 21:20:21 +09:00
Bill Currie
a7b7a114bc Don't kill the node to which an alias is being assigned.
This does not fix the lost return value the menus as that is caused by the
alias not being marked live when it should be.
2012-12-13 21:06:04 +09:00
Bill Currie
3e38c4aa48 Merge branch 'qfcc-cse'
qfcc now does local common subexpression elimination. It seems to work, but
is optional (default off): use -O to enable. Also, uninitialized variable
detection is finally back :)

The progs engine now has very basic valgrind-like functionality for
checking pointer accesses. Enable with pr_boundscheck 2
2012-12-13 20:17:28 +09:00
Bill Currie
47c721b32e Clear the dstring in test-harness's printf builtin.
PR_Sprintf always appends to the result dstring. I'm not sure if this is by
design or a bug, so I'll leave it be for now.
2012-12-13 14:59:42 +09:00
Bill Currie
decc3845c5 Kill any aliases when assigning to an aliased def.
Temps aren't supported yet :P

The alias defs themselves aren't killed (still want any assignments to
occur) but rather, their nodes are. Also, edges to the alias defs' nodes
are added to the assigning node. Fixes structlive.r :)
2012-12-13 14:43:43 +09:00
Bill Currie
2dc60d4f9a Allow tests for full overlap of defs.
Not actually used yet, but I imagine I'll want it.
2012-12-13 14:42:51 +09:00
Bill Currie
821081c9c8 Use the desination type for moves in assign_expr.
for <struct> = nil; the source type is void and thus probably the wrong
size.
2012-12-13 14:05:24 +09:00
Bill Currie
503154257c Fix an uninitialized variable.
Yay valgrind, boo taniwha.
2012-12-13 13:58:30 +09:00
Bill Currie
3665a0566a Add a test for struct writes.
This tests local kills via aliases.
2012-12-13 13:44:25 +09:00
Bill Currie
0ff6e8a471 Correct some spaces in the type dump output. 2012-12-13 13:33:13 +09:00
Bill Currie
cf05f65596 Add int_val and uint_val to @param and @zero.
I got fed up with using "int" types, but the members being "integer"
(hold-over from before the int rename).
Also, correct the names of those types and @va_list (error reporting was
chopping off part of the name).
2012-12-13 13:24:03 +09:00
Bill Currie
5681e0fd42 Treat certain move instructions as assignments.
MOVE (static move) and MOVEP to a pointer constant know exactly where their
data is going, so treat them similarly to assignments: save their
distination operands (the addressed def for MOVEP) and mark them as
defined.
2012-12-13 12:50:00 +09:00
Bill Currie
c61e03a0b9 Clean up operand creation.
Rather than having the creation scattered through the code, use helper
functions. Makes exposing operand creating saner.
2012-12-13 12:49:00 +09:00
Bill Currie
d990a956c0 More label count paranoia.
MOVEP can generate 4 daglabels.
2012-12-13 12:48:07 +09:00
Bill Currie
c295a0473e Add edges from call nodes to their param nodes.
Assinments to .param_N (0-7 for call, 2-7 for rcall) must occur before the
call, or weird things will happen.
2012-12-13 09:55:28 +09:00
Bill Currie
c477191488 Be a little more paranoid about daglabel counts.
I'm still a little worried about the number of labels needed with heavy
alias usage.
2012-12-13 09:50:18 +09:00
Bill Currie
204a0b3f72 Make def_visit_all return the actual result of visit.
This way, def_visit_all is a little more useful (though I think I might
redo the one case that's using this feature).
2012-12-13 09:47:00 +09:00
Bill Currie
028b19888f Check aliases for liveness when removing dead vars.
The live var flow analysis doesn't check for aliases. Rather than changing
it to check for aliases (which might break uninitialized var analysis, as
it uses "use" from the live var analysis), make dag_remove_dead_vars do the
check. Fixes the misplaced text in the menus.
2012-12-12 23:15:55 +09:00
Bill Currie
95c249e8b9 Scale the glsl crosshairs to match gl. 2012-12-12 22:34:49 +09:00
Bill Currie
2ce65d931e Use exact texture coords for 2d pics in glsl.
Moving the texture coordinates in 1/4 pixel made a mess of the 2d pics
(very noticable on the round crosshair).
2012-12-12 22:34:43 +09:00
Bill Currie
cb259823af Scale the glsl crosshairs to match gl. 2012-12-12 21:37:55 +09:00
Bill Currie
f71affdfba Use exact texture coords for 2d pics in glsl.
Moving the texture coordinates in 1/4 pixel made a mess of the 2d pics
(very noticable on the round crosshair).
2012-12-12 21:34:37 +09:00
Bill Currie
a372efee5c Add a new crosshair.
Now all 4 slots of the crosshair table are used :)

Also, fix the offset for pic based crosshairs in glsl, and use just one
func for them.
2012-12-12 19:36:50 +09:00
Bill Currie
814f902e88 Add a new crosshair.
Now all 4 slots of the crosshair table are used :)

Also, fix the offset for pic based crosshairs in glsl, and use just one
func for them.
2012-12-12 19:36:18 +09:00
Bill Currie
06d14f6433 Dump operand contents for verbosity > 1. 2012-12-12 16:21:33 +09:00
Bill Currie
07d348fbd8 Fix an uninitialized warning from recent gcc.
Nifty: if you pass a struct via reference to a function, and a field of
that struct may be both set and not set (eg, set only in an if statement),
gcc will report that field assuming that fields that are never set will be
set by the function (my interpretation).

* taniwha ponders the flow analysis for that
2012-12-12 14:28:35 +09:00
Bill Currie
099bbcbd8a Fix an uninitialized warning from recent gcc.
Nifty: if you pass a struct via reference to a function, and a field of
that struct may be both set and not set (eg, set only in an if statement),
gcc will report that field assuming that fields that are never set will be
set by the function (my interpretation).

* taniwha ponders the flow analysis for that
2012-12-12 14:12:21 +09:00
Bill Currie
dd03678a74 Ensure \n gets printed for the null type. 2012-12-12 13:44:22 +09:00
Bill Currie
48821f379f Set edges/live for addressed variables.
This fixes (again:P) the messup with .super.
2012-12-12 12:55:17 +09:00
Bill Currie
03fdbe9b86 Ensure the def is aliasing before adding edges.
Getting two nodes doubly connected for *to = *from++; was interesting.
2012-12-12 12:52:01 +09:00
Bill Currie
75be251d65 Create and use def_visit_all.
Even though it turned out there were only two copies of the def alias
handling code, I got tired of writing it. The code is easier to read, too
:)
2012-12-12 12:01:31 +09:00
Bill Currie
85e6dd965f Treat aliases of the same basic type as no-ops.
At the statement level, all pointer types are the same, so just return the
op obtained from the sub-expression when the low-level type of the alias
expression matches the low-level type of the type of type sub-expression
operand.

With this, the alias of a value code can be removed (I always thought it
was wrong), which is what broke calling obj_msgSend_super (type &.super
param lost the &).

Now I have to deal with pointer values in the optimizer :/
2012-12-11 20:44:40 +09:00
Bill Currie
76c9aa2930 Handle alias defs when building a dag.
When an alais def (or aliased def) is used, any overlapping aliases that
have previously been assigned need to be marked as live, and edges to the
aliases added to the new node. However, when assigned to, live-forcing
needs to be turned off.

This fixes the lost assignments to .super.
2012-12-11 19:57:19 +09:00
Bill Currie
045947706e Compare the base def spaces in def_overlap.
The space field in alias defs is always null and thus aliases would never
overlap the aliased def. Oops.
2012-12-11 19:51:34 +09:00
Bill Currie
998868e53c Maybe make dags a little easier to read. 2012-12-11 19:50:31 +09:00
Bill Currie
7607c7d649 Resurrect alias operands.
It turns out they are necessary for the code output from dags. This fixes
the ice for *to = *from++;
2012-12-11 15:52:37 +09:00
Bill Currie
8452f69a21 Use only the real temp for daglabels.
This fixes the bogus temps for "*to = *from++;", but qfcc ices due to the
operand types being lost. It seems alias operands need to be resurrected,
if only for code output by dags.
2012-12-11 15:20:52 +09:00
Bill Currie
50b0bd0b95 Use define from temp aliases as well to kill uninit defines.
Finally, the uninitialized temp warnings are fixed.
2012-12-11 13:04:06 +09:00
Bill Currie
5083679fcc Don't mask out the dummy defines from temp kills. 2012-12-11 12:58:16 +09:00
Bill Currie
6b4efaa3e4 Link temp aliases to their main def.
This fixes the kill sets not building properly.
2012-12-11 12:57:37 +09:00
Bill Currie
28c37b367d Fix the dummy definitions of temp vars.
I forgot to add func->num_statements :P. Fixes the weirdness where only
some alias temps were being (bogusly) detected as uninitialized. Now they
all are.
2012-12-11 12:27:23 +09:00
Bill Currie
b5a72320bb Make alias defs and temps more obvious in dumps. 2012-12-11 12:26:48 +09:00
Bill Currie
f358364ef2 Fix assignment of nil to a structure.
constfold.c seems to be getting a little long in the tooth :P
2012-12-11 11:53:01 +09:00
Bill Currie
8582e9de63 Make it possible to dump statement blocks in a flow graph.
Much nicer looking with proper back edges :). Not actually enabled, though.
2012-12-11 11:31:55 +09:00