Bill Currie
b3d5789377
More tests.
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
ee866ae3a6
Enable the small struct optimization.
...
For now, anyway. It would probably be much better to handle this sort of
thing in the optimizer stage.
2011-02-14 23:10:45 +09:00
Bill Currie
bcaf3687c5
Fix loading structs into params via an offset pointer.
...
For certain values of "fix" :/. The code is ugly, but it does the right
thing: calculate the effect address and use the resulting pointer in a
move instruction.
2011-02-14 23:10:45 +09:00
Bill Currie
352be1f8bd
Handle null string pointers.
2011-02-14 23:10:45 +09:00
Bill Currie
e10d561459
Treat small structs as integers (disabled).
...
This is more to stash away a potential optimization. I need to fix the
real problem first.
2011-02-14 23:10:45 +09:00
Bill Currie
6b29568fa9
Set the source file and line when copying an expression.
...
This fixes the crazy line numbers in the debug info.
2011-02-14 23:10:45 +09:00
Bill Currie
fc18ebd923
Add the source line number to most node labels.
2011-02-14 23:10:45 +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
11485556e5
Quote expression names to avoid problems with null pointers.
2011-02-14 23:10:45 +09:00
Bill Currie
c139099294
Put another bandaid on the type creation system.
...
It seems that building types is very fragile: all too easy to fix things
in one place and break something somewhere else. I guess the type system
will need a comlete rewrite at some stage.
2011-02-14 23:10:45 +09:00
Bill Currie
e3325b199e
More tests.
2011-02-14 23:10:45 +09:00
Bill Currie
e0d61705b4
And fix build_struct for built-in struct types.
...
The previous fix broke builtin structs (eg, @param). Calling find_type()
for built-in structs has proven to be a bad idea :)
2011-02-13 21:07:22 +09:00
Bill Currie
a19b7ec8f9
Make struct decls actually work.
...
find_type() does type comparisons based on tag name for struct/union/enum
but when it returns the previous tag (eg, from "struct foo;") the returned
type has a null symtab pointer, so setting the symtab pointer in the type
before calling find_type() only throws away the symtab. Thus, since
find_type() doesn't check the symtab pointer when comparing the types, set
the symtab pointer after calling find_type().
2011-02-13 20:56:12 +09:00
Bill Currie
acced90101
Create the symbol for the struct as early as possible.
2011-02-13 20:55:33 +09:00
Bill Currie
b545f72f93
Report errors for incomplete types and missing fields.
2011-02-13 20:23:08 +09:00
Bill Currie
c336aaeb80
Handle incomplete types gracefully.
2011-02-13 19:26:20 +09:00
Bill Currie
ed3f98eab4
qwaq related compile fixes for the new function syntax rules.
2011-02-13 19:07:30 +09:00
Bill Currie
ef32d1fb6d
Save away some of my tests.
2011-02-13 19:02:39 +09:00
Bill Currie
976ff8a6bb
Allow cast expressions to be lvalues.
...
These really need to be alias expressions rather than cast expressions
so the two can be separated as cast expressions should not be lvalues.
2011-02-13 17:54:15 +09:00
Bill Currie
fa742ceed6
Handle @self and @this correctly.
2011-02-13 17:52:19 +09:00
Bill Currie
547f361bd3
Allow (void) qc-style functions.
2011-02-13 17:37:11 +09:00
Bill Currie
d75c35ba30
Allow qc style function params.
...
Due to ambiguities in the grammar, qc-style function params and c-style
function params had to be completely separated. This means that qc-style
functions can not use pointers and must use qc-style function declarations
for parameters, and c-style functions must use c-style param declarations.
While this rule is tedious for converting the Ruamoko library, it does
actually make for a more consistent language.
2011-02-13 17:07:14 +09:00
Bill Currie
8a314e9e87
Class pointers need to be directly addressable.
2011-02-13 16:05:50 +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
3f690eacb1
Fix another double insertion of a symbol.
2011-02-13 15:28:49 +09:00
Bill Currie
127a1c8772
Fix the creation of enum values.
2011-02-13 15:19:55 +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
fa6b8d773c
Correctly emit class and category symtab references.
2011-02-13 13:21:00 +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
1bcf434b20
Move _OBJ_MODULE to the far data space.
2011-02-12 23:00:04 +09:00
Bill Currie
d42a379924
Dump the contents of a pointer def.
2011-02-12 22:59:29 +09:00
Bill Currie
eede83dea1
Avoid crashing when a null class pointer is found.
2011-02-12 22:58:50 +09:00
Bill Currie
3505de6868
Point the near and far data spaced into the merged data space.
...
This lets the relocations work on the final data without having to adjust
their locations.
2011-02-12 22:35:44 +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
cfdc2e5d6b
Complete the documentation for relocations.
...
This covers only in-memory storage of relocation records, not object file
relocations.
2011-02-12 15:55:58 +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
75d90d2f00
Propogate the specifiers through external_decl_list.
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
5f3c1872b9
Put class and category reference/name symbols in the symbol table.
...
This fixes the undefined defs in qwaq.
2011-02-11 22:29:57 +09:00
Bill Currie
179c1f7058
Support move statements (structure copy).
2011-02-11 22:29:57 +09:00
Bill Currie
e19f7e3521
Sort out the parameters for QC style functions :)
2011-02-11 22:29:57 +09:00
Bill Currie
370f0b97ed
Produce cleaner output for a = b op c.
2011-02-11 22:29:57 +09:00
Bill Currie
d93d8d7d46
Remove the dirty hack used for accessing params and the return value.
...
Instead of using the equivalent of *(float*)&.return, now use the
equivalent of (float).return. No conversion is done in the "cast".
NOTE: this sort of cast should be separated from normal casts.
2011-02-11 22:29:38 +09:00
Bill Currie
f5412c2b20
Remove a fixme.
2011-02-11 22:29:38 +09:00
Bill Currie
c185fbb782
Set the type of the super structure to the correct type.
2011-02-11 22:29:38 +09:00
Bill Currie
7d2a95ee40
Mark a few problem spots.
2011-02-11 22:29:37 +09:00
Bill Currie
a1d4d4bae1
Handle block expressions in is_indirect().
2011-02-11 22:29:30 +09:00
Bill Currie
b01f960db9
Disable the subgraphs for now.
...
They tend to make large trees difficult to read. I might re-enable them
when I've gotten a better handle on dot.
2011-02-10 15:11:08 +09:00
Bill Currie
2617f9e3ed
Update for the new syntax.
...
With this, qwaq will compile once I sort out the parameters for QC style
functions, and some non-executable warnings. However, as those are
compiler problems, this should be the final qwaq related commit.
2011-02-10 14:58:59 +09:00
Bill Currie
c3a991e555
Support nil in initializers.
2011-02-10 14:51:52 +09:00
Bill Currie
5a7650e54a
Fix a missing return.
...
Yay, I've wanted this feature in qfcc for many years :).
2011-02-10 14:47:24 +09:00
Bill Currie
adeef4a4eb
Copy named expressions.
...
Since expressions can be modified, making DAGs this early causes
corruption of the expression tree.
2011-02-10 14:43:49 +09:00
Bill Currie
6f625e426f
Use the correct type when deferencing an offset pointer.
2011-02-10 14:26:12 +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
4a41d97afc
Angle brackets and html :P
2011-02-10 14:24:31 +09:00
Bill Currie
01a7af17e5
Beat __obj_exec_class into submission.
2011-02-10 00:15:19 +09:00
Bill Currie
006c16807d
Add the statement for based loads.
...
Oops :P
2011-02-09 22:40:16 +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
c7adde8709
Fix some case&paste errors.
2011-02-09 22:04:54 +09:00
Bill Currie
1b8edc07c9
Adjust the offsets of ivars in derived classes.
...
As ivar structs are not independent, their starting offset is not
necessarily zero (almost never will be for derived classes).
2011-02-09 22:02:52 +09:00
Bill Currie
d66a441867
Write out the far data space as well as the near.
...
This causes the Objective-QC structs to be emitted now that they havve been
moved to the far data space. Relocs are broken, though.
2011-02-09 21:45:29 +09:00
Bill Currie
244d969ae3
Ensure any tail bytes in the strings data are zeroed.
2011-02-09 18:32:37 +09:00
Bill Currie
2d5d8eda5a
Save the caller's address when creating new relocations.
2011-02-09 17:16:49 +09:00
Bill Currie
29c1f7ac03
Use the correct type object in emit_struct().
2011-02-09 17:15:29 +09:00
Bill Currie
59a683d39e
Protect the name passed into emit_struct().
...
The name passed into emit_struct is sometimes created via va(), but the
struct creation code also uses va. This makes a mess of names.
2011-02-09 17:12:47 +09:00
Bill Currie
3e1b034aaf
Use EMIT_DEF correctly.
2011-02-09 15:58:32 +09:00
Bill Currie
e75295b00c
Make normal C style functions generate code.
2011-02-09 10:25:23 +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
5eff00fdeb
Fix debug information.
2011-02-09 08:47:01 +09:00
Bill Currie
71c05bd899
Update for the new syntax.
...
This one compiles to progs even :) (though it looks broken).
2011-02-08 22:39:42 +09:00
Bill Currie
81125cff3a
Creation of .ctor now mostly works.
...
There seems to be problems with the actual code generation using incorrect
addresses, but a very simple test file compiles successfully.
2011-02-08 22:38:34 +09:00
Bill Currie
1647b1e61d
Check for the correct type in emit_symtab_cat_def_cnt().
2011-02-08 22:31:09 +09:00
Bill Currie
9b52c590f8
Do not try to emit anything when there are no selector references.
2011-02-08 22:28:32 +09:00
Bill Currie
da14c95bb8
Initialize current_symtab in class_init() when necessary.
...
If an objective-qc symbol is the first token to be read, class_init() is
called before the parser gets a chance to perform the initialization
action. However, class_init() setting current_symtab if the first
objective-qc symbol is seen in a function body would be bad.
2011-02-08 22:26:35 +09:00
Bill Currie
c01f742b7b
Fix some Class vs ClassPtr confusion.
2011-02-08 18:25:23 +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
faab931ffc
Fix assignment of id to class pointers.
2011-02-08 17:12:01 +09:00
Bill Currie
6643c5dd98
Fix messages to super.
2011-02-08 17:09:27 +09:00
Bill Currie
505e141633
Ensure the class symbol is in the symbol table.
2011-02-08 17:08:58 +09:00
Bill Currie
93a5808659
Support direct struct/union field access.
2011-02-08 14:48:26 +09:00
Bill Currie
3c849b970b
Handle union access now that they're detected properly.
2011-02-08 14:45:48 +09:00
Bill Currie
204a267b6a
Print the def name for a pointer expr when known.
2011-02-08 14:43:57 +09:00
Bill Currie
3b080fcbb0
Fix an uninitialized variable.
2011-02-08 13:27:37 +09:00
Bill Currie
2594be8b1b
Fix a type-o ;)
2011-02-08 13:26:49 +09:00
Bill Currie
8c6fc6fb03
Fix a double insertion of a symbol.
2011-02-08 08:44:08 +09:00
Bill Currie
daa88d8f1c
Fix a type clash warning I'd failed to notice.
2011-02-08 08:23:25 +09:00
Bill Currie
35d53d0d77
Fix typedefs and class names once and for all.
...
I suspect Holub did them that way as a teaching exercise :P
2011-02-08 08:20:32 +09:00
Bill Currie
7e2173f268
Remove some old code.
2011-02-08 08:16:36 +09:00
Bill Currie
d6b10c99aa
Most, if not all, of the fixes needed to get qwaq building.
...
This is pretty much just changing [] to * and moving [N] to the other side
of the variable name.
2011-02-07 22:16:16 +09:00
Bill Currie
92799650c0
Implement struct field access via a pointer.
2011-02-07 22:15:10 +09:00
Bill Currie
7a1a9e3f2d
Better handling of the current storage for function scopes.
2011-02-07 22:11:22 +09:00
Bill Currie
ff70177041
Fix type handling for local variables.
2011-02-07 21:38:58 +09:00
Bill Currie
952a02eb23
Make print_type() output a newline.
2011-02-07 21:31:37 +09:00
Bill Currie
a28ac636a7
Make local declarations support C syntax.
2011-02-07 21:29:04 +09:00
Bill Currie
da4ec3d47c
Allow typedefs and classes in structs.
2011-02-07 20:55:13 +09:00
Bill Currie
aefd2a27d5
Make type handling in the grammar more consistent.
2011-02-07 20:54:49 +09:00
Bill Currie
3c64ae7b66
Fix overzealous type merging.
...
Use the type name instead of the symbol table for comparing
struct/union/enum types.
2011-02-07 20:48:01 +09:00
Bill Currie
265a244ba2
Set the symbol type for structs etc as soon as the tag is created.
...
Tags (struct/union/enum) are always types.
2011-02-07 15:30:49 +09:00
Bill Currie
65a07ada1c
Implement offset dereferences.
2011-02-07 14:56:29 +09:00
Bill Currie
d2b464053c
Fix assignment sub-expressions.
2011-02-07 14:43:07 +09:00
Bill Currie
6fa5bbe473
Support constant folding on enums.
2011-02-07 11:31:23 +09:00
Bill Currie
d549e5c6b5
Allow enums to be tested.
2011-02-07 11:30:56 +09:00
Bill Currie
ef2ad46f7a
Convert complex types to a suitable low-level type.
...
This takes care of moving structures etc around.
2011-02-07 10:55:09 +09:00
Bill Currie
b629c12b31
Do not change the type of the return operand.
...
Doing so made a mess of returning expressions. It was probably a holdover
from before getting instructions with void operand types working.
2011-02-07 10:21:54 +09:00
Bill Currie
829fb33e92
Fix converting nil to a pointer type.
2011-02-07 10:10:48 +09:00
Bill Currie
b8127f7543
Do not segfault when printing a pointer value with a bogus type
2011-02-07 09:57:26 +09:00
Bill Currie
28ba4b5712
Correct a comment.
2011-02-07 09:56:33 +09:00
Bill Currie
d564e6f017
Clean out the old debug prints from emit_function()
2011-02-07 08:46:12 +09:00
Bill Currie
76034861c9
Implement direct ivar access in methods.
...
A warning needs to be generated for access to ivars in a class method, but
it seems to work (unable to check due to other errors).
2011-02-07 08:32:52 +09:00
Bill Currie
3025e04ac5
Partially resurrect field_expr()
...
For now, only entity.field and ivar access via a pointer have been
implemented. The rest will come later as needed.
2011-02-07 08:30:28 +09:00
Bill Currie
1d108a8cec
Support emitting symbolic constants.
2011-02-06 20:08:54 +09:00
Bill Currie
e4ac92b5f2
Auto-cast between enums and the default type.
2011-02-06 20:08:16 +09:00
Bill Currie
6b7a81f5a7
Run find_type() early on enums and structs.
2011-02-06 20:07:19 +09:00
Bill Currie
d54a96e68a
Make enum values visible.
...
Put them in the current symbol table as well as the enum symbol table. The
latter is really just for keeping track of what values are in the enum.
2011-02-06 20:06:09 +09:00
Bill Currie
2860a8b28b
enum too is a scalar.
2011-02-06 20:01:55 +09:00
Bill Currie
f2c272f0b8
Make adding a symbol to multiple tables an internal error.
2011-02-06 20:00:14 +09:00
Bill Currie
d7cdf8077b
Rename id_ivars to object_ivars.
2011-02-06 15:41:15 +09:00
Bill Currie
c3c693e9c7
Correct construction of type_id.
2011-02-06 15:36:21 +09:00
Bill Currie
e27f3fd7c3
Copy the method's params into the method symbol.
2011-02-06 15:14:42 +09:00
Bill Currie
00bba1eb3a
Fix creation of uninitialized global variables.
2011-02-06 14:37:25 +09:00
Bill Currie
59d3dc6ae0
Check early for assignment of a class pointer to id.
2011-02-06 14:35:17 +09:00
Bill Currie
2f7b892452
Fix passing messages to classes.
...
Rename class_pointer_def() to class_pointer_symbol() and use it when a
class name is used as the receiver of a message.
2011-02-06 14:34:40 +09:00
Bill Currie
67957a14df
Bring back convert_name(), but siimplified.
...
It is now mainly for converting __FILE__ etc, handling expression symbols,
and checking for undefined identifiers.
2011-02-06 14:29:14 +09:00
Bill Currie
d03fdc5e67
Correctly calculate the size of the ivars of a class.
...
Need to include the size of the super class ivars.
2011-02-05 00:04:35 +09:00
Bill Currie
690ae1cb57
Fix send_message().
2011-02-04 23:49:25 +09:00
Bill Currie
29fbc3b073
Struct and ivar declarations now seem to work.
...
However, not bit-fields.
2011-02-04 23:48:58 +09:00
Bill Currie
1f6abb2cce
Minor cleanups to message_expr().
...
Fix for class names no longer being pointers to the class.
2011-02-04 23:22:51 +09:00
Bill Currie
eff3957487
Resurrect the address expression code for arrays etc.
...
This fixes selector finding.
2011-02-04 23:20:37 +09:00
Bill Currie
c542e1a453
Possibly fix normal methods.
2011-02-04 22:31:23 +09:00
Bill Currie
d9446c5eb0
Fix builtin methods.
2011-02-04 22:31:22 +09:00
Bill Currie
d0ecbb38b8
Copy the spec bits and storage class for QC functions.
2011-02-04 15:25:21 +09:00
Bill Currie
f721144ca5
Rewrite emit_ivars to use emit_structure.
...
The old code was broken anyway :) (it was segfaulting).
2011-02-04 15:11:47 +09:00
Bill Currie
acb3c0da11
Fix class initialization.
2011-02-04 14:29:47 +09:00
Bill Currie
04b86fcdb7
Move the Objective-QC structs from type.c to class.c
2011-02-04 12:07:32 +09:00
Bill Currie
7b22bfba63
Better Objective-QC keyword detection.
...
Use a flag in the keyword struct rather than checking for "@" in the
keyword. This catches such keywords as "id" and "Protocol" as well.
2011-02-04 08:38:58 +09:00
Bill Currie
993bee4f59
Do not count unimplemented methods.
...
The method emitter skips unimplemented methods, so counting them when
figuring out how many methods to emit leads to a segfault.
2011-02-04 08:26:16 +09:00
Bill Currie
e04ed72afa
Increment the index when emitting array elements.
...
Oops :)
2011-02-04 08:25:27 +09:00
Bill Currie
d7853682af
Fix conversion of nil to a real type.
2011-02-03 21:37:15 +09:00
Bill Currie
f44a26e268
Fix type chaining when dealing with decls.
2011-02-03 21:32:58 +09:00
Bill Currie
54c8a10fe4
Don't trip over incomplete structs (again:P)
2011-02-03 21:31:14 +09:00
Bill Currie
12d8658ece
Create a typedef for obj_module_t.
2011-02-03 18:05:46 +09:00
Bill Currie
b07392b818
Allow ivars to use C syntax declarations.
2011-02-03 18:04:41 +09:00
Bill Currie
dc6296e9b1
Allow ivars to use typedefs and other classes.
2011-02-03 18:03:37 +09:00
Bill Currie
2203903bb2
Temporarily splice the class's ivar chain into the symbol table.
...
The root class's ivar symbol table needs to be connected to the global
symbol table while building the current class's ivar symbol table. This
allows access to other classes and typedefs.
2011-02-03 18:02:49 +09:00
Bill Currie
79df3d2cca
Put newly created classes into the symbol table.
2011-02-03 17:28:49 +09:00
Bill Currie
564b7b9968
Use abstract_decl instead of type wherever a generic type is needed.
2011-02-03 10:53:59 +09:00
Bill Currie
a208aed6ef
Fix a segfault when encoding incomplete structs.
2011-02-03 10:52:42 +09:00
Bill Currie
22ccd41164
Give struct types a name.
...
Use the struct/union's name (minus "tag ") for the type name.
2011-02-03 10:52:12 +09:00
Bill Currie
d12cdca758
Functions and enums now seem to be working properly.
...
find_type now operates recursively (depth-first) so built up typechains
work as expected.
@overload is treated as a specifier (directly as a storage class, similaar
to typedef).
2011-02-03 10:48:12 +09:00
Bill Currie
52799a4e1c
Must merge specifiers :P
2011-02-02 22:59:08 +09:00
Bill Currie
4420a7125e
Ensure structs get added to the symbol table.
2011-02-02 22:53:53 +09:00
Bill Currie
a4eaa2a89b
Allow typedefed types and classes in parameters.
2011-02-02 21:58:53 +09:00
Bill Currie
aeecdc84dc
Get typedef working.
2011-02-02 21:58:11 +09:00
Bill Currie
cca829aa6b
Remove a stray semicolon from the grammar.
2011-02-02 21:57:41 +09:00
Bill Currie
400abe7fce
Allow freeing of typechains.
2011-02-02 15:15:24 +09:00
Bill Currie
1fe031e8cb
Build C style var/func/abs decl types from the outside in.
...
QuakeC style are built from the inside out.
2011-02-02 15:15:04 +09:00
Bill Currie
7fb8c8247e
Don't do a find_type on the parsed function.
...
This is needed for C style declarations, but breaks QuakeC style. The fix
is to do the find_type once the return type has been filled in.
2011-02-02 15:08:59 +09:00
Bill Currie
1452da676d
Allow types to be built from the outside in.
...
This is required for C style decl processing.
2011-02-02 15:07:44 +09:00
Bill Currie
ac91e9376b
The big type-system rewrite. Horribly broken :)
...
While broken, it is good enough to compile modulo.r.
This gives qfcc C's type system with QC specifics bolted on top (rather
than trying to cram C's type system into QC's). Pointers and arrays now
use C syntax and semantics (though I think there's a lot of breakage in
there at the moment). Functions themselves are still dual mode: both QC
style and C style are available.
2011-02-01 21:23:03 +09:00
Bill Currie
d11d128c96
Avoid segfaulting on errors.
2011-02-01 21:18:39 +09:00
Bill Currie
80ce179bc2
Scan the param list for problems with void.
2011-02-01 21:18:08 +09:00
Bill Currie
c53001800a
Create a struct for representing specifiers.
...
The specifiers are yet to come (next few commits), but this will be
necessary when they do.
2011-02-01 21:15:51 +09:00
Bill Currie
917c5f08b0
Make a var representing the default type.
...
The default type for vars is integer for ruamoko and float for v6 qc.
2011-02-01 21:12:02 +09:00
Bill Currie
54c14eb899
Add "return" to pascal.
...
I'm still not sure I'll keep it, but it's useful for testing.
2011-01-30 22:16:59 +09:00
Bill Currie
e7424e1496
Don't segfault on bare return statements.
...
I will probably need to do something about the required operand for v6
progs, but this will do for now.
2011-01-30 21:43:56 +09:00
Bill Currie
440a13b649
Untwist params' knickers for pascal, too.
2011-01-30 21:42:10 +09:00
Bill Currie
861ab93274
Don't type-check against the wrong type :P
2011-01-29 09:56:08 +09:00
Bill Currie
afc6605739
Don't set the space for external defs.
2011-01-29 09:55:14 +09:00
Bill Currie
d80a3413e5
Fix a segfault when freeing locations.
...
When chasing linked lists with a double pointer, must check the first
dereference and not the pointer itself.
2011-01-29 09:54:47 +09:00
Bill Currie
e1226bd3f1
Quaternions aren't vectors :P
2011-01-28 21:57:04 +09:00
Bill Currie
2cce903cc9
Set the default storage class for local vars.
2011-01-28 21:56:17 +09:00
Bill Currie
bc7d42d176
Immediate constants now work, though still not shared.
2011-01-28 21:39:01 +09:00
Bill Currie
3c95667b79
Print data contents for most simple types.
2011-01-28 21:21:29 +09:00
Bill Currie
4476074021
Print more addresses as hex.
2011-01-28 18:03:26 +09:00
Bill Currie
4837e0bd18
Fix most of the FIXMEs in qfcc.c.
...
Functions and defs seem to be relocated correctly. Constants are very
broken, however.
2011-01-28 15:17:30 +09:00
Bill Currie
834417b8c8
Add "debug" diagnotic printing, and use it.
...
Debug diagnostics are silent for verbosity levels less than 1.
2011-01-28 13:28:45 +09:00
Bill Currie
a37bdd9fb5
Free removed sblocks.
2011-01-28 13:23:20 +09:00
Bill Currie
80424f6ad5
Ensure functions are always properly terminated.
...
Control that reaches the end of a function must see a return statement.
2011-01-28 13:14:30 +09:00
Bill Currie
9159daf99d
Do simple unreachable block analysis and dead block removal.
2011-01-28 11:45:04 +09:00
Bill Currie
90a2738459
Add the label to the block to which it refers.
2011-01-28 11:41:53 +09:00
Bill Currie
c158b14286
Remove the labels list from the pr struct.
...
I'm not sure they were ever needed.
2011-01-28 11:40:25 +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
bd78b8a7ee
Enable more end-of-compilation code.
2011-01-27 15:44:12 +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
c7bbd40df6
Give special treatment to opcodes that have void operand types.
2011-01-27 15:44:11 +09:00
Bill Currie
71b5decbe8
Get assignments to .return working.
...
I really do not like the mechanism I currently use for handling pointer
derefences vs pointer assignments, but this will have to do for now until
I can get qfcc producing code again.
2011-01-27 15:44:11 +09:00
Bill Currie
56106892c8
The & operator produces a pointer, not void.
2011-01-27 15:44:10 +09:00
Bill Currie
1c3cc571f1
Pascal variables need defs too.
2011-01-27 15:44:10 +09:00
Bill Currie
f532fbc6df
Convert all integer operands to float for v6 progs.
...
Converting only opc is no longer enough.
2011-01-27 15:43:59 +09:00
Bill Currie
1ed1efbdfb
Implement the ROTL macro correctly.
...
Bit rotation requires unsigned ints.
2011-01-27 15:43:50 +09:00
Bill Currie
a6e65488ec
Remove the "test" parameter from test_expr.
...
The parameter became redundant at some stage.
2011-01-27 08:31:51 +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
5231e8e9f8
Handle .zero, .return and .param* properly.
2011-01-26 08:01:24 +09:00
Bill Currie
4966120e3b
Untwist param's knickers.
2011-01-25 20:21:41 +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