Commit graph

420 commits

Author SHA1 Message Date
Bill Currie
c12211d8bb Support enum results for boolean expressions.
eg enum BOOL x = a && b;
2011-03-02 22:46:55 +09:00
Bill Currie
4a99f8dcbd Write the linker output to progs.dat.
There is much breakage, but qfcc now produces a progs.dat from either
progs.src or object files. Better yet, the progs.src result is passed
through the linker, removing much duplicate code.
2011-03-02 20:51:00 +09:00
Bill Currie
29985efcef Expose some linker functions to the rest of the compiler.
They proved to be useful for cleaning up the final compilation stages.
2011-03-02 20:48:55 +09:00
Bill Currie
ecb995a8f7 Rewrite qfo_to_progs() to go direct from qfo to progs.dat.
Relocs and debug info is currently broken.
2011-03-02 19:06:43 +09:00
Bill Currie
824d8bfc3c Remove some now unnecessary functions. 2011-03-02 14:21:20 +09:00
Bill Currie
9f126ed805 Add some quick type access macros. 2011-03-01 15:18:12 +09:00
Bill Currie
b544196c21 Change ptrfld to fldptr for consistency with type.h. 2011-02-28 23:12:32 +09:00
Bill Currie
8b661bbb89 Rename qfo_reloc_t's def to target and correct its usage. 2011-02-27 11:37:24 +09:00
Bill Currie
4f6d18a328 Encode the basic type for functions, fields and pointers.
Very important for distinguishing them from other types.
2011-02-27 00:33:16 +09:00
Bill Currie
55043310fc Fix the QFO_POINTER macro 2011-02-27 00:31:52 +09:00
Bill Currie
65c7d421c6 Update the qfo access macros for the new format. 2011-02-25 09:38:22 +09:00
Bill Currie
a106c1fb51 Add a field for loose relocation records.
Loose relocation records are those that are not bound to a def or a
function.
2011-02-24 15:21:06 +09:00
Bill Currie
c10a551c84 Rename new_defspace() and defspace_new_loc(). 2011-02-24 13:07:36 +09:00
Bill Currie
74497f00e1 Read qfo object files :) 2011-02-23 18:10:38 +09:00
Bill Currie
33810e9c91 Write out object files in the new format. 2011-02-23 15:05:33 +09:00
Bill Currie
a1ea492889 Remove some redundant fields from qfo objects. 2011-02-23 10:40:35 +09:00
Bill Currie
e1158a83f0 Begin work on rewriting obj_file.c for the new format. 2011-02-22 15:42:49 +09:00
Bill Currie
ecbb904d6b More docs and clearer types. 2011-02-22 09:23:04 +09:00
Bill Currie
96c6b31c66 Update qfo version and correct some comments and types. 2011-02-21 18:24:34 +09:00
Bill Currie
4c11304c8d Documentation tweaks. 2011-02-21 08:41:03 +09:00
Bill Currie
bffc1dd239 Clean up objective-qc type encoding.
Structures etc now never encode the fields as well (I might revert that
at some time). Type parsing has been removed: it has proven unnecessary
and overly complicated, and the new qfo encoding should be more useful.
2011-02-18 20:51:04 +09:00
Bill Currie
7251bc91fa Enhanced type encoding.
This creates a compact representation of types as seen by qfcc. This is
intended mainly for debuggers.
2011-02-18 09:06:05 +09:00
Bill Currie
bceb98e5a4 Create structures for new qfo format.
This breaks a lot of existing code, so that code has been commented out
for now.
2011-02-17 15:02:09 +09:00
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
4336fc2c73 Move method function defs into the far data space.
As they are never referenced directly by instructions, there's no need for
them to be in the near data space, taking precious def locations.
2011-02-15 15:33:18 +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
d162838299 Resurrect constant_expr(). 2011-02-15 09:28:27 +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
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
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
e19f7e3521 Sort out the parameters for QC style functions :) 2011-02-11 22:29:57 +09:00
Bill Currie
01a7af17e5 Beat __obj_exec_class into submission. 2011-02-10 00:15:19 +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
2d5d8eda5a Save the caller's address when creating new relocations. 2011-02-09 17:16:49 +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
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
28ba4b5712 Correct a comment. 2011-02-07 09:56:33 +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
2860a8b28b enum too is a scalar. 2011-02-06 20:01:55 +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
d9446c5eb0 Fix builtin methods. 2011-02-04 22:31:22 +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
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
400abe7fce Allow freeing of typechains. 2011-02-02 15:15:24 +09:00