Bill Currie
c43a8331cf
Expose dump_dot_sblock.
2012-11-15 13:44:09 +09:00
Bill Currie
2b2ea5c9b3
Compute dags as part of data flow analysis.
...
I want to use the live variable information when building the dags.
2012-11-15 13:44:08 +09:00
Bill Currie
c358a0e77e
Create a function to generalize dot dumping.
...
Now, any time a graph is wanted, the file can be consistently named without
a lot of messy code.
2012-11-15 13:44:08 +09:00
Bill Currie
9f409b1ac4
Rename make_dag to dag_create.
2012-11-15 13:44:08 +09:00
Bill Currie
cd224c00d4
Add live variable info to flow graph dumps.
...
Things are a little bogus, but at least the bogosity is visible :)
2012-11-15 13:44:08 +09:00
Bill Currie
4b64912793
Begin doing some data flow analysis.
...
In te beginning, live variables.
2012-11-15 13:44:08 +09:00
Bill Currie
c00e666668
Expose find_operands.
...
It has proven to be a generally useful function, not just for dags.
2012-11-15 13:44:08 +09:00
Bill Currie
0a2ce6d381
Fix some doxygen comments.
2012-11-15 13:44:08 +09:00
Bill Currie
0b49bd343c
Collect information on statements that set or use vars.
...
First, it turns out using daglabels wasn't such a workable plan (due to
labels being flushed every sblock). Instead, flowvars are used. Each actual
variable (whether normal or temp) has a pointer to the flowvar attached to
that variable.
For each variable, the statements that use or define the variable are
recorded in the appropriate set attached to each (flow)variable.
2012-11-15 13:44:08 +09:00
Bill Currie
acedc65de1
Make an array of statements for the function.
...
With this, sets can be used to represent statements.
2012-11-15 13:44:07 +09:00
Bill Currie
98245f6d00
Bury a dead field.
2012-11-15 13:44:07 +09:00
Bill Currie
8844ac61a2
Rename dump_flow to dump_sblock and move to dot_sblock.c
2012-11-15 13:44:07 +09:00
Bill Currie
acde6ca0a0
Handle jumpb statements in dot_sblock and flow graphs.
2012-11-15 13:44:07 +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
d7177a78e9
Rewrite the flow graph code.
...
The flow graph nodes are now properly separated from the graph, and edge
information is stored in the graph struct. This actually made for much
cleaner code (partly thanks to the use of sets and set iterators).
Flow graph reduction has been (temporarily) ripped out as the entire
approach was wrong. There was also a bug in that I didn't really understand
the dragon book about selecting nodes and thus messed things up. The
depth-first search tree "fixed" the problem, but was really the wrong
solution (sledge hammer :P).
Also, now that I understand that dot's directed graphs must be acyclic, I
now have much better control over the graphs (back edges need to be
flipped).
2012-11-15 13:44:07 +09:00
Bill Currie
b9599a7119
Better set memory management.
...
At the cost of one pointer per set, sets can now be allocated and freed
more efficiently (especially since malloc might round things up).
2012-11-15 13:44:07 +09:00
Bill Currie
2385cf65c2
Rename setstate_t to set_iter_t.
...
After all, it is an iterator :).
2012-11-15 13:44:07 +09:00
Bill Currie
8c5a2b3d11
Implement depth-first searching for flow graphs.
...
This fixes the bogusly irreducible graphs.
2012-11-15 13:44:07 +09:00
Bill Currie
53622dbb99
Perform graph reduction on the function's flow graph.
...
The reduction is performed itteratively until the graph is irreducible, but
such that each reduction wraps the previous graph. Unfortunately, due
depth-first searching not being implemented, graphs that should be reduced
(ie, those with natural loops).
2012-11-15 13:44:07 +09:00
Bill Currie
388b6e6e8f
Add set_size ().
...
Return the number of members in the set.
2012-11-15 13:44:07 +09:00
Bill Currie
8567508963
Rewrite set_first() and add set_next().
...
set_first() now returns a pointer to a setstate_t struct that holds the
state necessary for scanning a set. set_next() will automatically delete
the state block when the end of the set is reached. set_delstate() is also
provided to allow early termination of the scan.
2012-11-15 13:44:07 +09:00
Bill Currie
2da038ce0f
Bring back dot_flow.c.
...
However, it produces simplified flow graphs (ie, just nodes and edges, no
statements, though later on data flow information will be added).
2012-11-15 13:44:07 +09:00
Bill Currie
8b374305d2
Rename dot_flow.c and print_flow.
...
They're now dot_sblock.c and print_sblock. The new names both better
reflect their purpose and free up "flow" for outputting the real flow
analysis graphs.
2012-11-15 13:44:07 +09:00
Bill Currie
c483770121
Rework flow.c with the aim of graph reduction.
...
Much of the data recently added to sblock_t has been moved to flownode_t.
No graph reduction is carried out yet, but the initial (innermost level)
graph has been built.
2012-11-15 13:44:07 +09:00
Bill Currie
da446fd343
Detect natural loops.
...
Non-nested loops that have the same head-node are merged into one loop.
However, loop nesting is not currently detected (next step).
2012-11-15 13:44:07 +09:00
Bill Currie
8fb958603c
Add set_first.
...
It returns the first element of a set. If the set is empty, -1 (unsigned)
is returned.
2012-11-15 13:44:07 +09:00
Bill Currie
1fead50f4e
Calculate the dominators of each node in the flow graph.
...
The dominators are represented by sets using the node numbers.
2012-11-15 13:44:07 +09:00
Bill Currie
964ea7f9fe
Add set_as_string for debug output.
2012-11-15 13:44:07 +09:00
Bill Currie
7853bf1859
Calculate a node's successors and predecessors.
...
The dot graphs are a little odd (arrow heads on the wrong end of the
predecessor edges), but things seem to be correct.
2012-11-15 13:44:06 +09:00
Bill Currie
739ebc522c
Begin working on flow analysis.
...
For now, variable and flow graph node maps are built.
2012-11-15 13:44:06 +09:00
Bill Currie
f30010b367
Add some docs to function.h
2012-11-15 13:44:06 +09:00
Bill Currie
cdc790d0c8
Add a set type and support code.
2012-11-15 13:44:06 +09:00
Bill Currie
dc9d2a982e
Make the returned dag a linked list of root-nodes.
...
A dag can have mulitple "root" nodes (ie, nodes with no parents).
2012-11-15 13:44:06 +09:00
Bill Currie
a22260030a
Use value for pointer operands.
...
This allows daglabels on pointer operands without a redundant daglabel
pointer.
2012-11-15 13:44:06 +09:00
Bill Currie
0c58cd9067
Generate only one daglabel for value operands.
...
As each value is now unique, their labels can also be unique, which will
improve CSE.
2012-11-15 13:44:06 +09:00
Bill Currie
0ccf4093e4
Handle attached identifier labels correctly.
...
I'd forgotten I had the prev field. Makes for much cleaner code.
2012-11-15 13:44:06 +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
dbf1aa8f72
Attach dags to statement blocks.
...
Now, if a dag is attached to a statement block, it will be included in the
flowgraph with that statement block.
2012-11-15 13:44:06 +09:00
Bill Currie
d9354255a3
Avoid double-printing dag nodes.
2012-11-15 13:44:05 +09:00
Bill Currie
7b2e426545
Support temp operands in dags.
2012-11-15 13:44:05 +09:00
Bill Currie
8015e1b1e9
Put the dags stuff into a qfcc sub-section.
...
Not much point writting docs if they can't be found.
2012-11-15 13:44:05 +09:00
Bill Currie
aa2943709e
Start work on building dags from basic blocks.
...
Doesn't compile and the design is in flux anyway, but I want to get back to
iqm.
2012-11-15 13:44:05 +09:00
Bill Currie
60108c688c
Change dags from binary to trinary.
...
I'd forgotten some instructions take three inputs that can benefit from
CSE.
2012-11-15 13:44:05 +09:00
Bill Currie
0fefeb73fe
Initial support for basic block dags.
...
Currently, only dumping to dot, but that seems to be a very sensible place
to start: debug support.
2012-11-15 13:44:05 +09:00
Bill Currie
d5c831b6da
Add a little test case for accessing types.
...
Using ruamoko to access ruamoko type encodings is actually quite pleasant
:)
2012-11-15 13:40:11 +09:00
Bill Currie
552142497e
Support progs.dat when dumping type encodings.
...
Knock up a quick and dirty progs-to-qfo "converter" (strings and types
only) to re-use the qfo types dumper.
2012-11-15 11:58:13 +09:00
Bill Currie
9691b50f0f
Make .type_encodings more useful.
...
Rather than just a pointer, it is now a struct with a pointer and size
indicating the extent of the type encodings block.
2012-11-15 11:57:16 +09:00
Bill Currie
453ac11bc3
Correct some comments.
2012-11-14 17:13:14 +09:00
Bill Currie
e05c12e16d
Make linker_add_def take a pointer for the value.
...
While it looks like I might not use it for the type encodings, it should be
useful in the future.
2012-11-14 13:12:58 +09:00
Bill Currie
5b7b49b100
Add a QFO_TYPE macro to get a qfot_type_t pointer.
...
In the end, it wasn't used, but it could be handy in the future.
2012-11-13 21:45:54 +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
c96718493a
A bit of a cleanup before fixing class type defs.
...
All internal structs now have "proper" names, and fit the naming convention
(eg, obj_module (like objective-c's types, but obj instead of objc). Some
redundant types got removed (holdovers from before proper struct tag
handling).
Also, it has proven to be unnecessary to build internal classes, so
make_class and make_class_struct are gone, too.
2012-11-12 11:12:33 +09:00
Bill Currie
d13ce81b4f
Ensure the type's encoding string is valid.
...
When encoding a type to a qfo file, the type's encoding string is written
and thus needs to be valid prior to actually doing the encoding. The
problem occurs mostly in self-referential structs (particularly, obj_class)
because the struct is being encoded prior to the pointer to the struct.
2012-11-11 20:22:48 +09:00
Bill Currie
86091856be
Revamp the static class creation.
...
Type names are cleaned up, as is the creation. Also, the class pointer in
the type encoding now gets emitted. However, Still need to actually create
_OBJ_CLASS_Class and fix the type encoding reloc handling in the linker.
2012-11-10 12:56:19 +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
afbab60c25
Create linker_find_def.
...
It turns out I didn't need it, but it could be useful in the future, so
I'll leave it in.
2012-11-09 11:57:06 +09:00
Bill Currie
eb86a66ce5
Do some class object type renaming.
...
type_object -> type_obj_object
type_Class -> type_obj_class
type_ClassPtr -> type_Class
In the process, one more FIXME is gone :)
2012-11-08 20:58:48 +09:00
Bill Currie
377f8f9d56
Use an explicit flag for class initialization.
...
Much cleaner than messing with class_Class, which is about to go away.
2012-11-08 17:14:33 +09:00
Bill Currie
7e293a38e8
Check for double-chaining of types.
...
Chaining a type twice will form a loop in the type list, causing find_type
to go into an infinite loop.
2012-11-08 17:14:33 +09:00
Bill Currie
a3a22f2a1b
Add the ability to dump qfo type encoding.
2012-11-08 17:06:38 +09:00
Bill Currie
ed4018fd8d
Clear out the function overloading tables between compiles.
...
Fixes some issues with multiple compiles (especially mixed languages!).
2012-11-01 20:53:33 +09:00
Bill Currie
f8bdd909cc
Separate out C and html quoting into separate functions.
...
Dot sometimes wants normal C quotes, othertimes html. Quite annoying,
really, but this is cleaner anyway.
2012-10-30 12:31:22 +09:00
Bill Currie
034139b806
Move some code around so it's more accessible.
2012-10-27 11:43:29 +09:00
Bill Currie
144387c3e3
Add shared.h to the dist files.
2012-10-26 16:16:46 +09:00
Bill Currie
f14d8060e0
Merge qfpc into qfcc.
...
Since gnu bison and flex are required anyway, no harm in using their api
prefix options. Now, qfcc can compile both QC/Ruamoko and Pascal files
(Pascal is (currently?) NOT supported in progs.src mode), selecting the
language based on the extension: .r, .qc and .c select QC/Ruamoko, .pas and
.p select Pascal, while anything else is treated as an object file (as
before).
2012-10-26 16:01:41 +09:00
Bill Currie
1364bff91b
Add an extended mode to qfcc.
...
Extended mode allows extra keywords (switch, for, etc) that are compatible
with v6 progs.
2012-07-14 17:16:33 +09:00
Bill Currie
23a38738fc
Massive whitespace cleanup.
...
Lots of trailing whitespace and otherwise blank lines.
2012-05-22 08:23:22 +09:00
Bill Currie
e866619de6
Output basic block flow diagrams to files.
...
The output can be controlled via --block-dot (not yet documented). The
files a named <sourcefile>.<function>.<stage>.dot. Currently, stage will be
one of "initial" (after expression to statement conversion), "thread"
(after jump threading), "dead" (after dead block removal), "final" (final
state before actual code emission).
2012-05-04 09:45:51 +09:00
Bill Currie
5f676c367f
Add a non-error diagnostic that can't be silenced.
...
It is inteded for flagging buggy conditions in the compiler, particularly
after having fixed the original bug (in case something comes back from the
dead).
2012-05-03 13:24:24 +09:00
Bill Currie
cb8fe4eb38
Correct a "spelling" error.
2012-05-03 11:54:36 +09:00
Bill Currie
e267e0a664
Allow control of progdefs.h CRC writing.
...
CRC writing defaults to off for non-v6 progs, but on for v6 progs. The
--progdefs option forces CRC writing.
2012-05-03 00:22:24 +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
c8163fc0de
Add an option to prevent the use of default paths.
...
Despair has things locked down such that running qfcc during a build fails
due to lack of read access to /usr/local/lib. This is actually a good
thing as accidentally hitting old includes/libs (when a file gets deleted
in the tree) hides bugs. Thus, --no-default-paths to turn off default
search paths.
2012-01-04 13:53:04 +09:00
Bill Currie
d910c14935
Clean up some doxygen warnings.
2011-07-10 19:12:07 +09:00
Bill Currie
55cc0f9206
Bring back the unsigned type (PROGS version bump)
...
This is only low-level support (the unsigned keyword still does not work),
but sufficient to make switch statements using jump tables work.
2011-04-09 10:07:47 +09:00
Bill Currie
c4a398850a
Fix defs as constants for vectors and quaternions.
2011-04-04 21:31:59 +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
9b62c8c126
Rename ty_type_e to ty_meta_e and type_t.ty to type_t.meta
2011-03-22 16:06:47 +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
8368f57fbf
Close a potential buffer overflow.
2011-03-09 11:09:46 +09:00
Bill Currie
39278ba8cc
Explicitly select between direct and indirect moves.
2011-03-09 10:30:57 +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
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
fe3d228658
Maintain a symbol table for entity fields.
2011-03-06 15:38:19 +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
8cfa80b5d4
Implement think expressions.
2011-03-05 18:01:37 +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
7fb22bd1e4
Make D_STRING() more useful and add D_GETSTR()
2011-03-04 21:28:12 +09:00
Bill Currie
d6d8b5b49d
Generate the debug symbol file.
2011-03-04 18:46:05 +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
c5ecc170b6
Give labels a usage count to detect unused labels.
2011-03-03 15:28:49 +09:00
Bill Currie
d937172243
Create and use alias operands for alias expressions.
...
This avoids the alias expression modifying the operand used in other
expressions.
2011-03-03 13:46:07 +09:00
Bill Currie
45de7327dc
Implement alias expressions (finally).
...
Alias expressions are like cast expressions, but never do any conversions.
2011-03-03 11:06:10 +09:00
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
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
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
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
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
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
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
36c99a8da1
Get function def creation working again.
2011-01-26 14:48:22 +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
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
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
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
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
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
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
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
4a24393d8d
Temp expressions now use operands instead of defs.
2011-01-21 11:26:43 +09:00
Bill Currie
16e013ff5d
Allow the operand to override the symbol's type.
2011-01-21 10:56:32 +09:00
Bill Currie
f8cc347dce
Print expressions as dot files.
...
While the resulting images can be a little confusing, they're much easier
to read than my cryptic postfix notation.
2011-01-20 15:23:19 +09:00
Bill Currie
5deda9c9b9
Clean out ex_def as ex_symbol replaces it.
2011-01-19 22:25:04 +09:00
Bill Currie
b5424bca7d
Start work on getting expressions converted to internal statements.
2011-01-19 15:47:45 +09:00
Bill Currie
cac2e04b18
Avoid namespace issues with dstatements.
2011-01-19 11:35:34 +09:00
Bill Currie
f2ef24d0cc
Make symbols use the new value struct for constants.
2011-01-19 11:09:54 +09:00
Bill Currie
e08efe036b
Move the constant expression values into their own struct.
2011-01-19 08:43:24 +09:00
Bill Currie
ff6e1b4d6c
Get functions attempting to generate code.
...
However, the statements are only printed as expressions.
2011-01-19 08:38:09 +09:00
Bill Currie
87ce9f5333
Get basic function creation working.
...
Even more FIXMEs, but the pascal parser can now create functions. The
function records even get emitted.
2011-01-18 12:47:13 +09:00
Bill Currie
8fb1b49a9d
Add support for function symbols.
2011-01-18 10:46:42 +09:00
Bill Currie
ea3895805b
Rewrite much to use symbols and symtabs. Gut emit.c. Massive breakage.
...
That which isn't rewritten is horribly broken. However, this does include a
nice mechanism for building QC structs for emitting data.
emit.c has been gutted in the spirit of "throw one away".
There is much work to be done to get even variables emitted, let alone
code. Things should be a little more fun from here on.
2011-01-17 22:34:41 +09:00
Bill Currie
85de101aa3
Break out the defspace code.
...
This also makes some improvements to the free block handling code.
2011-01-17 22:34:41 +09:00
Bill Currie
d3a98af783
Make internal_error globally available.
2011-01-17 22:34:41 +09:00
Bill Currie
537b930ba6
Add new_symbol_type to ease creation of typed symbols.
...
This is inteded for code generation functions that need to create
variables and structures.
2011-01-17 12:04:41 +09:00
Bill Currie
fb8b3d1211
Rework the lexer and parser to use symbols instead of defs.
...
Currently parses the test program just fine, but code generation is very
very broken.
2011-01-13 14:58:16 +09:00
Bill Currie
8f71986306
Add symbol expressions (like def expressions).
...
They will eventually replace def expressions. Currently quite broken.
2011-01-13 14:54:24 +09:00
Bill Currie
5b8725ca66
Rewrite the symbol (table) management in light of actual usage.
2011-01-13 14:48:38 +09:00
Bill Currie
ac14db7b1b
Create a function to ease param list building.
...
This is especially useful for QuakePascal, but it will mean I'll be able to
get rid of the parameter reversals in Ruamoko later on.
2011-01-13 14:45:53 +09:00
Bill Currie
258c896e4d
Create a function to build if/else blocks.
2011-01-13 14:33:16 +09:00
Bill Currie
3c9991364b
Add a "void return" instruction.
...
I got fed up with always having to explicty return something.
2011-01-13 00:29:56 +09:00
Bill Currie
21d7c78eb7
Allow deep copying of expression trees.
...
Certain expression types (eg labels) are created fresh.
2011-01-11 12:05:29 +09:00
Bill Currie
abe471110c
Make inc/dec_users return the the expression.
...
Just for convenience.
2011-01-11 08:44:43 +09:00
Bill Currie
18ae178eaf
Make new_vector_expr and new_quaternion_expr const-correct.
2011-01-11 08:43:34 +09:00
Bill Currie
75ec6bf244
Clean out some unnecessary types from the progs engine and clean up the mess.
...
This is a nasty commit, sorry, but 99% of the commit is interdependent.
2011-01-10 12:25:31 +09:00
Bill Currie
7971b0868e
Break out the begin_function code into its own function.
2011-01-10 12:25:31 +09:00
Bill Currie
c5d0acf0fa
Allow arrays to have ranges (not fully implmented)
2011-01-10 12:25:31 +09:00
Bill Currie
ae4ca52661
Make function.h more independent.
2011-01-10 12:25:31 +09:00
Bill Currie
66ac56063f
Break out the frame macro code from qc-lex.l
2011-01-10 12:25:31 +09:00
Bill Currie
a09f02db1a
Break out the debug and string functions from qc-lex.l.
2011-01-10 12:25:30 +09:00
Bill Currie
695f71eeb6
Get clost to the look I wanted for symtab_flat_copy's graph.
2011-01-10 12:25:30 +09:00
Bill Currie
782a4c9a8d
New symbol table code.
2011-01-10 12:25:30 +09:00
Bill Currie
02f78e46f8
More expression docs.
2011-01-03 16:25:59 +09:00
Bill Currie
5627e43465
Use the method's selector rather than its def name in error messages.
2011-01-03 16:25:29 +09:00
Bill Currie
a1f36a9944
Make new_function take a def rather than a name.
...
Moves into new_function some code that should have been there in the first
place.
2011-01-03 16:25:29 +09:00
Bill Currie
530e8fae34
Rework class_type_t to be more useful.
...
This allows current_class to refer to procols as well (for error
reporting).
2011-01-03 16:25:29 +09:00
Bill Currie
58042719e5
A little more documentation for expressions.
2011-01-03 16:19:28 +09:00
Bill Currie
6c631c6d5d
Start documenting qfcc.
2010-12-19 11:35:18 +09:00
Bill Currie
4481ba9b0d
Allow explicit references to classes and categories.
...
Use "@reference ClassName;" or "@reference ClassName(CategoryName);" to
create a refence to the class or category, forcing the defining object file
to be linked into the program when the object file is part of a library.
2010-12-12 20:27:56 +09:00
Bill Currie
67beaf4487
Nil is a constant, so allow it in global initializers.
2010-11-24 17:01:18 +09:00
Bill Currie
d045045693
get the grouping right
2010-08-11 23:42:14 +00:00
Bill Currie
f04bc64ef1
clean up a bunch of doxygen warnings
2010-08-11 23:41:30 +00:00
Bill Currie
0dfff8fd58
ignore stuff
2010-08-07 10:42:09 +00:00
Bill Currie
56d01ce267
found an uncontrollable warning
2010-02-20 12:01:49 +00:00
Bill Currie
997102fea8
audit the usage of "only"
...
There are still a few iffy places (notably around certain prepositions), but
the relevant sentences are now much easier to read.
2010-01-13 06:42:26 +00:00
Bill Currie
ae4fc3147d
allow '*pointer' expressions
2010-01-13 06:31:41 +00:00
Bill Currie
ccb8faf6ef
produce a warning for the likes of "x - x & y"
2010-01-13 06:26:18 +00:00
Bill Currie
40fefff847
fix incorrect users for temps resulting from casting the result of ?:
...
There are probably other situations, but I'll fix them as they show up.
2010-01-13 06:25:06 +00:00
Bill Currie
c3f47efb07
add --qccx-escapes to resolve the conflicts in escape sequences and document the escape sequences supported by qfcc.
2009-12-25 07:59:25 +00:00
Bill Currie
9ac15436d9
More docs.
...
Enhance qfprogs qfo debugging.
Make sure functions marked as extern don't emit anything. Fixes the segfault
when building klik.
2008-08-01 13:54:24 +00:00
Bill Currie
23e3fc0cb8
document most of obj_file.h (and a few other doc tweaks)
2008-08-01 00:47:38 +00:00
Bill Currie
a376e6f86d
make control of progdefs.h generation saner
2007-04-28 05:40:22 +00:00
Bill Currie
2e6ecd97c8
d'oh
2007-04-10 13:01:45 +00:00
Bill Currie
52d178b3be
Add a code generation option, "local-merging", to control qfcc's merging of local variable blocks into one block. Defaults to on for advanced mode and off for traditional.
2007-04-10 13:00:21 +00:00
Bill Currie
e53e9944b6
spew a lot of guff about relocs
2007-04-09 13:33:59 +00:00
Bill Currie
a9678f1c06
dump globals direct from qfo
2007-04-09 07:47:51 +00:00
Bill Currie
9509d0fd5e
make qfo files typesize safe
2007-04-07 12:35:03 +00:00
Bill Currie
f6924f35e5
report the line of the previous declaration of the function
2007-04-06 12:02:34 +00:00
Bill Currie
04765083aa
really warn only once for each uninitialized variable
2007-04-06 08:56:37 +00:00
Bill Currie
72af804b31
nested include reporting
2007-03-31 15:27:36 +00:00
Bill Currie
1925bef0c1
fix a bunch of bugs with single-cpp processing when not keeping temps
2006-08-20 06:20:30 +00:00
Bill Currie
130e6c1a3f
fix some intermediate file issues
2006-05-24 14:50:24 +00:00
Bill Currie
f7df6fea17
instead of having cpp args in progs.src, potentially breaking some mods, generate progs.i as a series of #includes and then compile everything in one pass
2006-05-24 14:35:39 +00:00
Bill Currie
8f097ce3dd
fix a couple of typoes
2006-05-24 12:58:31 +00:00
Bill Currie
66cabb587f
add the vector-calls "optimisation" from fteqcc. makes it possible to
...
compile the version of frogbot with waypoints for almost 300 maps.
2005-06-10 07:31:25 +00:00
Bill Currie
501180aaac
gcc-4.0 fixes. even found some bugs :) (names /not/ mangled this time)
2005-06-08 06:35:48 +00:00
Bill Currie
66257e3a88
run in fear, function overloading is here
...
This is an imperfect revision of history.
2004-11-13 11:50:00 +00:00
Bill Currie
4d044bfea4
make entity.vector.x work properly by making relative field offset work. also don't emit a field def for the resulting immediate
...
This is an imperfect revision of history.
2004-11-12 10:49:00 +00:00
Bill Currie
64cc8c60d2
compile time protocol support seems to be complete now. fortunatly, protocols had never been written out so the corrections to the protocol related stuctures do not need a progs version bump. runtime protocol support hasn't been fully tested yet.
...
+load runtime support seems to be working.
This is an imperfect revision of history.
2004-11-11 00:34:00 +00:00
Bill Currie
b35561504c
do proper selector registration. unfortunatly, I discovered I'd created pr_method_t incorrectly and so had to bump the progs version again
...
This is an imperfect revision of history.
2004-11-10 05:37:00 +00:00
Bill Currie
b46cff08aa
handle param name changes between prototype and declaration gracefully
...
This is an imperfect revision of history.
2004-11-02 23:54:00 +00:00
Bill Currie
fff41d664a
detect re-declaring identifiers as different types (typedef, enum, var, etc)
...
This is an imperfect revision of history.
2004-11-02 07:02:00 +00:00
Bill Currie
14900bb82e
fast-float code option (defaults to on). kills almost 3000 statements from
...
prozac
2004-04-27 20:24:37 +00:00
Bill Currie
7b28c555ba
quaternion field access now works
2004-04-09 04:12:44 +00:00
Bill Currie
0e47ee96f8
spelling fixes
2004-04-08 18:53:46 +00:00
Bill Currie
fc2413ff72
more quaternion work (should be working, haven't come up with tests yet)
2004-04-08 03:32:14 +00:00
Bill Currie
f1c9a8d24b
remove a mostly unused field
2004-02-21 05:58:01 +00:00
Bill Currie
14e8bfe94b
auto-init for uninitialized locals in traditional mode as requested by
...
Grievre
2004-02-21 05:52:05 +00:00
Bill Currie
0360859a0f
all warnings (except for @self and self) are now fully controllable
2004-02-17 00:39:21 +00:00