mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-01-19 06:40:49 +00:00
codegen gets an lvalue flag now
This commit is contained in:
parent
4c165cbd07
commit
3a94e962ae
2 changed files with 11 additions and 13 deletions
10
ast.c
10
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;
|
||||
}
|
||||
|
|
14
ast.h
14
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
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue