From: Wolfgang Bumiller Date: Tue, 1 May 2012 13:14:44 +0000 (+0200) Subject: codegen gets an lvalue flag now X-Git-Tag: 0.1-rc1~534 X-Git-Url: https://git.xonotic.org/?a=commitdiff_plain;h=3a94e962ae29cb34175738343379a266c1cfcc63;p=xonotic%2Fgmqcc.git codegen gets an lvalue flag now --- diff --git a/ast.c b/ast.c index 3595524..e5492e4 100644 --- a/ast.c +++ b/ast.c @@ -249,7 +249,7 @@ void ast_function_delete(ast_function *self) /* AST codegen aprt */ -bool ast_value_codegen(ast_value *self, ast_function *func, ir_value **out) +bool ast_value_codegen(ast_value *self, ast_function *func, bool lvalue, ir_value **out) { /* NOTE: This is the codegen for a variable used in an expression. * It is not the codegen to generate the value. For this purpose, @@ -323,22 +323,22 @@ bool ast_function_codegen(ast_function *self, ir_builder *ir) return false; } -bool ast_block_codegen(ast_block *self, ast_function *func, ir_value **out) +bool ast_block_codegen(ast_block *self, ast_function *func, bool lvalue, ir_value **out) { return false; } -bool ast_store_codegen(ast_store *self, ast_function *func, ir_value **out) +bool ast_store_codegen(ast_store *self, ast_function *func, bool lvalue, ir_value **out) { return false; } -bool ast_binary_codegen(ast_binary *self, ast_function *func, ir_value **out) +bool ast_binary_codegen(ast_binary *self, ast_function *func, bool lvalue, ir_value **out) { return false; } -bool ast_entfield_codegen(ast_entfield *self, ast_function *func, ir_value **out) +bool ast_entfield_codegen(ast_entfield *self, ast_function *func, bool lvalue, ir_value **out) { return false; } diff --git a/ast.h b/ast.h index cd73230..1437de8 100644 --- a/ast.h +++ b/ast.h @@ -67,6 +67,7 @@ typedef struct */ typedef bool ast_expression_codegen(ast_expression*, ast_function*, + bool lvalue, ir_value**); typedef struct { @@ -113,7 +114,7 @@ void ast_value_delete(ast_value*); bool ast_value_set_name(ast_value*, const char *name); -bool ast_value_codegen(ast_value*, ast_function*, ir_value**); +bool ast_value_codegen(ast_value*, ast_function*, bool lvalue, ir_value**); /* Binary * @@ -133,10 +134,7 @@ ast_binary* ast_binary_new(lex_ctx ctx, ast_expression *right); void ast_binary_delete(ast_binary*); -/* hmm, seperate functions? -bool ast_block_codegen(ast_block*, ast_function*, ir_value**); - */ -bool ast_binary_codegen(ast_binary*, ast_function*, ir_value**); +bool ast_binary_codegen(ast_binary*, ast_function*, bool lvalue, ir_value**); /* Entity-field * @@ -162,7 +160,7 @@ struct ast_entfield_s ast_entfield* ast_entfield_new(lex_ctx ctx, ast_expression *entity, ast_expression *field); void ast_entfield_delete(ast_entfield*); -bool ast_entfield_codegen(ast_entfield*, ast_function*, ir_value**); +bool ast_entfield_codegen(ast_entfield*, ast_function*, bool lvalue, ir_value**); /* Store * @@ -180,7 +178,7 @@ ast_store* ast_store_new(lex_ctx ctx, int op, ast_value *d, ast_expression *s); void ast_store_delete(ast_store*); -bool ast_store_codegen(ast_store*, ast_function*, ir_value**); +bool ast_store_codegen(ast_store*, ast_function*, bool lvalue, ir_value**); /* Blocks * @@ -198,7 +196,7 @@ void ast_block_delete(ast_block*); MEM_VECTOR_PROTO(ast_block, ast_value*, locals); MEM_VECTOR_PROTO(ast_block, ast_expression*, exprs); -bool ast_block_codegen(ast_block*, ast_function*, ir_value**); +bool ast_block_codegen(ast_block*, ast_function*, bool lvalue, ir_value**); /* Function *