gesamt: bugfix fuer gen_id_eno() und vars von hinten belegen
authorBernhard Urban <lewurm@gmail.com>
Mon, 7 Jun 2010 07:42:57 +0000 (09:42 +0200)
committerBernhard Urban <lewurm@gmail.com>
Mon, 7 Jun 2010 07:42:57 +0000 (09:42 +0200)
gesamt/code.bfe
gesamt/parser.y

index 1dc1e3f75e4546bf2e0d80f70fe12981cb312ed7..68d6089d3fa4d0b62cc39858496073fc20ec7c30 100644 (file)
@@ -43,8 +43,11 @@ void gen_id_eno(struct treenode *bnode)
 {
        printf("\t//gen_id_eno\n");
        KIDKIDREG2PARM(1,0);
-       printf("\taddq %%%s, %%%s\n", KIDKID_REG(1,0), KIDKID_REG(1,1));
+       KIDKIDREG2PARM(1,1);
+       KIDREG2PARM(0);
+       move(KID_REG(0), BN_REG);
        printf("\tsubq %%%s, %%%s\n", KIDKID_REG(1,1), BN_REG);
+       printf("\tsubq %%%s, %%%s\n", KIDKID_REG(1,0), BN_REG);
 }
 
 void gen_e_field(struct treenode *bnode, char *instr)
@@ -192,7 +195,7 @@ void make_call(struct treenode *bnode)
                printf("\txchg %%%s, %d(%%rsp)\n", param_reg(j), j*8);
        }
        /* vars pushen */
-       for(j = bnode->paramges; j < bnode->paramges + bnode->vars; j++) {
+       for(j = 6; j > 6 - bnode->vars - 1; j--) {
                printf("\tpushq %%%s\n", param_reg(j));
        }
 
@@ -213,16 +216,12 @@ void make_call(struct treenode *bnode)
        }
 
        /* vars poppen */
-       for(j = bnode->paramges + bnode->vars - 1; j >= bnode->paramges; j--) {
+       for(j = 6 - bnode->vars; j < 6+1; j++) {
                printf("\tpopq %%%s\n", param_reg(j));
        }
 
        /* params poppen */
-#if 0
-       for(j = bnode->soffset - 1; j >= 0; j--) {
-#else
        for(j = 0; j < bnode->soffset; j++) {
-#endif
                printf("\tpopq %%%s\n", param_reg(j));
        }
 }
index 20d0a5152c2b444dad69ae0f95b30209c4c2af3f..2d42baaaec617b9d9ccd1fc00d8869ddd8e3ea7e 100644 (file)
@@ -178,14 +178,14 @@ Statement:
          @{
                /* tab_clone ist hier noetig, vgl. folgendes statement
                 * > var x := x - 1; */
-               @i @Statement.sout@ = tab_add_symbol(tab_clone(@Statement.sin@), @IDENT.name@, S_VAR, 1, @Statement.gparamges@ + @Statement.vars_in@, -1);
+               @i @Statement.sout@ = tab_add_symbol(tab_clone(@Statement.sin@), @IDENT.name@, S_VAR, 1, 6 - @Statement.vars_in@, -1);
                lblcountinout()
 
                @i @Statement.vars_out@ = @Statement.vars_in@ + 1;
 
                xxputsin(@Expr.s@,)
 
-               @i @Statement.node@ = new_node(O_ASSIGN, @Expr.node@, new_param(O_ID, @IDENT.name@, TREENULL, TREENULL, @Statement.gparamges@ + @Statement.vars_in@));
+               @i @Statement.node@ = new_node(O_ASSIGN, @Expr.node@, new_param(O_ID, @IDENT.name@, TREENULL, TREENULL, 6 - @Statement.vars_in@));
                @reg @Statement.node@->reg = @Expr.node@->reg = next_reg((char *)NULL, @Expr.gparamges@);
 
                @gen write_tree(@Statement.node@, 0); burm_label(@Statement.node@); burm_reduce(@Statement.node@, 1);