Commit Graph

9415 Commits

Author SHA1 Message Date
Bill Currie 9d0332ae30 Make alaising a def to a larger type an internal error.
It really doesn't seem wise to allow the compiler to do so as it would
overwrite unrelated defs. The only time such a thing is valid is the return
statement (silly vm design), and that's read-only.
2012-12-03 11:38:55 +09:00
Bill Currie 9ca5a9e86c Make aliasing an alias def an internal error.
I haven't seen the bug message show up, so it seems safe, and is probably a
good idea with what I have in mind.
2012-12-03 11:36:14 +09:00
Bill Currie cd64c0ad9b Document defspace.h 2012-12-02 22:04:54 +09:00
Bill Currie 3ecb7e8805 Mised some st_->sc_ changes.
Hiding in a comment in a header, sneaky rats ;)
2012-12-02 22:00:07 +09:00
Bill Currie 79c1a8f37a Use internal_error instead of error/exit(1).
Heh, an abort hiding in disguise :)
2012-12-02 20:15:18 +09:00
Bill Currie e3bf64262f Remove the "data" defspace from pr_info_t.
It's only usage would have caused a segfault if it had been hit. I suspect
it's a holdover from before the rewrite of 2011.
2012-12-02 20:09:54 +09:00
Bill Currie 72108ba0b5 Document def.h.
Also remove the extern for current_storage as it belongs in shared.h.

I'm not satisfied with the documentation for initialize_def, but it will do
for now. I probably have to rewrite the thing as it's a bit of a beast.
2012-12-02 19:54:20 +09:00
Bill Currie fd765f5e62 Fix an ownership problem with line numbers in qfos. 2012-12-02 18:59:35 +09:00
Bill Currie 5725c5124c Rename the storage_class_t enum values.
With the intoduction of the statement type enum came a prefix clash. As
"st" makes sense for "statement type", I decided that "storage class"
should be "sc". Although there haven't been any problems as of yet, I
decided it would be a good idea to clean up the clash now. It also helps
avoid confusion (I was a bit surprised after working with st_assign etc to
be reminded of st_extern etc).
2012-12-02 10:11:30 +09:00
Bill Currie 4c65d9f2a4 Fix up the definitely lost memory blocks.
qfcc isn't meant to be long running, so I'm not super worried about memory
usage, but definitely lost memory blocks when compiling just a single
function seems a tad sloppy.
2012-12-01 20:53:58 +09:00
Bill Currie b0c08bf24b Build the tests with optimization.
Egad, the whole point of the tests was to make sure the optimizations work.
2012-12-01 16:40:37 +09:00
Bill Currie 54289da416 Fix the line number info for else.
It has bugged me for a while that the goto for else would display the if's
source line.
2012-12-01 16:37:38 +09:00
Bill Currie 7e4ec4cee4 Update qfcc's TODO
Remove old completed items, complete a couple, etc.
2012-12-01 15:41:30 +09:00
Bill Currie ff0c51e52c Build our ruamoko stuff with optimizations :) 2012-12-01 11:20:06 +09:00
Bill Currie d47fa0fc89 Make the new optimizations optional.
The usual -O :) (no numbers yet, though). Alternatively, -C [no-]optimize
may be used.
2012-12-01 11:13:45 +09:00
Bill Currie 848493379d Support calls through function temps.
I had forgotten function vars stored in ents and objects would use a temp
when calling the function.
2012-12-01 11:10:47 +09:00
Bill Currie 5e9d7d3567 Don't use the expr type for assignments.
Instead, the type is taken from the source operand (this means the computed
type of .return for that var). ctf now builds :)
2012-11-30 21:06:08 +09:00
Bill Currie df66669a87 Handle back edges in return type flow.
Turns out the flow loop needs to be repeated until there are no changes.
2012-11-30 18:25:47 +09:00
Bill Currie 9e4fb3d3e7 Fix the return type flow.
Uninitialized variable :P
So far, basic tests seem to be good.
2012-11-30 17:24:39 +09:00
Bill Currie 554b2e4710 Add flow analysis to determin the type of .return.
It doesn't quite work yet, but...

