Commit graph

54 commits

Author SHA1 Message Date
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
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
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
5b2d99bc99 Revert "ast_usecount macro for convenience"
This reverts commit e86c8ff0eb.
2012-08-18 16:20:36 +02:00
Wolfgang (Blub) Bumiller
e86c8ff0eb ast_usecount macro for convenience 2012-08-18 16:18:51 +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
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
406a32bea6 prototypes for ast_binstore, and storing outl/outr in ast_expression_common, TODO: let ast_codegen functions reuse previous results so that binstore can call codegen twice 2012-08-13 19:39:35 +02:00
Wolfgang (Blub) Bumiller
5240aa8379 ast_istype should add the TYPE_ prefix 2012-08-12 11:36:15 +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
42168fde00 removing an old comment 2012-07-27 15:27:34 +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
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
ed24ea0cef creating and generating builtin functions, ast-macros for builtins, todo: params 2012-07-03 23:38:38 +02:00
Wolfgang (Blub) Bumiller
e934e77cc5 ast_call node; codegen dummy 2012-06-28 16:15:51 +02:00
Wolfgang (Blub) Bumiller
c3460c1654 ast_function gets 'breakblock' and 'continueblock' for break and continue support; fixed some typos; added huge ast_loop_codegen implementation... need to go through it and check 2012-05-04 00:16:51 +02:00
Wolfgang (Blub) Bumiller
375cfd24b3 ast_loop - codegen dummied 2012-05-03 21:57:13 +02:00
Wolfgang (Blub) Bumiller
bbcd3f12de Removing TODO-comment since it's done 2012-05-03 18:38:29 +02:00
Wolfgang (Blub) Bumiller
91bf040f0a ast_function_label now takes a labelname to prefix the id with 2012-05-03 12:40:49 +02:00
Wolfgang (Blub) Bumiller
da9a4fef29 Type information moved to ast_expression from ast_value, every ast node should in theory know its type - it is important for dereferencing pointers or entity fields, to figure out the output type. Eg. so that ast_entfield knows what kind of OP_LOAD it needs to use 2012-05-03 12:12:22 +02:00
Wolfgang (Blub) Bumiller
4317f40fa5 ast_binary_codegen, ast_function_label (no I don't like sprintf...) 2012-05-02 23:11:39 +02:00
Wolfgang (Blub) Bumiller
13082112b0 create the ir_function in ast_function_codegen, keep the current ir_block stored in ast_function so inner codegens can use it 2012-05-02 19:25:25 +02:00
Wolfgang (Blub) Bumiller
314d45ff82 ast_local/global_codegen exposed through the header for now 2012-05-02 18:36:11 +02:00
Wolfgang Bumiller
1e0a688bc5 ast_ternary - contrary to ast_ifthen neither ontrue nor onfalse can be NULL, and it does output a value 2012-05-01 17:02:45 +02:00
Wolfgang Bumiller
5fe87e6a20 if-then-else AST node - this one is not for ternary expressions 2012-05-01 16:55:02 +02:00
Wolfgang Bumiller
3a94e962ae codegen gets an lvalue flag now 2012-05-01 15:14:44 +02:00
Wolfgang Bumiller
281bd8657a ast_entfield node 2012-05-01 15:08:54 +02:00
Dale Weiler
05966ee009 Remove trailing whitespace from everything 2012-04-28 16:43:39 -04:00
Wolfgang Bumiller
2a9b3c7877 ast_function gets a handle to its ir_function, ast_global_codegen to generate an ir global, or an ir_function 2012-04-28 20:55:41 +02:00
Wolfgang Bumiller
6145ecf7e0 ast_binary takes 2 expressions, not 2 values, ast_store takes a value and and expression for now until we support pointers, also: dropped the 'keep' param from ast_value_new, values are always to be stored somewhere to be deleted independently from their uses 2012-04-28 20:55:41 +02:00
Wolfgang Bumiller
0f38a560b6 ast_value and ast_function are linked together when using ast_function_new, note however, that neither will delete the other in their _delete functions. 2012-04-28 20:55:41 +02:00
Wolfgang Bumiller
75b78720fd lex_ctx_t -> lex_ctx, vector_t -> vector 2012-04-28 11:15:29 +02:00
Dale Weiler
89ed723efa astir.h -> gmqcc.h 2012-04-28 05:08:03 -04:00
Wolfgang Bumiller
1bf4aa379a Header guards and macros get {} in oneline ifs and loops 2012-04-28 10:17:32 +02:00
Wolfgang (Blub) Bumiller
ce43a35307 ast_value_set_name to return bool 2012-04-27 13:32:52 +02:00
Wolfgang (Blub) Bumiller
fdc98383d1 Adding a 'keep' bool to nodes: Generally, destroying an AST node should destroy all its child-nodes, global variables get 'keep' to be true to avoid them being deleted together with expressions they're used in. 2012-04-26 11:45:22 +02:00
Wolfgang (Blub) Bumiller
1a917a2659 Introduce an ast_store rather than splitting ast_binary 2012-04-26 11:36:46 +02:00
Wolfgang (Blub) Bumiller
41a39125be ast_binary_new to initialize codegen function ptr, codegen proto for store and binary ast nodes 2012-04-26 10:38:00 +02:00