From 7e2296760212c13df37d53f941e8abd980a069c2 Mon Sep 17 00:00:00 2001 From: Bernhard Urban Date: Sun, 30 May 2010 00:52:48 +0200 Subject: [PATCH] codeb: iburg austricksen... --- codeb/code.bfe | 6 +++--- codeb/parser.y | 4 ++-- codeb/symtable.c | 3 +++ 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/codeb/code.bfe b/codeb/code.bfe index 3847d7a..cfd51ef 100644 --- a/codeb/code.bfe +++ b/codeb/code.bfe @@ -183,9 +183,9 @@ begin: ret # 0 # printf("\n"); begin: assign # 0 # begin: ifstat # 0 # -assign: O_ASSIGN(O_ID, expr) # 1 # KIDREG2PARM(0); printf("\tmovq %%%s, %%%s\n", BN_REG, KID_REG(0)); -assign: O_ASSIGN(O_ID, O_ID) # 1 # KIDREG2PARM(0); KIDREG2PARM(1); printf("\tmovq %%%s, %%%s\n", KID_REG(1), KID_REG(0)); -assign: O_ASSIGN(O_FIELD(expr), expr) # 1 # KIDKIDREG2PARM(0,0); printf("\tmovq %%%s, %d(%%%s)\n", BN_REG, bnode->kids[0]->soffset * 8, KIDKID_REG(0,0)); +assign: O_ASSIGN(expr, O_ID) # 1 # KIDREG2PARM(1); printf("\tmovq %%%s, %%%s\n", BN_REG, KID_REG(1)); +assign: O_ASSIGN(O_ID, O_ID) # 1 # KIDREG2PARM(1); KIDREG2PARM(0); printf("\tmovq %%%s, %%%s\n", KID_REG(0), KID_REG(1)); +assign: O_ASSIGN(expr, O_FIELD(expr)) # 1 # KIDKIDREG2PARM(1,0); printf("\tmovq %%%s, %d(%%%s)\n", BN_REG, bnode->kids[1]->soffset * 8, KIDKID_REG(1,0)); ret: O_RET(retexpr) # 2 # printf("\t//o_ret(expr)\n"); move(BN_REG, "rax"); func_footer(); diff --git a/codeb/parser.y b/codeb/parser.y index 49602fc..9205550 100644 --- a/codeb/parser.y +++ b/codeb/parser.y @@ -153,7 +153,7 @@ Statement: lblcountinout() xxputsin(@Lexpr.s@,) xxputsin(@Expr.s@,) - @i @Statement.node@ = new_node(O_ASSIGN, @Lexpr.node@, @Expr.node@); + @i @Statement.node@ = new_node(O_ASSIGN, @Expr.node@, @Lexpr.node@); @i @Statement.vars@ = 0; @reg @Statement.node@->reg = @Expr.node@->reg = next_reg((char *)NULL, @Expr.gparamges@); @@ -168,7 +168,7 @@ Statement: lblcountinout() xxputsin(@Expr.s@,) - @i @Statement.node@ = new_node(O_ASSIGN, new_param(O_ID, @IDENT.name@, TREENULL, TREENULL, @Statement.gparamges@), @Expr.node@); + @i @Statement.node@ = new_node(O_ASSIGN, @Expr.node@, new_param(O_ID, @IDENT.name@, TREENULL, TREENULL, @Statement.gparamges@)); @i @Statement.vars@ = 1; @reg @Statement.node@->reg = @Expr.node@->reg = next_reg((char *)NULL, @Expr.gparamges@); diff --git a/codeb/symtable.c b/codeb/symtable.c index 4776240..89db8c0 100644 --- a/codeb/symtable.c +++ b/codeb/symtable.c @@ -35,10 +35,13 @@ struct symbol *tab_add_symbol(struct symbol *tab, char *ident, short type, short fprintf(stderr, "tab_add_symbol: tab(%08X), ident(%s), type(%i), check(%i), param_index(%i), soffset(%i)\n", tab, ident, type, check, param_index, soffset); #endif +#if 0 + /* kann statt return -3, -4 verursachen... (z.b. codea_ag_snafu_01.3) */ if(param_index >= 6) { fprintf(stderr, "eine methode hat zu viele parameter (max. 6 inkl. this erlaubt)\n"); exit(4); } +#endif if(tab_lookup(tab, ident, type) != SYMNULL || (type == S_VAR && tab_lookup(tab, ident, S_PARM) != SYMNULL)) { if(check) { -- 2.25.1