It has proven necessary to know what type .return has at any point in the
function. The segfault in ctf is caused by the return statement added to
the end of the void function messing with the expr pointer stored in the
daglabel for .return. While this is actually by design (though the
statement really should have a valid expr pointer rather than), it actually
highlights a bigger problem: there's no stable knowledge of the current
type of .return. This is not a problem in expression statements as the
dagnodes for expression statements store the desired types of all operands.
However, when assigning from .return to attached variables in a leaf node,
the type of .return is not stored anywhere but the expression last
accessing .return.
2012-11-30 17:15:05 +09:00
Bill Currie 388247791d Re-enable the dags specific flow graph dump. 2012-11-30 16:56:25 +09:00
Bill Currie 71d1804e22 Clean up flow diagrams.
Now information like dags or live variables are dumped separately, and the
live variable information replaces the flow node in the diagram (like dags
have recently).
2012-11-30 16:52:22 +09:00
Bill Currie 93f53605ed Move and rename statement related flow_is_* and flow_get_*
They really should have been in statements.[ch] in the first place
(actually, they sort of were: is_goto etc, so some redundant code has been
removed, too).
2012-11-30 14:06:52 +09:00
Bill Currie 086fd0f3c3 Correct a comment. 2012-11-30 13:57:08 +09:00
Bill Currie 8d23573ebb Move the mingw stuff to a more realistic place.
If I ever get mxe built, I'll update for that.
2012-11-30 13:40:46 +09:00
Bill Currie 0bdf511da6 Fix qf-release to work with the new mingw cross scripts. 2012-11-29 11:39:58 +09:00
Bill Currie 433b3c0b31 make distcheck fixes. 2012-11-29 11:34:34 +09:00
Bill Currie 6857fe55ce Make all the cross-compiling scripts consistent.
Now all cross builds automatically build qfcc and pak, bail on error, and
use pkg-config correctly.
2012-11-29 11:19:09 +09:00
Bill Currie 042cae29b1 Use pkg-config when checking for sdl.
This makes setting up for cross-compiling cleaner.
2012-11-29 11:16:06 +09:00
Bill Currie 568b719c1b Make a bunch of improvements to the droid cross scripts.
Native versions of qfcc and pak are now built automatically, and the
android toolchain now defaults to a more sensible place. Also, the separate
pkg-config replacement is no longer necessary.
2012-11-29 10:30:36 +09:00
Bill Currie e97193faf6 Add error to stub.c.
It turns out libc has an "error" function too, but the android libc does
not, thus qfprogs wouldn't link when building for droid.
2012-11-29 10:26:19 +09:00
Bill Currie 69d9a2b452 Hit some inlining issues with a big stick.
It turns out gcc has a way to force functions to inline even when it thinks
doing so would not be a good idea (call to a modest sized function unlikely).
2012-11-29 10:18:52 +09:00
Bill Currie b5f2da0b78 Copy the entity leaf leak from qw. 2012-11-29 10:15:52 +09:00
Bill Currie a12eb940f1 Remove the hard-coded bsp maximum depths.
The depth limits in the gl and glsl renderers and in the trace code really
bothered me, but then the fix hit me: at load-time, recurse the trees
normally and record the depth in the appropriate place. The node stacks can
then be allocated as necessary (I chose to add a paranoia buffer of 2, but
I expect the maximum depth will rarely be used).
2012-11-28 21:29:03 +09:00
Bill Currie 7c3ad46b48 Correct the endianess.
mips-linux is little endian (missed edit from the copy from ps3)
2012-11-28 19:15:38 +09:00
Bill Currie c4ba294433 Fix the icky fixme :) 2012-11-27 20:32:52 +09:00
Bill Currie a91f4cedeb Add the @nil keyword.
@nil is exactly the same as nil, but it is always available.
2012-11-27 18:33:42 +09:00
Bill Currie edeffd64e9 Fix a missed obj_module_s/_t from the class cleanup.
Doesn't seem to have caused any problems, but still :)
2012-11-27 18:33:42 +09:00
Bill Currie 026a992179 Add a test case for the alias chain mangling.
I think I need to rework the tests to better handle compile-only tests.
2012-11-27 18:33:41 +09:00
Bill Currie 31b07bcbbf Rewrite expr_alias().
Modifying the existing alias chain proved to be a bad idea (in retrospect,
I should have known better:P). Instead, just walk down any existing alias
chain to the root operand and build a new alias from that.
2012-11-27 18:33:41 +09:00
Bill Currie 1cd58b30f4 Fix the library dependencies for the servers.
It's so rarely I build without clients...
2012-11-27 13:18:23 +09:00
Bill Currie 62bac6e7b4 Add scripts for cross-compiling for mipsel-linux.
These are based on the ps3dev scripts, so native qfcc and pak are built
automatically.

Note that there may be a need to replace or even just nuke bison in the
toolchain as it is too old and can't build qfcc.
2012-11-27 13:18:23 +09:00
Bill Currie 215ff61216 Add a test for the dead boolean expression.
This tests the zombie label problem found via ctf.
2012-11-26 21:05:24 +09:00
Bill Currie d6b38dd0ee Add an option to control expr tree dumping.
About bloody time :P
2012-11-26 21:00:28 +09:00
Bill Currie e28aa0a5fb Fix some errors in the set code.
I really need to write some unit tests for the set code, but with this (and
an uncommitted dags patch (still thinking about it)) ctf compiles.
2012-11-26 17:19:02 +09:00
Bill Currie 8e225cd726 Fix a missing label use count decrement.
if statements in dead code weren't being removed due to the label.
2012-11-26 16:13:59 +09:00
Bill Currie 24847857ef Fix some whitespace. 2012-11-26 16:13:40 +09:00
Bill Currie 128547b885 Resurrect the "next" pointers for labels and conditionals. 2012-11-26 16:09:53 +09:00
Bill Currie f7417345ba Rewrite print_bool to be more informative. 2012-11-26 15:47:10 +09:00
Bill Currie 147d00d41f Rewrite print_block making it more informative. 2012-11-26 15:04:33 +09:00