Commit graph

7273 commits

Author SHA1 Message Date
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
f72d6d6a27 Fix a typo in the opname for integer modulo. 2011-01-27 21:03:11 +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
Bill Currie
fd3b594ca5 Move label relocs to the relevant statement block. 2011-01-25 15:45:31 +09:00
Bill Currie
849d013f5e Allocate space for function parameters. 2011-01-25 15:43:57 +09:00
Bill Currie
f45919df09 Need alias defs after all. 2011-01-25 15:42:26 +09:00
Bill Currie
a648f043de Give functions their own defspace.
The defspace is propogated through the function's sub-scopes.
2011-01-25 12:34:45 +09:00
Bill Currie
27c5139612 Give defspaces some backing memory.
I'm not sure I want all defspaces to have backing memory, but this will do
for now.
2011-01-25 12:16:13 +09:00
Bill Currie
34ffce50fa Ensure current_symtab gets set at the start of parsing.
current_symtab must be set even if the first thing encountered is a syntax
error.
2011-01-25 12:16:13 +09:00
Bill Currie
69b889756d Fix a misplaced ! 2011-01-25 12:16:13 +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
30701980bc Get QC cfunctions and defs working. 2011-01-25 12:16:13 +09:00
Bill Currie
ade2e92ea4 Fix the immediate breakage in immediate handling. 2011-01-25 09:08:11 +09:00
Bill Currie
7e914b8c53 Fix copyright headers.
Add forgotten templates and fill in the information in places I had
forgotten. I hope I got the dates right (timezone issues).
2011-01-25 09:01:37 +09:00
Bill Currie
49b7c2d527 Document make_symbol 2011-01-25 09:01:37 +09:00
Bill Currie
0624408317 Move the diagnostic functions into their own file. 2011-01-24 21:54:57 +09:00
Bill Currie
d618e51dc8 Move save_string and make_string into strpool
Might not be the perfect place, but at least they're strongly related.
2011-01-24 21:32:48 +09:00
Bill Currie
483cbeba03 Fix a few FIXMEs. 2011-01-24 21:13:37 +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
Bill Currie
ce02fe8660 Fix the order of paramenters in the tree output.
Also get call nodes looking a little better.
2011-01-23 12:59:30 +09:00
Bill Currie
a79b6f0a6c Partially implement casts. 2011-01-23 11:53:08 +09:00
Bill Currie
bf626c9e00 Fix some simple fixmes 2011-01-23 11:13:56 +09:00
Bill Currie
20b14af024 Add "is_math" type check and use for unary +/-. 2011-01-23 11:12:58 +09:00
Bill Currie
341f370662 Rename is_math() to is_math_op(). 2011-01-23 11:12:05 +09:00
Bill Currie
dea6771d92 Create type_nil for passing nil into ... 2011-01-22 16:41:31 +09:00
Bill Currie
4ac80c2932 Get qfcc running again.
It segs when it tries to link, but that's because a real object file has
not been created yet. However, I can get my tree and flow diagrams :)
2011-01-22 15:52:57 +09:00
Bill Currie
55d3d17807 Add a missing break.
"return" falling through to "goto" was bad news :)
2011-01-22 15:52:01 +09:00
Bill Currie
d5f669af7a Nuke temp reference counting.
The whole reason for this crazy developement branch :)
2011-01-22 11:40:53 +09:00
Bill Currie
3b462e16cf Produce flow diagrams of the basic blocks. 2011-01-22 11:40:53 +09:00
Bill Currie
246778b5de Use function pointer tables instead of switch.
This seems to be better for complicated code. switch seems to be better
suited for relatively simple code.
2011-01-22 11:40:53 +09:00
Bill Currie
2f09efe547 Break out print_expr into its own file. 2011-01-21 20:31:40 +09:00
Bill Currie
bcb2667b73 Possibly get vector calls working. 2011-01-21 19:40:46 +09:00
Bill Currie
52b561f7cb Nuke bind expressions.
Since I'm planning on implementing CSE and other optimizations, they're
rather redundant (and I'm having trouble getting them to work).
2011-01-21 19:07:58 +09:00
Bill Currie
0d01930056 Link a bool to its block rather than the block's head.
This makes the flow make a little more sense.
2011-01-21 18:50:17 +09:00