]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
codegen gets an lvalue flag now
authorWolfgang Bumiller <wolfgang.linux@bumiller.com>
Tue, 1 May 2012 13:14:44 +0000 (15:14 +0200)
committerWolfgang Bumiller <wolfgang.linux@bumiller.com>
Tue, 1 May 2012 13:14:44 +0000 (15:14 +0200)
ast.c
ast.h

diff --git a/ast.c b/ast.c
index 3595524c83d8f7af39b1856e793c9608af5a50cb..e5492e40a3520d5542c7d9509b4eb5ac3070d89a 100644 (file)
--- 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 cd73230bf09f90df3ae3e60af181babbf97cf8c3..1437de84fb155c0a63f8190c5087cce55ab9621d 100644 (file)
--- 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
  *