From 666304deecc2d65c75b5633cce0669b08a1f821c Mon Sep 17 00:00:00 2001 From: Bernhard Urban Date: Wed, 9 Jun 2010 20:06:16 +0200 Subject: [PATCH] gesamt: registerbelegung fuer VARs doch wieder geaendert... passt jetzt so fuer alle testfaelle :) --- gesamt/chelper.h | 1 - gesamt/code.bfe | 4 ++-- gesamt/parser.y | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/gesamt/chelper.h b/gesamt/chelper.h index fcbc257..ea7481b 100644 --- a/gesamt/chelper.h +++ b/gesamt/chelper.h @@ -1,6 +1,5 @@ #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); diff --git a/gesamt/code.bfe b/gesamt/code.bfe index 14121c9..33979ba 100644 --- a/gesamt/code.bfe +++ b/gesamt/code.bfe @@ -195,7 +195,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 = VARBEGIN; j > VARBEGIN - bnode->vars; j--) { + for(j = bnode->soffset; j < bnode->soffset + bnode->vars; j++) { printf("\tpushq %%%s\n", param_reg(j)); } @@ -217,7 +217,7 @@ void make_call(struct treenode *bnode) } /* vars poppen */ - for(j = VARBEGIN+1 - bnode->vars; j < VARBEGIN+1; j++) { + for(j = bnode->soffset + bnode->vars - 1; j > bnode->soffset - 1; j--) { printf("\tpopq %%%s\n", param_reg(j)); } diff --git a/gesamt/parser.y b/gesamt/parser.y index 55ca382..4b45352 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, VARBEGIN - @Statement.vars_in@, -1); + @i @Statement.sout@ = tab_add_symbol(tab_clone(@Statement.sin@), @IDENT.name@, S_VAR, 1, @Statement.gparamges@ + @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, VARBEGIN - @Statement.vars_in@)); + @i @Statement.node@ = new_node(O_ASSIGN, @Expr.node@, new_param(O_ID, @IDENT.name@, TREENULL, TREENULL, @Statement.gparamges@ + @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