Bill Currie
d8a5d6745f
Add a param flag to defs.
...
It is necessary to know if a def is a function parameter so it can be
treated as initialized by the flow analyzer. The support for the flag in
object files is, at this stage, purely for debugging purposes.
2012-11-20 17:50:59 +09:00
Bill Currie
158e261a8f
Give reusable temps their own linked list.
...
The next field is used for linking all defs in a space. Oops.
2012-11-19 10:33:03 +09:00
Bill Currie
1af4d5eeed
Ensure reused temps have the correct type.
...
The type of a temp may change through its life as it's really the location
and name that are reused.
2012-11-19 10:31:22 +09:00
Bill Currie
0c3aeb30aa
Reuse tempary variables.
...
Now that I've got nice code, it was worth doing. Unfortunatly, bsearch
style switch statements have problems.
switch.r:14: BUG: temp users went negative: <tmp 0x21b6840:-1>
switch.r:14: BUG: temp users went negative: <tmp 0x21b6840:-2>
switch.r:14: BUG: temp users went negative: <tmp 0x21b6840:-3>
switch.r:14: BUG: temp users went negative: <tmp 0x21b67d0:-1>
2012-11-18 19:10:18 +09:00
Bill Currie
ffa08a99c2
Store the initializer expression in the def.
...
Initially, this will be used for collecting the targets of a jumpb
instruction.
2012-11-15 13:44:07 +09:00
Bill Currie
28ce35f1c1
Make values independent objects.
...
values are now uniquely allocated (for the current object file). With
this, constants in dags will work.
2012-11-15 13:44:06 +09:00
Bill Currie
93b007b1f8
Take care of relocs when defining external defs.
...
For most of the cases, some relocs may have been lost, but they were
certainly lost for type encodings. Now that all seems to be fixed.
2012-11-12 16:14:09 +09:00
Bill Currie
cc24e2e67e
Initialize global string vars correctly.
...
Ouch, I'd fixed that for arrays, but not normal vars.
2012-11-09 12:23:04 +09:00
Bill Currie
9095e1eabc
Rework build_switch to use initialize_def.
...
This required support for label reference expressions, whose purpose is to
represent the address of a label.
2012-11-09 12:22:34 +09:00
Bill Currie
ec98e3e206
Mark alias def chains as a bug.
2012-05-03 13:27:30 +09:00
Bill Currie
bc1b483525
Nuke the rcsid stuff.
...
It's pretty useless in git.
2012-04-22 10:56:32 +09:00
Bill Currie
2de7733b6a
Fix initialized variable type handling.
...
Same problem as initialized constants :P
2011-03-30 21:21:38 +09:00
Bill Currie
8e18c76bde
Make initialized variables defs rather than immediate constants.
2011-03-30 19:58:09 +09:00
Bill Currie
7dbd2ec172
Allow field aliasing.
...
Initializing a field variable to another field will set the new field to
point to the same location. No type checking is done.
eg:
.SEL thinkMethod = think;
2011-03-30 09:33:47 +09:00
Bill Currie
8d3508cf20
Allocate space for temp defs using size rather than type.
...
Statement operands throw away the high level type information, so store
type size in the operand and use this size for allocating space for temps
rather than using the low-level type.
2011-03-23 21:32:14 +09:00
Bill Currie
d4be914019
Fix initialized vector variables.
...
The whole initialized variable system is wonky, but it will do for now.
2011-03-22 15:10:06 +09:00
Bill Currie
7dbd5f656c
Fix traditional vector component access.
2011-03-22 13:05:42 +09:00
Bill Currie
f1d9570dc8
Fix constant value type handling.
...
Rename immediate.[ch] to value.[ch] and clean up the mess.
Add convert_value() to convert the type of a value (only scalar types).
2011-03-22 12:24:39 +09:00
Bill Currie
0c0f4360da
Make field defs "nosave".
...
The engine treats fielddefs with DEF_SAVEGLOBAL set as bogus.
2011-03-21 17:06:45 +09:00
Bill Currie
2464a89d37
Preserve relocs across def churning.
...
Freeing then re-allocating a def to change its storage from external is
really not the right way to do it, but for now this fixes the loss of the
relocs. With this, the menus seem to work :)
2011-03-09 10:52:29 +09:00
Bill Currie
7c770b75c5
Do not creat field defs for local storage.
...
This prevents field params and local vars from messing up the real field
defs.
2011-03-08 19:56:02 +09:00
Bill Currie
7649549de6
Handle external field declarations.
2011-03-07 17:23:52 +09:00
Bill Currie
49e446b637
Make field defs global.
...
It turns out that field defs need to be global after all, so use separate
field def tables in the linker.
2011-03-07 14:45:50 +09:00
Bill Currie
29cac0fe3a
Optionally create *_[xyz] symbols for accessing vector components.
...
"vector-components" in code options controls this feature. The default is
off for advanced code and on for traditional code. Disabling
vector-components prevents the comonent names polluting the namespace and
reduces the number of globals needed for vector fields if the components
of that field are never used.
2011-03-07 10:21:40 +09:00
Bill Currie
8712d30d1a
Make entity field defs static.
...
Entity field defs need to be static in order to avoid clashing with their
field variables.
2011-03-06 15:41:15 +09:00
Bill Currie
fe3d228658
Maintain a symbol table for entity fields.
2011-03-06 15:38:19 +09:00
Bill Currie
7209c61912
Fix initializing local float variables with an integer constant.
...
Run the assignment expression through fold_constants to handle any
necessary conversions and error checking.
2011-03-05 17:23:58 +09:00
Bill Currie
cfefd79e07
Fix the source of bogus string relocs.
...
Nested aggregate initializers were corrupting themselves.
2011-03-05 09:21:12 +09:00
Bill Currie
c06dd776d2
Fix expression initializers for arrays and structs.
2011-03-02 22:28:17 +09:00
Bill Currie
c10a551c84
Rename new_defspace() and defspace_new_loc().
2011-02-24 13:07:36 +09:00
Bill Currie
e68e6d0858
Create defs for entity fields in the entity space.
2011-02-22 15:43:15 +09:00
Bill Currie
7d1f2c4ef3
Fix field def allocation for non-function fields.
2011-02-22 10:43:35 +09:00
Bill Currie
b7c6c4af5d
Better variable naming in init_elements().
2011-02-22 09:22:04 +09:00
Bill Currie
0f0ed3dae2
Allow null types in defs again.
...
However, only at the lowest level. This is needed for my type encoding.
2011-02-18 09:04:33 +09:00
Bill Currie
4e86b28b59
Use the def type rather than expression type to select the init method.
...
Local defs may be initialized with non-constant expressions, which
includes function calls. Both function calls and aggregate initializers
use block expressions.
2011-02-15 09:38:44 +09:00
Bill Currie
19f6faf0ad
Fix aggregate initializers.
...
Initializing arrays and structs seems to be working.
2011-02-15 09:30:37 +09:00
Bill Currie
f1fccb19dd
Allow same-type re-declarations of uninitialized variables.
...
This is especially important for declaring variables that were previously
declared external.
2011-02-14 23:10:46 +09:00
Bill Currie
23b01be214
Handle invalid initializers gracefully.
2011-02-14 23:10:46 +09:00
Bill Currie
4c63a0bad6
Generate a warning when creating a var with no type.
...
This makes the internal error in new_def() non-functional, but the warning
will catch the bug and there's no harm in leaving the test in new_def().
2011-02-14 23:10:46 +09:00
Bill Currie
3e5989463f
Update the def_tail when removing the last def from the space.
2011-02-14 23:10:45 +09:00
Bill Currie
c336aaeb80
Handle incomplete types gracefully.
2011-02-13 19:26:20 +09:00
Bill Currie
8c01497936
Give __obj_exec_class a sterner beating.
...
When linking a def into a defspace, ensure it can be removed. This fixes
the missing __obj_exec_class def in qwaq.
2011-02-11 22:29:57 +09:00
Bill Currie
0efc759f2d
Catch attempts to create a def with a null type.
2011-02-11 22:29:57 +09:00
Bill Currie
c3a991e555
Support nil in initializers.
2011-02-10 14:51:52 +09:00
Bill Currie
01a7af17e5
Beat __obj_exec_class into submission.
2011-02-10 00:15:19 +09:00
Bill Currie
afc6605739
Don't set the space for external defs.
2011-01-29 09:55:14 +09:00
Bill Currie
f45919df09
Need alias defs after all.
2011-01-25 15:42:26 +09:00
Bill Currie
726f293d0d
Allocate space for defs and handle basic initializations.
...
Block initializers (arrays and structs) are still broken.
2011-01-25 12:16:13 +09:00
Bill Currie
0624408317
Move the diagnostic functions into their own file.
2011-01-24 21:54:57 +09:00
Bill Currie
afc5b2827d
Simplify def handling, use far data.
...
Since there is now a proper symbol table, defs are now just references to
memory locations and the symbol table takes care of duplicates.
Also, start using far data for ObjQC structures.
The qfo functions have been stubbed out until I figure out what to do with
object files in the new scheme.
2011-01-24 15:41:43 +09:00