Bill Currie
9c9a71f1af
Allow defs to specify use of offset relocations.
...
Access to struct fields in near data can be done using only one operand,
but offset relocs need to be used. However, as not all defs want offset
relocs, a flag has been added to the def struct.
2011-02-15 22:55:15 +09:00
Bill Currie
0b5565396b
Add a class type to symbols and rework the CLASS_NAME handling.
...
This fixes the problem with [Array alloc] producing a warning about Class
not repsonding to -alloc.
2011-02-13 16:05:09 +09:00
Bill Currie
f24de89a2a
Handle type-modified constants.
...
The fix for pointers broke constants (particularly, enums). Oops.
2011-02-13 14:13:32 +09:00
Bill Currie
c4f364fd37
Emit pointers properly.
...
Rename ReuseConstant to emit_value and use emit_value to emit any non-short
constant. This fixes the null pointer in the call to __obj_exec_class.
2011-02-13 10:09:42 +09:00
Bill Currie
181596f5bf
Make relocation records store the space of the relocation.
...
The space is meaningless for op_* relocations as they are always in the
code space, but def_* relocations need to know which space holds the
location to be adjusted.
2011-02-12 22:34:38 +09:00
Bill Currie
1099ca086c
Dump the offending expression and statement for a bad instruction.
2011-02-10 14:25:09 +09:00
Bill Currie
a43946abf3
Give short values special treatment.
...
As a short value fits directly into a statement, it needs a fake def that
holds its value in the def's offset in order for the value to be written to
the statement.
2011-02-09 22:13:43 +09:00
Bill Currie
68cdc904f5
Give temporary variables unique names.
2011-02-09 10:04:55 +09:00
Bill Currie
681ded9375
Fix debug line number information.
2011-02-09 09:59:43 +09:00
Bill Currie
0d5ab6600d
Store the source expression in a statement.
...
This makes problem reporting more informative.
2011-02-08 18:18:34 +09:00
Bill Currie
3c849b970b
Handle union access now that they're detected properly.
2011-02-08 14:45:48 +09:00
Bill Currie
1d108a8cec
Support emitting symbolic constants.
2011-02-06 20:08:54 +09:00
Bill Currie
bc7d42d176
Immediate constants now work, though still not shared.
2011-01-28 21:39:01 +09:00
Bill Currie
4738c767a2
Fix branch label handling.
...
Conditional branches and goto now go to the correct location.
2011-01-27 21:11:32 +09:00
Bill Currie
95b17d9fd4
Rename add_statement_ref to add_statement_def_ref.
2011-01-27 21:10:37 +09:00
Bill Currie
cdea1d07aa
Produce code for progs.src mode.
...
Separate compilation will take fixing object files.
The generated code is broken due to various relocation fixups being
broken, and float immediates seem to be badly broken.
Debug information is broken too.
2011-01-27 15:44:11 +09:00
Bill Currie
f7d60397fb
Set the type for zer_def used by labels.
2011-01-26 22:43:59 +09:00
Bill Currie
36c99a8da1
Get function def creation working again.
2011-01-26 14:48:22 +09:00
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