Commit graph

655 commits

Author SHA1 Message Date
Wolfgang Bumiller
8d5e719026 replacing the current [[accumulate]] implementation: shorter and simpler, and also supports non-void return types 2013-10-18 11:26:41 +02:00
Dale Weiler
02a1d9f4a1 Fix 'declaration does not declare anything' regression i.e this closes #132. 2013-10-17 05:06:09 -04:00
Dale Weiler
05ac126d6f Use "##" to ensure the names of the accumulated functions are striped by the IR. 2013-10-17 03:47:26 -04:00
Dale Weiler
4da820ef61 Enforce void type on accumulatable functions. 2013-10-17 03:39:14 -04:00
Dale Weiler
2c975bb344 Implemented [[accumulate]] attribute. This will hopefully be used by Xonotic to replace it's ACCUMULATE_FUNCTION stuff. 2013-10-17 03:21:30 -04:00
Dale Weiler
8699053887 Fix handling on intrinsic folding, this closes #118. 2013-10-17 00:14:42 -04:00
Dale Weiler
003bb9dfb4 Prevent aliasing functions through forward declared prototypes. This closes #125 2013-10-16 23:37:39 -04:00
Dale Weiler
50d165e173 Some intrinsic code cleanup. The args check is handled anyways in the parser. We use a generated array alongside to prevent generating the intrinsic multiple times instead of using static storage. Other various cleanups as well. 2013-10-16 00:04:39 -04:00
Wolfgang Bumiller
82afdb1e2c Merge branch 'cooking' of git://github.com/graphitemaster/gmqcc into cooking 2013-10-11 14:10:57 +02:00
Wolfgang Bumiller
62ac7e9966 first part of parsing TOKEN_DOTS as part of a type when needed; allows declarations like: ...float x; 2013-10-11 14:10:47 +02:00
Dale Weiler
87d9371a5c Refactor some util/platform usage and extend file system file interface to accept its own flags and EOF 2013-10-11 06:12:56 -04:00
Dale Weiler
12a864abf5 Some more platform / compiler specific code refactoring. 2013-10-11 03:02:38 -04:00
Dale Weiler
151606e255 Initial platform / compiler specific code refactoring. 2013-10-11 02:39:30 -04:00
Dale Weiler
7249c2ec18 Simplify parse stage for unary - operator. 2013-09-29 22:08:09 -04:00
Dale Weiler
353455e1ad Remove pointless thinking comment, fix builds for clang. 2013-09-29 22:06:26 -04:00
Dale Weiler
b10de1b240 Make unary - operator act as an ast_unary node. This allows for consistency (no sense in making unary use binstore nodes, it doesn't make much sense). It also allows for the peephole optimization on unary chains that cancel each other to take place; i.e code like "-(-a)" simplifies to "a", thus eliminating instructions. 2013-09-29 22:01:46 -04:00
Dale Weiler
d61c5d3b16 Fix alias type check 2013-09-26 08:09:55 -04:00
Dale Weiler
894e1976e3 Cheap quick hack for ignoring #pragma to EOL 2013-09-25 15:35:18 -04:00
Dale Weiler
73eca0848c Fix QuakeWorld compilation by treating assignment to constants as a warning when -std=qcc. 2013-09-24 07:31:53 -04:00
Wolfgang Bumiller
35f9aef729 fix: declaring locals with the name of a parameter now treats the parameter as the local's prototype to avoid it being double-freed later 2013-09-11 11:25:44 +02:00
Dale Weiler
b2c8f3ebc5 Vector cross product virtual instruction, now >< operator works for non-constant vectors. Thanks divVerent for the help. 2013-08-31 14:49:06 -04:00
Dale Weiler
64661f54ea Implemented >< (vector cross product operator). Currently support for constants only. 2013-08-31 13:41:25 -04:00
Wolfgang Bumiller
702a7664de Don't allow a stale 'some_type;' declaration without an actual variable name; Same for typedef; closes #119 2013-08-31 11:35:12 +02:00
Wolfgang Bumiller
2ff9adecb2 this one can be reached - make it a little more helpful 2013-08-31 10:55:03 +02:00
Wolfgang Bumiller
79219ae201 factor check for assignment-to-constant into a function; improve its error output; closes #122 2013-08-31 10:39:31 +02:00
Wolfgang Bumiller
87b9fca732 fix unhelpful error message; fixes #123 2013-08-31 10:19:10 +02:00
Wolfgang Bumiller
ff6d55aafc this should allow for better detection of precedence issues 2013-08-29 10:22:48 +02:00
Wolfgang Bumiller
fa468e0673 also warn about mixing logical and/or operations without parenthesis 2013-08-29 08:26:17 +02:00
Wolfgang Bumiller
f140c39063 warn when mixing different bitops without parenthesis around them 2013-08-29 08:18:06 +02:00
Dale Weiler
a7c1f6f021 Implement [[eraseable]] attribute. When used with a function it instructs the AST (which than transfers logic to the IR) that the function (or variable) is potentially unused (verified by checking the read count). This than propogates through the IR and prevents the IR from generating both the definition and global/function. The intrinsics system uses this as well to prevent intrinsic functions from being generated unless they're used. 2013-08-29 00:05:37 -04:00
Dale Weiler
ceb79f1897 Fix build on clang 2013-08-28 13:01:46 -04:00
Dale Weiler
3b4a5667ea Constant fold intrinsics if their arguments are constant. TODO: reference count intrinsics such that they're not generated unless they're used, currently when an intrinsic can be folded-away it's marked for generation and makes it to the final output binary even though it isn't used. 2013-08-28 12:46:22 -04:00
Wolfgang Bumiller
494c30a239 allow initializing shadowed locals outside of -std=gmqcc - in this case it becomes a regular assignment to the old declaration which is consistent with fteqcc 2013-08-28 14:20:33 +02:00
Rudolf Polzer
e50b7a2719 Support vector bitor/bitand/bitxor.
Signed-off-by: Rudolf Polzer <divverent@xonotic.org>
2013-08-26 18:32:28 +02:00
Dale Weiler
c64005966f Remove some trailing whitespace 2013-08-17 23:43:41 +00:00
Dale Weiler
772dbfae26 Make it compile in visual studio again, without warnings. 2013-08-16 09:03:36 +00:00
Dale Weiler
a622d5163b Rework some build stuff for better output and to enable strict prototypes 2013-08-16 03:28:02 +00:00
Dale Weiler
bee14a6df7 Some bug fixes 2013-08-14 07:19:49 +00:00
Dale Weiler
73d9aa29c4 Made intrinsics seperate from the parser. 2013-08-14 06:02:15 +00:00
Dale Weiler
216330a7e2 Some intrinsic cleanups 2013-08-14 03:03:49 +00:00
Dale Weiler
3e24b5a74b Remove debugging aid and left over cruft. 2013-07-31 18:54:38 +00:00
Dale Weiler
960cb7034a The problem was so subtle 2013-07-31 18:53:00 +00:00
Dale Weiler
5f2b7e3d57 fixed vector ops constant folding. 2013-07-31 17:05:43 +00:00
Dale Weiler
d0ee56f25f more fixes 2013-07-31 16:31:45 +00:00
Dale Weiler
fa5ad1212e Operator constant folding rewrite almost complete, just need to track down why two tests are failing. 2013-07-31 15:49:45 +00:00
Dale Weiler
920dbaf1e0 Work in progress constant-folding rewrite. 2013-07-31 09:04:19 +00:00
Dale Weiler
2c975fe48f I'm in a state of confusion as to why constant folding was never done on comparisions, now it is ;) 2013-07-30 17:27:54 +00:00
Dale Weiler
d6ca5673dc Use the _t consistency naming scheme. Also various cleanups. 2013-07-30 16:00:51 +00:00
Dale Weiler
c7679722fb Please the whitespace gods 2013-07-27 11:48:55 +00:00
Dale Weiler
8db9724c5d Revert "Smaller memory footprint, 4/8 bytes vs 12/24 for individual token lex_ctx's. Use to be a 'shallow' copy of the details in lex_file, now it's a pointer to the contents in lex_file."
This reverts commit cddf70f46b.
2013-07-26 16:17:41 +00:00