Commit graph

330 commits

Author SHA1 Message Date
Dale Weiler
15b0555546 Implement constant folding on ternary operations via fold_cond. 2013-09-26 06:51:49 -04:00
Wolfgang Bumiller
4600f1d7ff more thorough check for whether an ast node starts a new label; closes #121 2013-08-31 10:48:24 +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
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
988b4b4960 ast_binary->right_first and an execution order check 2013-08-27 10:42:13 +02:00
Wolfgang Bumiller
b26f53125d error on uninitialized arrays of unspecified size; otherwise it errors about a size overflow 2013-08-27 10:19:05 +02:00
Wolfgang Bumiller
844e84fc16 bail out when encountering an invalid array size in the ast as it's likely to cause breakage when trying to generate them anyway 2013-08-27 10:09:31 +02:00
Dale Weiler
c64005966f Remove some trailing whitespace 2013-08-17 23:43:41 +00:00
Dale Weiler
24fc2e5146 Fix that typecast 2013-07-31 19:36:09 +00:00
Dale Weiler
10b75fd8b9 Move const-branch-elision into fold.c 2013-07-31 19:34:38 +00:00
Dale Weiler
d8b931fbcf Experimental/Initial try at in-ast constant folding. (for TYPE_FLOAT currently .. since comparisions on UTF8 strings need to be worked out yet ..) 2013-07-30 18:06:42 +00:00
Dale Weiler
d6ca5673dc Use the _t consistency naming scheme. Also various cleanups. 2013-07-30 16:00:51 +00:00
Dale Weiler
c8c25ef6f7 Some cleanups and smaller binaries! 2013-07-28 00:23:15 +00:00
Dale Weiler
c7679722fb Please the whitespace gods 2013-07-27 11:48:55 +00:00
Dale Weiler
bbffdde2dc Fix some bugs and a memleak in the testsuite. 2013-06-22 01:56:22 +00:00
Dale Weiler
063c50fce4 More bug fixes and dead code elimination 2013-06-22 01:23:59 +00:00
Dale Weiler
ce23e95d0b Remove a ton of dead code and document the one really insane case. 2013-06-21 23:40:51 +00:00
Dale Weiler
fe296de42f Fix more bugs (mostly possible NULL pointer dereferences) 2013-06-21 23:26:49 +00:00
Dale Weiler
996d998ebb Fix possible NULL pointer dereference 2013-06-21 23:21:12 +00:00
Wolfgang Bumiller
290d065a79 again with the comments... 2013-06-15 09:49:15 +02:00
Wolfgang Bumiller
3fab06941a fix a call typecheck issue 2013-06-15 09:46:44 +02:00
Wolfgang Bumiller
179da9241c working on vararg piping: detecting several error cases, adding -Wunsafe-types and -funsafe-varargs 2013-06-15 09:46:44 +02:00
Wolfgang Bumiller
8ce331b563 allow array size to be inferred from the initializer 2013-06-12 15:47:11 +02:00
Wolfgang Bumiller
dc91918c1f error about too many elements in initializer; added test for initialized arrays: arrays2.tmpl/qc 2013-06-12 14:41:38 +02:00
Wolfgang Bumiller
bc4a66e9f7 setting initializing values 2013-06-12 14:32:34 +02:00
Dale Weiler
11179a2a71 Major header reworking, this respects the namespaces properly. Makes object dependency more obvious, allows for better make caches, and prevents misuse of library features, i.e use con_* instead of printf. 2013-06-04 02:47:07 +00:00
Wolfgang Bumiller
ba781c53ef now a bare 'return;' is not required anymore if return has been assigned anywhere 2013-05-29 17:08:03 +02:00
Wolfgang Bumiller
9167de1631 fixing that comment... 2013-05-29 16:56:39 +02:00
Wolfgang Bumiller
afdc0c9dc8 assignable return value now lives in ast_function, as globals can get overwritten randomly; removed parser_find_retval; updated parse_return 2013-05-29 16:51:59 +02:00
Dale Weiler
db6ca6c5f8 Make static 2013-05-29 11:32:42 +00:00
Dale Weiler
6d6a2efada Experimental support for implicit return assignments. This closes #107. To enable return assignment support use -freturn-assignments. This allows you to do the following in QC code. T name() { return = expr_eval_T; return; /* returns expr_eval_T */ }. It allows for concise code and to rid locals in functions. It also saves a tremendous amount of space since only types of certian globals need to be allocated for returns. 2013-05-29 11:13:42 +00:00
Dale Weiler
2923b718e1 Merge branch 'union-replacement' into cooking
Conflicts:
	ast.c
2013-05-29 03:43:49 +00:00
Dale Weiler
f892b32335 Major export cleanup. Anything that was exported but wasn't used outside where it was implemented has been turned into static, and their exports have been removed. This actually makes the compiler compile slightly faster. 2013-05-29 03:29:04 +00:00
Wolfgang Bumiller
d70b571769 killing the union types 2013-05-11 22:34:01 +02:00
Wolfgang Bumiller
9f8bee4bf1 ast_value now has an initializer list array, still unused but it's there for later 2013-04-26 10:47:55 +02:00
Wolfgang Bumiller
3a4aba0b31 Grrrr 2013-04-24 17:47:42 +02:00
Wolfgang Bumiller
66305c676a Allow string concatenation in the parser as well, for now only for immediate strings and __FUNC__, maybe later -fpermissive or somethign could allow it on const-delcared string variables 2013-04-24 17:27:04 +02:00
Dale Weiler
489ad486bc Get it compiling in visual studio again. 2013-04-24 01:43:53 +00:00
Dale Weiler
160e7cf7ee Remove trailing whitespace 2013-04-21 10:24:55 +00:00
Wolfgang Bumiller
1f667c4b35 ast_expression_delete: delete varparam if it is set - fixes another leak 2013-04-15 21:05:59 +02:00
Wolfgang Bumiller
d5e90a17f9 fix memleak in ast_local_codegen 2013-04-15 20:56:48 +02:00
Dale Weiler
ef528d6710 Added tracing to strdup for allocations, fixed some memleaks, this isn't pretty (trying to track down some weird memory leak issues) 2013-04-14 23:51:16 +00:00
Dale Weiler
ccc2eb3298 More function flatening 2013-04-14 01:14:14 +00:00
Dale Weiler
48d6375817 flatten the use of strcpy, 90% of the cases we already knew the length of the string either at compile-time, or already within the scope we where, thus letting us use strncpy, which can be further optimized (unrolled if static) 2013-04-14 01:00:25 +00:00
Dale Weiler
0367a6175d Add some ice 2013-03-07 22:52:03 +00:00
Dale Weiler
52ffc6db10 Merge branch 'cooking' of github.com:graphitemaster/gmqcc into cooking 2013-02-05 17:16:09 +00:00
Dale Weiler
b3e87c3280 ast referencing 2013-02-05 17:14:56 +00:00
Wolfgang Bumiller
4b5afe3456 ast_array_index_codegen: never regenerate code 2013-02-05 17:54:14 +01:00
Wolfgang Bumiller
72106b0982 removing some left-over alloc checks 2013-02-05 17:34:40 +01:00
Wolfgang Bumiller
e662efae61 fix: rotate_entfield_array_index_nodes deleting the old array caused expressions to be deleted recursively 2013-02-03 23:38:06 +01:00