Commit Graph

127 Commits

Author SHA1 Message Date
Bill Currie 6ce3c5a59a Get statments being emitted to the code segment.
The first function seems to work fine, but there's a problems with the
scope of params causing params to get their knickers in a twist (tangled
linked list).
2011-01-25 15:46:48 +09:00
Bill Currie ea3895805b Rewrite much to use symbols and symtabs. Gut emit.c. Massive breakage.
That which isn't rewritten is horribly broken. However, this does include a
nice mechanism for building QC structs for emitting data.

emit.c has been gutted in the spirit of "throw one away".

There is much work to be done to get even variables emitted, let alone
code. Things should be a little more fun from here on.
2011-01-17 22:34:41 +09:00
Bill Currie 8f71986306 Add symbol expressions (like def expressions).
They will eventually replace def expressions. Currently quite broken.
2011-01-13 14:54:24 +09:00
Bill Currie 008f4e1929 Don't return .return in advanced mode. 2011-01-13 14:50:25 +09:00
Bill Currie 638f4445cc More return code cleanup.
Don't use the true void return in traditional mode.
Prefer the true void return over "done" at the end of functions.
Don't emit the above if the last emitted statement is a return and there is
no label at the end of the function.
2011-01-13 00:46:46 +09:00
Bill Currie 3c9991364b Add a "void return" instruction.
I got fed up with always having to explicty return something.
2011-01-13 00:29:56 +09:00
Bill Currie 96ba4605fa Fix the micro-optimization that avoided emitting x = x
The check was broken by alias defs. If a def is aliased, the alias must be
checked.
2011-01-12 23:33:51 +09:00
Bill Currie 4da2657bfe Fix most of the notice spam (hacky).
The implementation and declaration of OP_DONE disagree (not sure what to do
about it yet), so give it special treatment when emitting.
2011-01-11 08:07:04 +09:00
Bill Currie 75ec6bf244 Clean out some unnecessary types from the progs engine and clean up the mess.
This is a nasty commit, sorry, but 99% of the commit is interdependent.
2011-01-10 12:25:31 +09:00
Bill Currie fa08e4afb7 Print users info when dumping statements. 2010-12-19 11:16:04 +09:00
Bill Currie 67beaf4487 Nil is a constant, so allow it in global initializers. 2010-11-24 17:01:18 +09:00
Bill Currie 22776f9ffd get double indirection working
do not try to optimize the output of the sub-dereference in a dereference
2010-01-13 06:31:06 +00:00
Bill Currie 1dc4683961 ensure all instructions are fully initialized. 2009-12-20 11:09:58 +00:00
Bill Currie 9ac15436d9 More docs.
Enhance qfprogs qfo debugging.

