Commit Graph

638 Commits

Author SHA1 Message Date
Bill Currie ee1f5f9478 Add support for binary alias expressions
Doesn't quite work yet.
2019-06-10 23:48:58 +09:00
Bill Currie 913b9f52e0 Add an offset alias expression
This should make dealing with def elements (vector etc) easier.
2019-06-10 18:13:28 +09:00
Bill Currie efdfc7436f Move ev_types into types.[ch]
No wonder I couldn't find it the other day...
2019-06-10 18:04:25 +09:00
Bill Currie f093516962 Move qfo type encoding structs
This makes them available to the gamecode VM, and thus the debugger.
2019-06-09 18:07:58 +09:00
Bill Currie ec89149b29 Build for loop decl inits correctly
The multiple expressions are chained together and evaluate in left to
right order.
2019-06-09 13:54:03 +09:00
Bill Currie df0316bb13 Clean up some comment FIXMEs 2019-06-08 19:22:29 +09:00
Bill Currie 3327127e36 Fix a typo in a comment 2019-06-08 13:28:29 +09:00
Bill Currie 4ef4a7e955 Start work on simple names in symbol tables
I don't remember what the goal was (stopped working on it eight months
ago), but some possibilities include:
 - better handling of nil (have trouble with assigning into struts)
 - automatic forward declarations ala C# and jai (I was watching vids
   about jai at the time)
 - something for pascal
 - simply that the default symbol type should not be var (in which case,
   goal accomplished)
2019-06-06 07:01:44 +09:00
Bill Currie ff5c1cd4c2 Clean up redundant type parameter to initialize_def. 2018-10-15 22:11:20 +09:00
Bill Currie 6c53be928b Support returning vector expressions.
Currently fails due to a scheduling problem when the vector expression
contains functions.
2018-10-13 23:32:53 +09:00
Bill Currie aaab18c9a7 Nuke a dead field.
It looks like ex_temp_t.expr was never really used, and I have no idea
what I had intended (not surprising after ~17 years).
2018-10-13 12:07:50 +09:00
Bill Currie 2f2edae43b Make error, warning and notice give compiler file/line too.
But only when verbosity > 1 (-vv).
2018-10-13 09:31:00 +09:00
Bill Currie 78e0a8dc52 Support assigning non-constant vector expressions. 2018-10-12 22:05:17 +09:00
Bill Currie 668896aa82 More diagnostic improvements. 2018-10-12 16:01:11 +09:00
Bill Currie 71b3d30aa1 Make the ice a little more informative. 2018-10-12 14:51:39 +09:00
Bill Currie 3bd9f96b07 Make internal error messages a little more helpful.
They now include the file and line of the compiler as well.
2018-10-12 13:57:59 +09:00
Bill Currie 673b45be05 Add diagnostic hooks. 2018-10-09 12:46:13 +09:00
Bill Currie 34bcf7faab Do a pure/const/noreturn/format attribute pass.
I always wanted these, but as gcc now provides warnings for functions that
could do with such attributes, finding all the functions is much easier.
2018-10-09 12:42:21 +09:00
Bill Currie d1cb15664f Fix some spelling issues in a comment. 2018-09-09 22:34:24 +09:00
Bill Currie 59b04dbcca Make many qfo int fields unsigned.
I don't remember why I thought signed was a good idea, but unsigned does
make more sense for most fields.
2018-09-08 19:45:19 +09:00
Bill Currie cdbdf3f0eb Make print_operand global. 2018-08-23 20:05:16 +09:00
Bill Currie 8b8b42bde2 Fix a typo in a comment. 2018-08-23 20:04:51 +09:00
Bill Currie 1b84ea747c Dump statements during flow analysis. 2018-08-21 15:56:39 +09:00
Bill Currie db460155e9 Fix multiple function calls in expressions. 2013-09-27 23:15:57 +09:00
Bill Currie 3295370328 Expose and use field_expr().
This may cause problems later on, but it is needed for the binary_expr()
cleanup.
2013-09-27 23:15:57 +09:00
Bill Currie ca9693d9cd Expose convert_from_bool(). 2013-09-27 23:15:57 +09:00
Bill Currie 7f50333b2c Add support for constant [] vector expressions. 2013-09-27 23:15:57 +09:00
Bill Currie 7a7a685105 Add support for actual vector expressions.
Currently, they can represent either vectors or quaternions, and the
quaternions can be in either [s, v] form or [w, x, y, z] form.

