Commit graph

70 commits

Author SHA1 Message Date
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
Wolfgang (Blub) Bumiller
73749db6b4 What was I thinking... fixing loop's jump creation so it doesn't try creating multiple jumps... this code is also much more readable 2012-05-04 12:24:44 +02:00
Wolfgang (Blub) Bumiller
c670a8d278 ast_loop must end by entering the outgoing block 2012-05-04 12:01:53 +02:00
Wolfgang (Blub) Bumiller
2f92dedb4c Move the output block of a loop to after the loop, otherwise IR dumps looks just messy... note that this is merely a cosmetic change 2012-05-04 10:01:38 +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
a1a9fc797d Same for ternary: reordered a bit, and fixing ontrue->onfalse at the jump back to the merge block 2012-05-03 22:07:58 +02:00
Wolfgang (Blub) Bumiller
8a543bfae1 reorder ifthen codegen and fix a jump generation where I used ontrue instead of onfalse 2012-05-03 22:05:20 +02:00
Wolfgang (Blub) Bumiller
375cfd24b3 ast_loop - codegen dummied 2012-05-03 21:57:13 +02:00
Wolfgang (Blub) Bumiller
3e974a1a24 If-protect on_true and on_false in ast_ifthen since they can be NULL (contrary to ast_ternary where they can't) 2012-05-03 21:56:05 +02:00
Wolfgang (Blub) Bumiller
46122235e6 ast_function_codegen: Add a return instruction if it is missing, or error if we're not in a void-function 2012-05-03 14:15:02 +02:00
Wolfgang (Blub) Bumiller
0f023bc219 sprintf with length modifiers is annoying... 2012-05-03 13:45:24 +02:00
Wolfgang (Blub) Bumiller
4c9c6ee5bd ast_ternary_codegen - beware, it's almost a spaghetti... almost... 2012-05-03 13:02: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
54c92d5ae1 ast_ifthen_codegen 2012-05-03 12:38:43 +02:00
Wolfgang (Blub) Bumiller
2c329db9b9 ast_entfield_codegen 2012-05-03 12:19:33 +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
75c60657ac ast_store_codegen and its l/rvalue handling 2012-05-02 20:36:11 +02:00
Wolfgang (Blub) Bumiller
4fe806edc2 A note to clarify the ast_block/ir_block difference 2012-05-02 19:46:27 +02:00
Wolfgang (Blub) Bumiller
307eb2d9a2 ast_block_codegen - as you can see, an ast_block doesn't actually care about ir_blocks 2012-05-02 19:45:16 +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
1e9d02da14 going through function blocks in ast_function_codegen 2012-05-02 19:21:25 +02:00
Wolfgang (Blub) Bumiller
92a4431c86 ast_local_codegen - similar structure to global_codegen obviously... 2012-05-02 18:34:24 +02:00
Wolfgang (Blub) Bumiller
7a48377442 for ast_value_codegen this should be enough, since the actual generation happens in other functions 2012-05-02 18:25:59 +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
4fbcc57d49 Commenting on future lvalue use in ast_store 2012-05-01 15:15:19 +02:00
Wolfgang Bumiller
3a94e962ae codegen gets an lvalue flag now 2012-05-01 15:14:44 +02:00
Wolfgang Bumiller
4c165cbd07 ast_instantiate should check return value of mem_a and return NULL on error 2012-05-01 15:09:17 +02:00
Wolfgang Bumiller
281bd8657a ast_entfield node 2012-05-01 15:08:54 +02:00
Wolfgang Bumiller
69d93409e5 params should be deleted, not unref()d 2012-04-29 19:45:14 +02:00
Wolfgang Bumiller
5751e41993 After moving ast_instantiate up, the checks which return NULL now must mem_d(self) 2012-04-29 00:41:35 +02:00
Dale Weiler
3e7a8c0e78 All code is now C89/C90 compat 2012-04-28 18:56:09 -04: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
eef92df092 First delete the blocks, THEN the locals, since blocks USE locals, darn 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
e4a839df95 Get rid of ast_setfunc 2012-04-28 12:51:44 +02:00