Make sure functions marked as extern don't emit anything. Fixes the segfault
when building klik.
2008-08-01 13:54:24 +00:00
Bill Currie 9509d0fd5e make qfo files typesize safe 2007-04-07 12:35:03 +00:00
Bill Currie c560744270 "use" parent defs 2007-04-06 11:01:34 +00:00
Bill Currie f7df6fea17 instead of having cpp args in progs.src, potentially breaking some mods, generate progs.i as a series of #includes and then compile everything in one pass 2006-05-24 14:35:39 +00:00
Bill Currie 3fb03fc2be hah, should have been using __attribute__((used)) all that time (rather
than __attribute__((unused))). fixes the missing console in -x11
2005-08-04 15:27:09 +00:00
Bill Currie 3f58823fed vector-calls now works with rcall :) 2005-06-12 11:37:28 +00:00
Bill Currie 762aefc9b1 implement Raven's calling convention (rcall: first 2 params in opb and
opc). should give a general speedup to most progs.
2005-06-12 09:54:01 +00:00
Bill Currie 66cabb587f add the vector-calls "optimisation" from fteqcc. makes it possible to
compile the version of frogbot with waypoints for almost 300 maps.
2005-06-10 07:31:25 +00:00
Bill Currie 9f662787e0 get struct copy to/from struct fields via pointers. fixes a bug found by
snax
2005-06-09 10:34:03 +00:00
Bill Currie 0360859a0f all warnings (except for @self and self) are now fully controllable 2004-02-17 00:39:21 +00:00
Bill Currie c3f41e3e69 new opcode: state.f. same as state, but takes a 3rd float operand to
specify the step for calculating nextthink. accessed using
[frame, think, step] (state is [frame, think])
2004-02-11 01:43:33 +00:00
Bill Currie 39c7ff1e90 disable debug output 2004-01-25 08:59:55 +00:00
Bill Currie 51b0a66ac7 better constant folding with auto-conversion between scalar types (might
make that optional for non-constants)
2004-01-25 08:55:03 +00:00
Bill Currie 5f97de56d1 fix a few bugs 2003-10-22 09:14:53 +00:00
Bill Currie 945006494f short circuit logic for && and || (as per C). forces standard precedence
(ie, breaks --traditional) when enabled (no choice at the moment, next fix)
2003-10-22 08:05:17 +00:00
Bill Currie 23b525059f cast between integer and unsigned just by changing access method
effectively deprecating conv.ui and conv.iu (they'll die eventually:)
2003-09-02 16:45:36 +00:00
Bill Currie 3a6c8b8b16 wrong place to decrement uses. now have a problem in switch :/ 2003-09-02 06:23:57 +00:00
Bill Currie b01d4d4589 get the type for the destination from the right place (hope that wasn't
a bugfix for something else:)
2003-08-24 20:38:32 +00:00
Bill Currie 7cffeb27bf correct the temp def counting when casting 2003-08-24 08:17:31 +00:00
Bill Currie 6086aa2b99 allow casts between pointers and integers 2003-08-24 08:03:25 +00:00
Bill Currie b38486d405 make rel_def_op work properly 2003-08-22 19:48:14 +00:00
Bill Currie e9ca03416a create the temp def for bound defs properly 2003-08-22 18:16:30 +00:00
Bill Currie 11c7c27f70 better relocations: pointers to structure members now work 2003-08-21 02:21:30 +00:00
Bill Currie 448b6f24be make the useless expression warning more interesting 2003-08-05 21:41:48 +00:00
Bill Currie 8099f0d8f2 handle addresses of void defs 2003-07-30 20:57:50 +00:00
Bill Currie 6ecb707257 revamp the struct system so "struct foo;" does the right thing (ala C) 2003-07-30 04:11:45 +00:00
Bill Currie dedb2fa6bf get [super ...] working correctly 2003-05-15 05:58:31 +00:00
Bill Currie f59f766af1 use the correct type when taking the address of a pointer derefernece 2003-05-13 19:42:14 +00:00
Bill Currie b6b5089ccc add a "nosave" flag to defs making it easier to make defs that don't get
saved automaticly
2003-04-25 17:00:22 +00:00
Bill Currie a21054fdfc handle def aliases properly in emit_move_expr 2003-04-22 17:26:49 +00:00
Bill Currie 2f6fc5d80c general revamp so params and the return value use proper defs rather than
hardcoded locations. this will allow use of quaternions in the future.
2003-04-22 15:29:32 +00:00
Bill Currie eb099ae0d3 make qf gcc 3.3 clean 2003-04-17 00:01:48 +00:00
Bill Currie 627c6f70f5 allow casting between function types 2003-03-10 21:23:05 +00:00
Bill Currie 761a7546dd re-arrange things so __attribute__ and __builtin_expect are properly
autoconfiscated so rcsid will continue to work with gcc 3.3
2003-01-15 15:31:36 +00:00
Bill Currie 71196fedf6 make gcc more anal about prototypes, string constants and function
visibility (ie, global functions must have a prototype)
2003-01-06 18:28:13 +00:00
Bill Currie 567b905590 copyright block work 2002-10-22 14:53:18 +00:00
Bill Currie 262baccd0e remove debug code :P 2002-10-20 03:31:08 +00:00