Commit Graph

80 Commits

Author SHA1 Message Date
Bill Currie d6752c254c Move short-circuit boolean code to its own file 2020-02-24 01:20:24 +09:00
Bill Currie 7a399c956b Encode function parameter alignment
The encoding is 3:5 giving 3 bits for alignment (log2) and 5 bits for
size, with alignment in the 3 most significant bits. This keeps the
format backwards compatible as until doubles were added, all types were
aligned to 1 word which gets encoded as 0, and the size is unaffected.
2020-02-16 17:10:43 +09:00
Bill Currie 33c2eb430f Stop bison complaining about %expect
And make sure warnings get fixed.
2019-06-09 16:19:27 +09:00
Bill Currie 78e0a8dc52 Support assigning non-constant vector expressions. 2018-10-12 22:05:17 +09:00
Bill Currie 3656cb966c Fix some bison deprecation warnings. 2018-10-12 09:32:49 +09:00
Bill Currie f5501fbf24 Fix a pile of automake deprecation warnings.
s/INCLUDES/AM_CPPFLAGS/g

I <3 sed :)
2013-11-24 13:11:50 +09:00
Bill Currie 4bc40b3917 Rewrite binary_expr().
It is now in its own file and uses table lookups to check for valid type
and operator combinations, and also the resulting type of the expression.

This probably breaks multiple function calls in the one expression.
2013-09-27 23:15:57 +09:00
Bill Currie eb8fd55677 Move set.c into libQFutil.
Also move the ALLOC/FREE macros from qfcc.h to QF/alloc.h (needed to for
set.c).

Both modules are more generally useful than just for qfcc (eg, set
builtins for ruamoko).
2012-12-06 20:52:53 +09:00
Bill Currie eef399209d Add some very evil pragmas.
The evil comment is not just "pragmas are bad, ok?", but switching between
advanced, extended and tradtitional modes when compiling truly is evil and
not guaranteed to work. However, I needed it to make building test cases
easier (it's mostly ok to go from advanced to extended or tradtional, but
going the other way will probably cause all sorts of fun).

In the process, opcode_init now copies the opcode table data rather than
modifying it.
2012-11-22 21:59:01 +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 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 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 cdc790d0c8 Add a set type and support code. 2012-11-15 13:44:06 +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 1d060d1ac1 Quote string values when dumping globals.
Much nicer :)
2012-11-08 21:13:24 +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 eefa89e72e Remove the AM_CONDITIONALs from tools.
Now that the tools directories aren't entered when those tools aren't being
built, there's no reason to use AM_CONDITIONAL in there.
2012-02-10 02:50:42 +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 5efeb7ebf8 Rename some files that have been bugging me. 2011-02-24 12:59:18 +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 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 0624408317 Move the diagnostic functions into their own file. 2011-01-24 21:54:57 +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 3b462e16cf Produce flow diagrams of the basic blocks. 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 b5424bca7d Start work on getting expressions converted to internal statements. 2011-01-19 15:47:45 +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 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 fed82466cc The first stages of Quake-Pascal.
At present, this parses a subset of the pascal language with a few type
extensions. There is already work on the type system.
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 782a4c9a8d New symbol table code. 2011-01-10 12:25:30 +09:00
Bill Currie a2e05dbe83 make bison output a state file
This is an imperfect revision of history.
2004-11-02 05:19:00 +00:00
Bill Currie 389ff5be1c finally found the correct way to handle generated source 2004-02-03 05:30:11 +00:00
Bill Currie 9df4a7948e make dist fixes 2004-02-03 03:22:48 +00:00
Bill Currie 206a15ef14 while not yet perfect, qfprogs now works with qfo files 2004-01-29 07:43:05 +00:00
Bill Currie b2ccb50b81 move qfpreqcc in with qfcc for relationship reasons 2004-01-28 05:34:23 +00:00
Bill Currie d3018dd79b move qfprogs in with qfcc (it's going to need to share code) 2004-01-28 05:23:43 +00:00
Bill Currie 51b0a66ac7 better constant folding with auto-conversion between scalar types (might
make that optional for non-constants)
2004-01-25 08:55:03 +00:00
Bill Currie 515dbaccc0 make qc-lex.c and qc-parse.[ch] part of the distribution (two less
requirements for the average user)
2003-08-12 18:22:11 +00:00
Bill Currie 317c02539b macro-ize --with-{clients,servers} and implement --with-tools using the new
macro
2002-09-17 22:19:14 +00:00
Bill Currie 867f964740 * taniwha salutes while taps is played 2002-09-10 15:36:32 +00:00
Bill Currie ddd7d82bcf quick and dirty util to dump the defs in a .qfo file 2002-07-12 06:19:02 +00:00
Bill Currie 8a402381e6 redo how progs strings are stored so multiple pools can exist 2002-07-05 20:02:10 +00:00
Bill Currie 102eab0d84 linker.[ch]:
start working on the linker.
class.[ch]:
	redo class defs so the pointer works (needs relocs still)
obj_file.h:
	add prototype for read_obj_file, QFO_* data access macros and include
	pr_debug.h
type.[ch]:
	separate type system initialisation and recording of the standard types
	so find_type works properly in multiple compilation
def.c:
	don't mark static defs as initialized
expr.c:
	proper class pointer def stuff
immediate.c:
	clean out dead vars/code
obj_file.c:
	allocate space for the line info and bail if the file can't be opened.
qfcc.c:
	register the standard types for each compile pass and start linking the
	files
2002-07-03 20:16:32 +00:00
Bill Currie 9fee1d07dd initial work on actually writing .qfo files. seems to work, but only test.qfo
is ever writtin :)
2002-06-21 20:46:56 +00:00
Bill Currie 1e57351be1 there, no more PR_* functions or pr_* files :) 2002-06-09 04:30:02 +00:00
Bill Currie 00a54ad918 redo relocations 2002-06-07 17:29:30 +00:00
Bill Currie 2d21e0e2fb idstuff is a better name for precache 2002-06-04 18:45:45 +00:00
Bill Currie 06bddd3ee6 more cleanup 2002-06-04 18:44:03 +00:00