Commit graph

208 commits

Author SHA1 Message Date
Wolfgang (Blub) Bumiller
906f319673 Replaced it all... 2012-11-15 18:32:09 +01:00
Dale Weiler
2e84cc0b41 Use new console system everywhere. 2012-11-15 00:28:46 +00:00
Wolfgang (Blub) Bumiller
b61ae53ecd fix wrong const qualifier 2012-11-13 00:11:07 +01:00
Wolfgang (Blub) Bumiller
d60a76abd1 allowing inexing of array-fields 2012-11-12 23:35:47 +01:00
Wolfgang (Blub) Bumiller
0340a6a6e7 support for ast_entfield nodes with specific output types, fixing array-field instantiating code to print the correct name on error 2012-11-12 22:39:43 +01:00
Wolfgang (Blub) Bumiller
0224de02d5 add an asterror message for ast_entfield_new with a wrong type 2012-11-12 22:33:34 +01:00
Wolfgang (Blub) Bumiller
d959c71be6 genearting field arrays 2012-11-12 20:33:49 +01:00
Wolfgang (Blub) Bumiller
83438d9833 call ir_function_finalize on array accessors otherwise they'll blow up stuff 2012-11-11 23:46:03 +01:00
Wolfgang (Blub) Bumiller
bde2175779 Generating function-local arrays 2012-11-11 23:31:57 +01:00
Wolfgang (Blub) Bumiller
a0b6008c2e fix an uninitialized value 2012-11-11 21:32:04 +01:00
Wolfgang (Blub) Bumiller
a78cdd5366 calling the array setter when required 2012-11-11 21:27:02 +01:00
Wolfgang (Blub) Bumiller
feec2d74ee Fix array-index codegen conditions 2012-11-11 19:02:50 +01:00
Wolfgang (Blub) Bumiller
30d87ee837 get-accessor calling in ast_array_index_codegen 2012-11-11 16:32:59 +01:00
Wolfgang (Blub) Bumiller
1ab303c528 Store accessors in the ast_value for access from within the ast - generate accessors after generating all the globals to not mess up the order of globals in the output 2012-11-11 16:22:09 +01:00
Wolfgang (Blub) Bumiller
7d9568f806 array accessor function genaration 2012-11-11 16:06:27 +01:00
Wolfgang (Blub) Bumiller
25ad091866 ast->ir for TYPE_ARRAY globals 2012-11-11 12:14:44 +01:00
Wolfgang (Blub) Bumiller
a7d3a2d6ea adding opts_max_array_size with a default of 1024, adding some TODO errors for arrays in the AST 2012-11-11 11:09:36 +01:00
Wolfgang (Blub) Bumiller
62d062f860 for arrays, ast_value will contain several ir_values, ir_v will point to the [0] element 2012-11-11 10:51:40 +01:00
Wolfgang (Blub) Bumiller
42b9848375 Locals of type .vector will now also properly generate all 3 locals 2012-11-11 10:13:01 +01:00
Wolfgang (Blub) Bumiller
a27750966f globals of type .vector will now properly generate 3 globals 2012-11-11 10:13:00 +01:00
Wolfgang (Blub) Bumiller
52daf02444 Support in the AST for TYPE_FIELD globals which are no actual fields 2012-11-11 10:13:00 +01:00
Wolfgang (Blub) Bumiller
e143db0cae gcc lost it's magic analyzer and now complains about uninitialized stuff... <sadface> 2012-11-04 11:41:44 +01:00
Wolfgang (Blub) Bumiller
62f55d5155 Error when lvalues are requested where that's not possible 2012-10-30 21:15:42 +01:00
Wolfgang (Blub) Bumiller
bd739528ad ast_call_check_types should not check more parameters than actually available in both the call and the function type - fixes a crash introduced by this on variadic functions 2012-10-29 14:35:50 +01:00
Wolfgang (Blub) Bumiller
f56c5f425a ast_type_to_string function 2012-10-28 20:30:55 +01:00
Wolfgang (Blub) Bumiller
90571a6151 ast_store needs to take over the type of its destination 2012-10-28 20:02:57 +01:00
Wolfgang (Blub) Bumiller
478a9249a0 add error for function parameters of invalid types 2012-10-28 15:44:27 +01:00
Wolfgang (Blub) Bumiller
1fc8c2f697 copy the function context over to its ir_value as well 2012-08-24 19:49:12 +02:00
Wolfgang (Blub) Bumiller
8e990b65f3 Not labeling temps/blocks if opts_dump isn't specified 2012-08-24 18:10:41 +02:00
Wolfgang (Blub) Bumiller
7fec608417 better labelling in ast_function_labeling, this time the number is even printed forward rather than backward... ;) 2012-08-24 18:08:28 +02:00
Wolfgang (Blub) Bumiller
c84830bdee Warna bout unused variables - -Wunused-variable, on by default 2012-08-23 20:25:54 +02:00
Wolfgang (Blub) Bumiller
f9746a59ae it's not the IR's job to fail when a local of the same name is created twice... 2012-08-23 17:22:13 +02:00
Wolfgang (Blub) Bumiller
39a62f495c removing some extra newlines in ast error messages 2012-08-23 17:16:07 +02:00
Wolfgang (Blub) Bumiller
f22112bcb8 Variadic functions: works for builtins, warns for implemenetd functions, -Wvariadic-function, on by default 2012-08-23 11:29:48 +02:00
Wolfgang (Blub) Bumiller
426cab1f24 ast_ifthen_codegen: the merge-jumps for an if's branches need to be added to the endblock of the branch, not the beginning 2012-08-21 18:25:41 +02:00
Wolfgang (Blub) Bumiller
a4c6382fa4 more context copies 2012-08-19 20:43:34 +02:00
Wolfgang (Blub) Bumiller
53b9906242 have the ir take over some more context data from the ast 2012-08-19 20:43:04 +02:00
Wolfgang (Blub) Bumiller
1cc3705da4 Don't have the ast's codegen error on missing returns 2012-08-19 20:28:14 +02:00
Wolfgang (Blub) Bumiller
4254845227 same as before for loops: don't try creating a jump if the body ends in a return 2012-08-19 19:45:53 +02:00
Wolfgang (Blub) Bumiller
49cd86e8ed don't try to create jumps in ifs if the block is already done 2012-08-19 19:43:41 +02:00
Wolfgang (Blub) Bumiller
cadf877eb4 provide the context to ir_functions 2012-08-19 19:37:46 +02:00
Wolfgang (Blub) Bumiller
bd64d7d7b4 Automatic prototyping of frame-functions 2012-08-19 19:24:43 +02:00
Wolfgang (Blub) Bumiller
20635c5ae4 ast_type_adopt - ast_entfield now adopts the full type of the field 2012-08-18 20:30:24 +02:00
Wolfgang (Blub) Bumiller
99fe673f0a ast_unary needs to set its type 2012-08-18 20:02:18 +02:00
Wolfgang (Blub) Bumiller
40fe52e665 ast_call: adopt the funciton's return type 2012-08-18 19:37:51 +02:00
Wolfgang (Blub) Bumiller
b7b0fcdc94 ast_return_delete: check if self->operand is actually set before ast_unref-ing it 2012-08-18 18:01:52 +02:00
Wolfgang (Blub) Bumiller
6d84010dc4 ast_return should accept NULL as value to create a simple 'return' without a value 2012-08-18 17:58:38 +02:00
Wolfgang (Blub) Bumiller
e239d2a33b set expression.next to NULL in ast_block_set_type if it won't be set to a new value 2012-08-18 17:46:02 +02:00
Wolfgang (Blub) Bumiller
24a21d0816 ast_value_copy should copy the expression substructure as well - exposing ast_value_copy to the outside since the parser needs to copy complete types when multiple variables are declared with commas 2012-08-18 17:16:20 +02:00
Wolfgang (Blub) Bumiller
3effcd2342 initialize the ast_expression node in ast_shallow_type properly as well 2012-08-18 16:58:17 +02:00
Wolfgang (Blub) Bumiller
9ffb79111f initialize the ast_expression node in ast_type_copy properly 2012-08-18 16:57:22 +02:00
Wolfgang (Blub) Bumiller
304cf173cd ast_member's are now kept, since they are used like variables: multiple times 2012-08-18 16:38:50 +02:00
Wolfgang (Blub) Bumiller
ff1506983b Add a comment about why we don't delete the owner 2012-08-18 16:32:07 +02:00
Wolfgang (Blub) Bumiller
6acf131369 Doh... wrong comment type 2012-08-18 16:30:28 +02:00
Wolfgang (Blub) Bumiller
ffd41cb1c7 ast_member will not unref/delete the owner: first of all the owner is always an ast_value, which won't get deleted anyway, secondly: the ast_members are collected and deleted after the owners, so ast_unref(owner) will cause invalid memory access 2012-08-18 16:30:09 +02:00
Wolfgang (Blub) Bumiller
b6ab0207b1 ast_block_collect: add to ast_block->collect and set the node's .keep=true, those will now always be deleted by the ast_block dtor 2012-08-18 16:27:40 +02:00
Wolfgang (Blub) Bumiller
5a78270ada initialize ast_block->collect properly 2012-08-18 16:25:21 +02:00
Wolfgang (Blub) Bumiller
68e4a937f2 collect vector-member locals in ast_block->collect, like a garbage collection... 2012-08-18 16:24:26 +02:00
Wolfgang (Blub) Bumiller
897bd5727e Revert "let ast_node have a use-counter, helpful for the parser to delete unused fields which otherwise get lost in the void"
This reverts commit 25ffd11aa6.
2012-08-18 16:20:45 +02:00
Wolfgang (Blub) Bumiller
25ffd11aa6 let ast_node have a use-counter, helpful for the parser to delete unused fields which otherwise get lost in the void 2012-08-18 16:16:43 +02:00
Wolfgang (Blub) Bumiller
a74b26a9bc Add an error output in the ast where I missed one (there are probably more places which need one) 2012-08-18 12:45:29 +02:00
Wolfgang (Blub) Bumiller
98567e20f3 print a proper error message when a function lacks a body 2012-08-16 15:31:46 +02:00
Wolfgang (Blub) Bumiller
baf6d3ead4 fixing ast_binstore_codegen's lvalue flag setting, now += on entfields works correctly 2012-08-14 17:35:02 +02:00
Wolfgang (Blub) Bumiller
65fb4b34b5 type comparison, function prototypes 2012-08-14 14:14:56 +02:00
Wolfgang (Blub) Bumiller
722be55fa9 removing all direct 'printfs' from ast and ir, replaced by the error interface 2012-08-14 13:14:32 +02:00
Wolfgang (Blub) Bumiller
cfdf915b25 ast_binstore, used for +=, -=, ++, -- etc 2012-08-14 10:40:48 +02:00
Wolfgang (Blub) Bumiller
3fd7a64b45 storing generated values and returning them early if they exist - will error when that doesn't make sense eg when trying to call codegen ast_ifthen more than once 2012-08-13 19:54:53 +02:00
Wolfgang (Blub) Bumiller
862b506dcd initialize ast_expression_common.outl/outr 2012-08-13 19:40:06 +02:00
Wolfgang (Blub) Bumiller
fc7d32a715 fixed: ast_member needs to allow type_vector instead of type_float as base 2012-08-12 11:39:43 +02:00
Wolfgang (Blub) Bumiller
028543db8c ast_binary now keeps track of types 2012-08-12 11:36:28 +02:00
Wolfgang (Blub) Bumiller
56c23dc11e ast_member_new now fixed up for fields, ast_shallow_type added for creation of a type-only ast_expression 2012-08-11 22:14:16 +02:00
Wolfgang (Blub) Bumiller
91e3765a00 Generating fields using ir_builder_create_field 2012-08-11 18:05:56 +02:00
Wolfgang (Blub) Bumiller
f51ad96620 removing an unused variable 2012-08-11 15:41:37 +02:00
Wolfgang (Blub) Bumiller
9c2e6a2334 Experimental ast_member to access vector members 2012-08-08 14:49:37 +02:00
Wolfgang Bumiller
47a8a69f1c ast nodes now store their type id, and can be checked via ast_istype 2012-07-29 10:03:13 +02:00
Wolfgang Bumiller
c5ba27da6f ast_store to take ast_expression on its left, rather than ast_value. Assigning to a vector member would not put an ast_value on the left, but an ast_member, thus: ast_expression now already 2012-07-28 18:13:12 +02:00
Wolfgang Bumiller
2674982854 Moving parameters to from ast_value to ast_expression_common, it's part of the type after all 2012-07-27 15:22:39 +02:00
Wolfgang Bumiller
ab11808208 ast_block_set_type 2012-07-27 13:39:58 +02:00
Wolfgang Bumiller
1f8ece7f20 ast_return_new doesn't take an operator, we use INSTR_RETURN always, never INSTR_DONE for explicit returns 2012-07-26 23:23:47 +02:00
Wolfgang Bumiller
31ba1ec6c1 ast_return 2012-07-26 21:18:39 +02:00
Wolfgang Bumiller
e22d340e23 ast/ir support for unary instructions 2012-07-26 20:45:18 +02:00
Wolfgang Bumiller
4255b143b0 Removed params from ast_function again. It really is superfluous to copy them, just generate them from its ast_value's param list 2012-07-22 12:35:10 +02:00
Wolfgang Bumiller
d4c408b4bd fix a warning about a format string 2012-07-22 12:22:25 +02:00
Wolfgang Bumiller
a4617d0e61 ast_function generates parameter locals, ir_function_create_local now allows adding parameters as long as no local variables have been added yet 2012-07-22 12:15:48 +02:00
Wolfgang Bumiller
43897f6e8f store_param storetype, parameter value list added to ast_function 2012-07-22 12:07:30 +02:00
Wolfgang Bumiller
fec07921a4 removing params vector from ast_function, params are stored in its ast_value only 2012-07-19 18:14:08 +02:00
Wolfgang Bumiller
3987509493 Do not actually return after generating a call, there are other isntructions following 2012-07-04 15:16:02 +02:00
Wolfgang Bumiller
001420a7ef Storing ir_v for functions 2012-07-04 15:00:30 +02:00
Wolfgang Bumiller
d259e75dc4 ast_call needs to set its func member 2012-07-04 14:41:39 +02:00
Wolfgang Bumiller
812084ad72 ast_call's param vector functions 2012-07-04 14:39:58 +02:00
Wolfgang Bumiller
6bbcd5a343 ast-macros: MKCONSTSTRING, added sHello hello world string 2012-07-04 14:20:54 +02:00
Wolfgang Bumiller
ed24ea0cef creating and generating builtin functions, ast-macros for builtins, todo: params 2012-07-03 23:38:38 +02:00
Wolfgang (Blub) Bumiller
c1ea9cc409 function in the ast now MUST have an output type in their 'next' ast_expression pointer, the IR's outtype of functions is now filled 2012-06-29 13:07:19 +02:00
Wolfgang (Blub) Bumiller
67fa4ce07b ir_builder_create_call to take return type from the ir_value 2012-06-29 12:55:35 +02:00
Wolfgang (Blub) Bumiller
01b3f5ef58 ast_call_codegen, ir_block_create_call plus call-related functions, ir_value->outtype TODO: fill outtype in ir_value 2012-06-28 17:21:26 +02:00
Wolfgang (Blub) Bumiller
e934e77cc5 ast_call node; codegen dummy 2012-06-28 16:15:51 +02:00
Wolfgang (Blub) Bumiller
f61d4331fe Fixing NULL->false and empty lines... 2012-06-11 19:25:21 +02:00
Dale Weiler
2929eb39a8 fixed -Wconditional-uninitialized for ast codegen 2012-06-07 11:12:12 -04:00
Dale Weiler
f4bc6ba08a Removed even more warnings 2012-06-07 11:09:29 -04:00
Wolfgang (Blub) Bumiller
200b425db0 Fixed some dangling '}', it compiles again now 2012-05-04 12:26:24 +02:00