codegen gets an lvalue flag now

This commit is contained in:
Wolfgang Bumiller 2012-05-01 15:14:44 +02:00
parent 4c165cbd07
commit 3a94e962ae
2 changed files with 11 additions and 13 deletions

10
ast.c
View file

@ -249,7 +249,7 @@ void ast_function_delete(ast_function *self)
/* AST codegen aprt /* 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. /* NOTE: This is the codegen for a variable used in an expression.
* It is not the codegen to generate the value. For this purpose, * 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; 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; 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; 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; 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; return false;
} }

14
ast.h
View file

@ -67,6 +67,7 @@ typedef struct
*/ */
typedef bool ast_expression_codegen(ast_expression*, typedef bool ast_expression_codegen(ast_expression*,
ast_function*, ast_function*,
bool lvalue,
ir_value**); ir_value**);
typedef struct 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_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 /* Binary
* *
@ -133,10 +134,7 @@ ast_binary* ast_binary_new(lex_ctx ctx,
ast_expression *right); ast_expression *right);
void ast_binary_delete(ast_binary*); void ast_binary_delete(ast_binary*);
/* hmm, seperate functions? bool ast_binary_codegen(ast_binary*, ast_function*, bool lvalue, ir_value**);
bool ast_block_codegen(ast_block*, ast_function*, ir_value**);
*/
bool ast_binary_codegen(ast_binary*, ast_function*, ir_value**);
/* Entity-field /* Entity-field
* *
@ -162,7 +160,7 @@ struct ast_entfield_s
ast_entfield* ast_entfield_new(lex_ctx ctx, ast_expression *entity, ast_expression *field); ast_entfield* ast_entfield_new(lex_ctx ctx, ast_expression *entity, ast_expression *field);
void ast_entfield_delete(ast_entfield*); 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 /* Store
* *
@ -180,7 +178,7 @@ ast_store* ast_store_new(lex_ctx ctx, int op,
ast_value *d, ast_expression *s); ast_value *d, ast_expression *s);
void ast_store_delete(ast_store*); 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 /* 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_value*, locals);
MEM_VECTOR_PROTO(ast_block, ast_expression*, exprs); 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 /* Function
* *