diff options
-rw-r--r-- | gen_code.c | 3 | ||||
-rw-r--r-- | node.h | 1 | ||||
-rw-r--r-- | pc.h | 2 | ||||
-rw-r--r-- | pc.y | 2 | ||||
-rw-r--r-- | scope.c | 2 | ||||
-rw-r--r-- | scope.h | 1 |
6 files changed, 10 insertions, 1 deletions
@@ -123,7 +123,8 @@ ptree *t; switch (t->type){ case ASSIGNOP: if (t->l->ret_type == INT) { - fprintf(stderr, "ASSIGN (INT) %s\n", t->l->attr.nval->name); + GEN_EXPR(t->r); + fprintf(stdout, "mov %s, ADDR\n", *reg_ptr); } else { fprintf(stderr, "ASSIGN (REAL) %s\n", t->l->attr.nval->name); } @@ -17,6 +17,7 @@ typedef struct node_s { char *name; struct node_s *next; int var_type; + int offset; struct fi* func_info; struct ai* array_info; @@ -13,5 +13,7 @@ int yyerror(char*); int count_args(ptree*); int set_func_types(ptree*, int*, int); int get_call_types(ptree*, int*, int); + +#define OFFSET_SIZE 8 #endif @@ -133,6 +133,7 @@ id_list check_id(cur_scope, $1); tmp = scope_insert(cur_scope, $1); + tmp->offset = cur_scope->offset++; $$ = mkid(tmp); } |id_list ',' ID @@ -141,6 +142,7 @@ id_list check_id(cur_scope, $3); tmp = scope_insert(cur_scope, $3); + tmp->offset = cur_scope->offset++; $$ = mktree(LIST, $1, mkid(tmp)); } ; @@ -21,6 +21,8 @@ scope* mkscope() p->prev = NULL; p->ret_var= NULL; + p->offset = 2; + return p; } @@ -9,6 +9,7 @@ typedef struct hash { node* table[HASH_SIZE]; struct hash *prev; node* ret_var; + int offset; } scope; scope* mkscope(); |