From 6aa10df8764b244c11269262eb3af806b0d0b82f Mon Sep 17 00:00:00 2001 From: Bernhard Urban Date: Mon, 7 Jun 2010 17:05:44 +0200 Subject: [PATCH] gesamt: andere VAR belegung --- gesamt/chelper.h | 2 ++ gesamt/code.bfe | 4 ++-- gesamt/parser.y | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/gesamt/chelper.h b/gesamt/chelper.h index 70870ee..fcbc257 100644 --- a/gesamt/chelper.h +++ b/gesamt/chelper.h @@ -1,5 +1,7 @@ #ifndef __CHELPER_H #define __CHELPER_H +#define VARBEGIN 5 + void func_header(char *s, int vars, int parms, int call); char *get_func_name(void); void func_footer(void); diff --git a/gesamt/code.bfe b/gesamt/code.bfe index 4bd1e83..e0a2e78 100644 --- a/gesamt/code.bfe +++ b/gesamt/code.bfe @@ -198,7 +198,7 @@ void make_call(struct treenode *bnode) printf("\txchg %%%s, %d(%%rsp)\n", param_reg(j), j*8); } printf("\t//vars pushen\n"); - for(j = 6; j > 6 - bnode->vars; j--) { + for(j = VARBEGIN; j > VARBEGIN - bnode->vars; j--) { printf("\tpushq %%%s\n", param_reg(j)); } @@ -220,7 +220,7 @@ void make_call(struct treenode *bnode) } /* vars poppen */ - for(j = 7 - bnode->vars; j < 7; j++) { + for(j = VARBEGIN+1 - bnode->vars; j < VARBEGIN+1; j++) { printf("\tpopq %%%s\n", param_reg(j)); } diff --git a/gesamt/parser.y b/gesamt/parser.y index 1d7a7c6..c5271db 100644 --- a/gesamt/parser.y +++ b/gesamt/parser.y @@ -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, 6 - @Statement.vars_in@, -1); + @i @Statement.sout@ = tab_add_symbol(tab_clone(@Statement.sin@), @IDENT.name@, S_VAR, 1, VARBEGIN - @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, 6 - @Statement.vars_in@)); + @i @Statement.node@ = new_node(O_ASSIGN, @Expr.node@, new_param(O_ID, @IDENT.name@, TREENULL, TREENULL, VARBEGIN - @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); -- 2.25.1