X-Git-Url: https://git.xonotic.org/?p=xonotic%2Fgmqcc.git;a=blobdiff_plain;f=ast.h;h=0a23a324ae30c77308818e2d583ff0bf0e97878c;hp=f0e9e6b0e480d4f1f1afcd5f48c5e0ecc1213c7a;hb=ca033e5acd2c69ee2b4a96046605e0e41f5f597b;hpb=21c2fcb929ed0cb2ec2be41bc084d8c55538e477 diff --git a/ast.h b/ast.h index f0e9e6b..0a23a32 100644 --- a/ast.h +++ b/ast.h @@ -73,6 +73,7 @@ enum { #define ast_istype(x, t) ( ((ast_node_common*)x)->nodetype == (TYPE_##t) ) #define ast_ctx(node) (((ast_node_common*)(node))->context) +#define ast_side_effects(node) (((ast_node_common*)(node))->side_effects) /* Node interface with common components */ @@ -87,6 +88,7 @@ typedef struct * prevents its dtor from destroying this node as well. */ bool keep; + bool side_effects; } ast_node_common; #define ast_delete(x) ( ( (ast_node*)(x) ) -> node.destroy )((ast_node*)(x)) @@ -309,8 +311,9 @@ struct ast_member_s ast_expression_common expression; ast_expression *owner; unsigned int field; + const char *name; }; -ast_member* ast_member_new(lex_ctx ctx, ast_expression *owner, unsigned int field); +ast_member* ast_member_new(lex_ctx ctx, ast_expression *owner, unsigned int field, const char *name); void ast_member_delete(ast_member*); bool ast_member_codegen(ast_member*, ast_function*, bool lvalue, ir_value**); @@ -398,9 +401,6 @@ struct ast_ternary_s /* It's all just 'expressions', since an ast_block is one too. */ ast_expression *on_true; ast_expression *on_false; - /* After a ternary expression we find ourselves in a new IR block - * and start with a PHI node */ - ir_value *phi_out; }; ast_ternary* ast_ternary_new(lex_ctx ctx, ast_expression *cond, ast_expression *ontrue, ast_expression *onfalse); void ast_ternary_delete(ast_ternary*); @@ -528,6 +528,8 @@ bool ast_block_set_type(ast_block*, ast_expression *from); bool ast_block_codegen(ast_block*, ast_function*, bool lvalue, ir_value**); void ast_block_collect(ast_block*, ast_expression*); +void ast_block_add_expr(ast_block*, ast_expression*); + /* Function * * Contains a list of blocks... at least in theory.