From e0b23bbaea31a3832723a9bc56bb425c83aa842f Mon Sep 17 00:00:00 2001 From: ceriel Date: Thu, 5 Feb 1987 19:20:54 +0000 Subject: [PATCH] Added code to kill regvar(...) --- util/ncgg/cgg.y | 17 ++++++++++++++--- util/ncgg/output.c | 18 ++++++++---------- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/util/ncgg/cgg.y b/util/ncgg/cgg.y index 8c1974e94..f61d58714 100644 --- a/util/ncgg/cgg.y +++ b/util/ncgg/cgg.y @@ -95,7 +95,7 @@ iocc_t iops[20]; %type register propno att_list_el_type tokenset_no %type adornlist optstar optuses optregvar regvartype optregvartype %type emarg tokarg subreg allreg optsecondstring -%type expr +%type expr regvarexpr %type tokeninstance %type optexpr optexact optstack %type tokenset @@ -770,7 +770,14 @@ kill_list_el $$->vi_int[1]=$3; cursetno = -1; } - ; + | regvarexpr + { NEW($$,struct varinfo); + $$->vi_next = 0; + $$->vi_int[0] = -($1.ex_index + 1); + $$->vi_int[1] = 0; + } + ; + allocates : /* empty */ { $$ = 0; nallreg=0;} @@ -1055,7 +1062,11 @@ expr { $$ = make_expr(TYPINT,EX_INREG,i_expr($3),0); } | regvartype { $$ = make_expr(TYPINT,EX_CON, $1+1, 0); } - | REGVAR '(' expr optregvartype ')' + | regvarexpr + ; + +regvarexpr + : REGVAR '(' expr optregvartype ')' { $$ = regvar_expr($3,$4); } ; diff --git a/util/ncgg/output.c b/util/ncgg/output.c index 0175fb12c..260b834bf 100644 --- a/util/ncgg/output.c +++ b/util/ncgg/output.c @@ -121,6 +121,9 @@ errorexit() { #define codeint(x) fprintf(code," %d",x) #define codenl() fprintf(code,"\n") #else +#define codenl() +#define code8nl(x) code8(x) + code8(x) { codeindex++; @@ -130,11 +133,6 @@ code8(x) { putc(x,code); } -code8nl(x) { - - code8(x); -} - code53(x,y) { code8(x+(y<<5)); @@ -151,8 +149,6 @@ codeint(x) { } } -codenl() { -} #endif int prevind=0; int npatbytes= -1; @@ -686,12 +682,14 @@ varinfo *kills,*allocates,*generates,*yields,*leaving; code53(DO_REMOVE,1); codeint(vp->vi_int[0]); codeint(vp->vi_int[1]); - codenl(); - } else { + } else if (vp->vi_int[1] >= 0) { code53(DO_REMOVE,0); codeint(vp->vi_int[0]); - codenl(); + } else { + code8(DO_RREMOVE); + codeint(vp->vi_int[0]); } + codenl(); } nremoves=0; for(vp=generates;vp!=0;vp=vp->vi_next) {