Commit graph

130 commits

Author SHA1 Message Date
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
Dale Weiler
b10a2d1fd5 Remove the attempt at ast_intrinsic node 2013-08-14 03:05:14 +00:00
Dale Weiler
216330a7e2 Some intrinsic cleanups 2013-08-14 03:03:49 +00:00
Dale Weiler
10b75fd8b9 Move const-branch-elision into fold.c 2013-07-31 19:34:38 +00:00
Dale Weiler
d6ca5673dc Use the _t consistency naming scheme. Also various cleanups. 2013-07-30 16:00:51 +00:00
Dale Weiler
5694c77d16 I added it for a reason, because I was smart. I forgot about it because of life :( 2013-06-15 11:04:08 +00: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
7a36a8bdd8 parsing array initializers 2013-06-12 14:32:12 +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
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
ef6e2bd583 first step to getting rid of those unions we don't use anyway 2013-05-11 22:05:30 +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
Dale Weiler
e464cc1ea6 Implemented generalized attribute aliases. You can now alias functions, locals, or globals with [[alias("old_name")]] type new_name; 2013-02-06 05:30:09 +00:00
Dale Weiler
b3e87c3280 ast referencing 2013-02-05 17:14:56 +00:00
Wolfgang Bumiller
72106b0982 removing some left-over alloc checks 2013-02-05 17:34:40 +01:00
Wolfgang Bumiller
1410840ef6 Make the varargs counter more stable, it'll now work with a function pointer with a different number of fixed params 2013-01-17 10:30:32 +01:00
Wolfgang Bumiller
a01388ea7d Copying arg counter into the local 2013-01-12 15:06:19 +01:00
Wolfgang Bumiller
973122ed9b ast_call now has a va_count which causes a store to reserved:va_count before the call 2013-01-12 13:29:47 +01:00
Wolfgang Bumiller
6dfdf69a8e vararg accessor generation 2013-01-12 13:01:20 +01:00
Wolfgang Bumiller
c69ba2c734 parsing of vararg-counter 2013-01-12 11:29:03 +01:00
Wolfgang Bumiller
ca947d782c Declaration of type-restricted varargs 2013-01-12 11:03:17 +01:00
Wolfgang Bumiller
6df3c625b0 Added a flag to both ast and ir which enforces the generation of a globaldef for a value 2013-01-11 19:15:59 +01:00
Wolfgang Bumiller
e146fd121c parse_expression now takes a boolean flag on whether or not it should be creating ast_labels for undefined identifiers; creating the label later will pick it up and set its undefined flag to false 2013-01-03 12:46:33 +01:00
Dale Weiler
29db4a44ed Happy new years! 2013-01-01 05:08:55 +00:00
Dale Weiler
46374e94ca Add support for user defined messages for [[deprecated]] generalized attribute 2012-12-30 09:58:52 +00:00
Dale Weiler
921877e8a4 Implement [[deprecated]] general attribute, will mark functions as deprecated. Making calls to functions marked as such will trigger a compiler warning. Enabled by default. 2012-12-30 06:43:07 +00:00
Wolfgang Bumiller
755ee5462f Properly support globals initialized to nil 2012-12-29 21:15:59 +01:00
Wolfgang Bumiller
33be9d4559 Don't allow code like: v * '0 1 0' = 3; to actually work... 2012-12-29 15:13:54 +01:00
Wolfgang Bumiller
14e954284e more general qualifier/attribute parsing, added not-yet-used AST_FLAG_INLINE and [[inline]] 2012-12-28 19:46:28 +01:00
Wolfgang Bumiller
f1fa8f6055 So why doesn't any popular compiler complain about this 2012-12-28 11:50:03 +01:00
Wolfgang Bumiller
a60d0182db finish parsing of labeled loops; ast support added 2012-12-28 00:04:09 +01:00
Wolfgang Bumiller
ebb7cb2ae3 parsing of loop labels 2012-12-27 23:43:20 +01:00
Wolfgang Bumiller
2b468cb0ee Added the 'static' keyword.
Implements #71
2012-12-24 11:30:58 +01:00
Wolfgang Bumiller
b4e38a8fed Fix: ast_value.cvq must be an int, not a bool;
Fixes #62
2012-12-22 12:30:20 +01:00
Wolfgang Bumiller
a985a5cab1 while/for/do now all use process_condition, ast_loop got 2 new parameters for more efficient translation 2012-12-20 20:22:31 +01:00
Wolfgang (Blub) Bumiller
ba434c8e22 removing ast_expression_common.variadic, adding ast_expression_common.flags, added AST_FLAG_VARIADIC and AST_FLAG_NORETURN 2012-12-19 20:45:48 +01:00
Wolfgang (Blub) Bumiller
8777624fe2 ast_block_add_expr now lets the block fully adopt the type of the added expression 2012-12-05 12:57:00 +01:00
Wolfgang (Blub) Bumiller
02ec45363e Get rid of some code duplication 2012-12-02 17:57:08 +01:00
Wolfgang (Blub) Bumiller
2a3e7c1cff field constants - revert globals generated after fields 2012-11-30 21:11:25 +01:00
Wolfgang (Blub) Bumiller
316298650e remember if an ast_value is a field-declaration, build fields before globals 2012-11-30 21:03:57 +01:00
Wolfgang (Blub) Bumiller
6acd159c9c Keeping track of numbers for debugging 2012-11-30 16:23:42 +01:00