aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gen_code.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/gen_code.c b/gen_code.c
index e967929..55bc05a 100644
--- a/gen_code.c
+++ b/gen_code.c
@@ -4,6 +4,9 @@
#include <string.h>
#include "gen_code.h"
#include "pc.h"
+#include "scope.h"
+
+scope *cur_scope;
#define REG_SWAP {\
char *tmp_reg_swap = *reg_ptr;\
@@ -139,8 +142,11 @@ ptree *t;
switch (t->type){
case ASSIGNOP:
if (t->l->ret_type == INT) {
+ gen_label(t->r);
+ print_tree(t);
GEN_EXPR(t->r);
- fprintf(stdout, "mov %s, ADDR\n", *reg_ptr);
+ fprintf(stdout, "mov %s, %d(%%rbp)\n", *reg_ptr,
+ - t->l->attr.nval->offset * OFFSET_SIZE);
} else {
fprintf(stderr, "ASSIGN (REAL) %s\n", t->l->attr.nval->name);
}