Bill Currie
899af3119b
Use the correct type when generating a move expression.
2011-03-10 19:30:21 +09:00
Bill Currie
2129eaaf20
Dereference moves need movepi rather than movei.
2011-03-10 19:29:23 +09:00
Bill Currie
8d69c5c898
More tests
2011-03-09 20:34:23 +09:00
Bill Currie
cbbbf87e20
Resurrect the stats output.
2011-03-09 15:51:17 +09:00
Bill Currie
8368f57fbf
Close a potential buffer overflow.
2011-03-09 11:09:46 +09:00
Bill Currie
4d90eba2ad
Remove some unused globals.
2011-03-09 11:08:30 +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
39278ba8cc
Explicitly select between direct and indirect moves.
2011-03-09 10:30:57 +09:00
Bill Currie
b95cdc33d9
Set instace_size to the correct size.
2011-03-08 22:45:34 +09:00
Bill Currie
55eed1ae07
Make module dumping a little more informative.
2011-03-08 22:43:53 +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
f66e20db17
Set the dereferenced type in the field value.
2011-03-08 19:29:36 +09:00
Bill Currie
7198be5726
Treat entities a bit like structures in field_expr ().
...
Look in the entity field symbol table for the field before looking in the
normal symbol table. This allows entity fields to be accessed even when
the current scope has symbol of the same name. However, checking the
normal symbol table where there is no such field allows for field
variables when I get around to implementing them.
2011-03-08 19:28:11 +09:00
Bill Currie
505bde308e
Fix the handling of @system defs.
...
When treating a def as external, actually say it is external.
2011-03-07 20:53:27 +09:00
Bill Currie
8dbf8a97ea
Be more informative with ext/def internal errors.
2011-03-07 20:52:31 +09:00
Bill Currie
6312ccba81
Fix storage class blocks.
...
@extern { defs }; etc
2011-03-07 20:51:51 +09:00
Bill Currie
4db8ebb6af
Support qcc style local function variables.
2011-03-07 20:04:05 +09:00
Bill Currie
853cc53d0f
FIx the handling of storage class.
2011-03-07 17:49:01 +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
041c5d53b8
Check for the vector being a constant before trying to get its value.
2011-03-07 14:04:36 +09:00
Bill Currie
c069bafad8
Support casting from enum to float.
2011-03-07 14:04:05 +09:00
Bill Currie
5a78758781
Support return in void functions in v6 code.
2011-03-07 13:52:28 +09:00
Bill Currie
1246fd9e30
Use the correct size when growing a data space.
2011-03-07 13:36:00 +09:00
Bill Currie
02a70ebe1c
Remove the auxfunction manipulation from the compiler proper.
...
It was broken code in the first place (realloc and pointers), and is
redundant with the new linking process.
2011-03-07 13:33:02 +09:00
Bill Currie
16103f9018
Fix param mangling for qc style functions.
2011-03-07 10:43:38 +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
0b3d0011c5
Implement vector and quaternion component access.
2011-03-07 10:02:20 +09:00
Bill Currie
f0e47f2334
Clean up some code duplication.
2011-03-07 10:01:21 +09:00
Bill Currie
a6f222106e
Fix taking the address of normal variables.
...
Treat them the same as structure variables.
2011-03-07 09:58:51 +09:00
Bill Currie
3c1784d46c
Fold constants on both sides of = to ensure correct expression types.
2011-03-07 08:33:30 +09:00
Bill Currie
66447df6b3
Undo the offset relocation of local defs.
...
The debug info expects local defs to be 0 based, so once relocations in
the progs data have been completed, undo the local def offset relocation
so that the correct offsets will be written to the debug info.
2011-03-06 21:05:25 +09:00
Bill Currie
b2f0c9a127
Dump the local defs for functions when debug info is available.
2011-03-06 21:03:12 +09:00
Bill Currie
b49d90e769
Do not lose the block expression when taking its address.
2011-03-06 16:32:51 +09:00
Bill Currie
c78d15b331
Support taking the address of block expressions that have a result.
2011-03-06 16:05:38 +09:00
Bill Currie
993d05b3d3
Support taking the address of alias expressions.
...
Taking the address of an alias expression undoes the alias but uses the
aliased type.
2011-03-06 15:58:49 +09:00
Bill Currie
b74c644a10
Perform offset field relocations.
2011-03-06 15:41:38 +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
c4e9a45d91
Do not lose the entity field defs.
2011-03-06 15:40:07 +09:00
Bill Currie
b7aa2f6786
Support access to struct fields in a structure in an entity.
2011-03-06 15:39:27 +09:00
Bill Currie
fe3d228658
Maintain a symbol table for entity fields.
2011-03-06 15:38:19 +09:00
Bill Currie
c29e0250e4
Make def_field_Ofs reloc dumps more informative.
2011-03-06 15:34:53 +09:00
Bill Currie
02766f0795
Do not try to dump def values from spaces with no data.
2011-03-06 15:33:53 +09:00
Bill Currie
1eb759bb8a
Update reloc_names.
...
I really need to get reloc_names unduplicated.
2011-03-06 15:33:10 +09:00
Bill Currie
d1187f0857
Set the edict area size when dumping qfo files.
2011-03-06 13:41:00 +09:00
Bill Currie
7bfaf107ce
Set the output file name as early as possible.
2011-03-06 13:40:24 +09:00
Bill Currie
417d1b4442
Fix structure copy into and out of entities.
2011-03-06 13:19:20 +09:00
Bill Currie
dc7a78b2ff
Fix case label type conversions.
...
The previous method made too many assumptions.
2011-03-06 11:41:01 +09:00
Bill Currie
fe4df03896
Add is_float ().
...
For now, it checks just floats, but I might one day add doubles.
2011-03-06 11:35:15 +09:00
Bill Currie
85bffbcad0
Add is_integral() to check for integral types (integer, short, enum).
2011-03-06 11:25:12 +09:00
Bill Currie
17a9dff769
Avoid freeing an operand twice.
...
Due to the way operands are used, they can be freed twice in dead-statement
removal. Detect the double-free and ignore it.
2011-03-06 11:19:09 +09:00
Bill Currie
28f4de94d2
Fix switch statements so the work in the new scheme.
...
Convert case labels to be the same type as the switch expression.
Use alias expressions for the various test expressions.
2011-03-06 00:29:29 +09:00
Bill Currie
8cfa80b5d4
Implement think expressions.
2011-03-05 18:01:37 +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
a3c1f339fc
Gracefully handle undefined symbols in entity field expressions.
2011-03-05 17:22:04 +09:00
Bill Currie
fbea276ede
Yet more tests.
2011-03-05 17:21:19 +09:00
Bill Currie
7314b944d5
Bring back the offset alias support.
...
Accidently nuked it when fixing .return etc.
2011-03-05 16:31:32 +09:00
Bill Currie
e7e8220246
Dump code addresses as hex, too.
2011-03-05 16:25:56 +09:00
Bill Currie
2f74e6e4bf
Nuke the old progs global.
...
It is no longer needed thanks to the new qfo conversion functions.
2011-03-05 16:24:53 +09:00
Bill Currie
fcb567fc98
Use the correct function number when updating the function def.
...
Functions are 1 based in progs bug 0 based in qfo files.
2011-03-05 16:00:39 +09:00
Bill Currie
535dfad305
Emit defs for far data.
...
They will break when the offsets exceed 64k, but they are needed for
debugging.
2011-03-05 15:59:14 +09:00
Bill Currie
97b1ceceb0
Fix line number info.
...
line number info is now 1 based rather than 0 based (to better detect when
a function does not have line number info).
2011-03-05 15:40:08 +09:00
Bill Currie
1dea86a3e4
Update debug info loading when dumping qfo files.
2011-03-05 14:53:41 +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
7c95913c61
Avoid segfaulting with bad string relocs.
2011-03-05 09:07:16 +09:00
Bill Currie
8eb5fd653a
Perform the relocations!!!
...
line numbers seem to be broken, but the code itself looks good.
2011-03-05 08:41:14 +09:00
Bill Currie
fe7be543f8
Correctly update the offset of code relocs.
2011-03-05 08:39:47 +09:00
Bill Currie
7fd839a5ed
Handle chains of alias defs so relocs will be emitted.
2011-03-05 08:39:16 +09:00
Bill Currie
bbedbf5c9c
Add the .return etc symbols to the symbol table.
...
This puts their defs into the object file.
2011-03-05 08:37:51 +09:00
Bill Currie
c3f1c186f8
Resolve types of .return etc.
2011-03-05 08:36:55 +09:00
Bill Currie
af7bc81e16
Chain the types for the linker.
2011-03-05 08:35:56 +09:00
Bill Currie
0bd0f783b2
Update def offsets with their final locations.
2011-03-04 23:37:46 +09:00
Bill Currie
6d02555ca9
Reorganize the offset calculations.
...
keep the offset calculations separate from the data transfers for better
clarity in what is happening.
2011-03-04 23:31:09 +09:00
Bill Currie
e62163e569
Nuke any invalidated relocs.
2011-03-04 21:46:19 +09:00
Bill Currie
2565e0db32
Update reloc targets when linking.
2011-03-04 21:29:47 +09:00
Bill Currie
bc78b84869
Set the target of string relocs to the string index.
2011-03-04 21:29:10 +09:00
Bill Currie
7fb22bd1e4
Make D_STRING() more useful and add D_GETSTR()
2011-03-04 21:28:12 +09:00
Bill Currie
e04f6266b1
Nuke def_list from defref_t.
...
It didn't work :/.
2011-03-04 20:40:01 +09:00
Bill Currie
5a552d8841
Add the null function.
2011-03-04 20:29:40 +09:00
Bill Currie
368a3826be
Redo the offset and size calculations for qfo_to_progs().
2011-03-04 20:14:02 +09:00
Bill Currie
cd12a78f93
Replace some accidentally deleted code.
...
Forgot to commit it the first time round, then rebase messed me up and I
didn't notice until after pushing. *sigh*
2011-03-04 19:02:47 +09:00
Bill Currie
72fae608e5
Write the function start address to the progs file.
...
Oops:P
2011-03-04 18:46:28 +09:00
Bill Currie
2211a807d4
Do not relocate builtin functions.
2011-03-04 18:46:25 +09:00
Bill Currie
d6d8b5b49d
Generate the debug symbol file.
2011-03-04 18:46:05 +09:00
Bill Currie
9a96febdf5
Fix the hordes of bogus defs.
...
They were caused by unused external defs, so not processing unused externs
in the first place is the simplest solution.
2011-03-04 14:51:09 +09:00
Bill Currie
7b7f4c70e0
Correct non-external def processing.
2011-03-04 14:33:03 +09:00
Bill Currie
c5dac6d1d1
Transfer the type encoding.
...
oops
2011-03-04 14:29:22 +09:00
Bill Currie
d0b4546383
qfprogs isn't yet fully functional...
2011-03-04 13:54:29 +09:00
Bill Currie
2992d66f87
Simplify the tag used for anonymous structs etc.
...
Hopefully two files with the same file name won't have anonymous stucts on
the same line.
2011-03-04 13:52:32 +09:00
Bill Currie
e525727a24
Add a null type descriptor to the linker output.
2011-03-04 11:38:33 +09:00
Bill Currie
3a828ca5c2
Ensure work spaces are always connected to their data.
2011-03-04 11:18:56 +09:00
Bill Currie
45c3dd67a8
Some test updates.
2011-03-04 08:27:26 +09:00
Bill Currie
4192ef835c
Delay initialization of obj_module_t as long as possible.
...
This keeps the type descriptor out of progs that never use any
Objective-QC features.
2011-03-04 08:25:50 +09:00
Bill Currie
c99f3aba0e
Add the new header files for make dist.
2011-03-04 00:11:13 +09:00
Bill Currie
fd24524e13
More tests.
...
I really need to sort out some test automation.
2011-03-03 22:32:22 +09:00
Bill Currie
ee9045c377
Emit code for jump tables.
...
With this, the entirety of the ruamoko tree builds (though the progs will
be broken in various ways: mostly unrelocated references).
2011-03-03 19:09:00 +09:00
Bill Currie
a281033920
Alais the jump table's array to an integer.
...
As per the previous commit, I'm not sure this is the right thing to do, but
it works for now.
2011-03-03 19:07:37 +09:00
Bill Currie
4324486ae6
Give - unary expressions special treatment.
...
The progs engine has no neg instruction, so need to implement -val as
nil - val
2011-03-03 18:13:30 +09:00
Bill Currie
f9e177efd6
Obtain the label to be removed from the correct place.
...
This fixes the undetected dead block after "if return else return".
2011-03-03 17:50:46 +09:00
Bill Currie
ed901bd48f
Drop unused labels rather than adding them to the statement block.
...
However, even unused labels create a new statement block if necessary.
2011-03-03 17:35:06 +09:00