Many things will not actual work yet as the vector expression needs to be
converted into the appropriate form for assigning the elements to the
components of the "vector" type.
2013-09-27 23:15:57 +09:00
Bill Currie a6cdc8735a Start implementing vec = [x,y,z].
This is a nice feature found in fteqcc (also a bit of a challenge from
Spike). Getting bison to accept the new expression required rewriting the
state expression grammar, so this is mostly for the state expression. A
test to ensure the state expression doesn't break is included.
2013-09-27 23:15:56 +09:00
Bill Currie cef2136050 Implement "not" logic for while and do-while.
This goes towards complementing the "if not" logic extension. I need to
check if fteqcc supports "not" with "while" (the version I have access to
at the moment does not), and also whether it would be good  to support
"not" with "for", and if so, what form the syntax should take.
2013-06-26 23:04:35 +09:00
Bill Currie 6fa63f6c54 Implement the basics of fteqcc's -Fifstring.
It's -Cifstring in qfcc, but otherwise the intent is the same. More testing
and investigation into what fteqcc does is required.
2013-06-26 23:02:55 +09:00
Bill Currie 8d34d33055 Implement "if not (foo)" syntax.
It is syntactic sugar for if (!(foo)), but is useful for avoiding
inconsistencies between such things as if (string) and if (!string), even
though qcc can't parse if not (string). It also makes for easier to read
code when the logic in the condition is complex.
2013-06-26 23:02:55 +09:00
Bill Currie fd1ea9e00e Add an option to control the enum switch warning. 2013-06-26 09:29:37 +09:00
Bill Currie 46d2959908 Delay calling find_type for enums.
As find_type encodes the type too, calling find_type before the enumerators
have been created causes the type encoding to lose the enumerators.
2013-01-17 20:55:25 +09:00
Bill Currie 76a69d9a53 Implement fteqcc's "nosave" specifier.
Of course, it's "@nosave" for traditional progs, but that's only a define
away.
2013-01-07 14:35:34 +09:00
Bill Currie 386a729209 Remove dead nodes from dags.
Dead nodes are those that generate unused values (unassigned leaf nodes,
expressions or destinationless move(p) nodes). The revoval is done by the
flow analysis code (via the dags code) so that any pre and post removal
flow analysis and manipulation may be done (eg, available expressions).
2012-12-25 17:07:58 +09:00
Bill Currie b295524385 Add new_value_expr().
This simplifies creating a new expression for an arbitrary value object.
2012-12-23 19:29:50 +09:00
Bill Currie 42ba0c9d54 Add alias_value() function.
alias_value returns a new value where only the type is different, the
bit-pattern of the value itself is untouched.
2012-12-23 19:25:35 +09:00
Bill Currie 6eb6b6c0ba Change pointer_t to unsigned and clean up the mess.
It doesn't make sense to have negative pointers. The size of the commit is
from enabling gcc's -Wtype-limits warning and cleaning up that mess too.
2012-12-21 21:53:13 +09:00
Bill Currie 6d6f231bd2 Fix mangling of types when attaching protocols.
The protocol attachment test was in the wrong place, and there were some
typos in compare_protocols and procollist_find_protocol.
2012-12-20 13:12:05 +09:00
Bill Currie 211a7a8bbb Create and use more type checking functions. 2012-12-20 11:11:59 +09:00
Bill Currie 8c2af5cff7 Add more convenience functions.
Cleans up obj_types_assignable a little.
2012-12-20 10:10:41 +09:00
Bill Currie 3af031c33d Move the rest of the obj specific stuff into class.c.
This gives better hiding of implementation details.
2012-12-20 10:10:41 +09:00
Bill Currie 7cb2e40bce Add is_pointer convenience function. 2012-12-20 10:10:41 +09:00
Bill Currie 64c98bd4c3 Rename is_id to obj_is_id.
Better naming convenion.
2012-12-20 10:10:41 +09:00
Bill Currie 4f81a659b4 Move is_id() from type to class.
type_id's implementation should remain "private" to class.c
2012-12-20 10:10:41 +09:00
Bill Currie f181772a76 Attach protocolrefs to class types.
The protocolrefs (as protocollist_t) are attached to the type as a
qualifier.
2012-12-20 10:10:41 +09:00
Bill Currie 3270bb3f5e Make node numbering int rather than unsigned.
(unsigned) -1 is not what I wanted :P
2012-12-19 16:50:06 +09:00
Bill Currie c7ae58d7a3 Allow flownodes and sblocks to be numbered independently.
The numbering will need to be independent when unreachable nodes are
removed.
2012-12-19 16:22:15 +09:00
Bill Currie 3e38c4aa48 Merge branch 'qfcc-cse'
qfcc now does local common subexpression elimination. It seems to work, but
is optional (default off): use -O to enable. Also, uninitialized variable
detection is finally back :)

The progs engine now has very basic valgrind-like functionality for
checking pointer accesses. Enable with pr_boundscheck 2
2012-12-13 20:17:28 +09:00