Added code to kill regvar(...)

This commit is contained in:
ceriel 1987-02-05 19:20:54 +00:00
parent b11e35b7d4
commit e0b23bbaea
2 changed files with 22 additions and 13 deletions

View file

@ -95,7 +95,7 @@ iocc_t iops[20];
%type <yy_int> register propno att_list_el_type tokenset_no %type <yy_int> register propno att_list_el_type tokenset_no
%type <yy_int> adornlist optstar optuses optregvar regvartype optregvartype %type <yy_int> adornlist optstar optuses optregvar regvartype optregvartype
%type <yy_int> emarg tokarg subreg allreg optsecondstring %type <yy_int> emarg tokarg subreg allreg optsecondstring
%type <yy_expr> expr %type <yy_expr> expr regvarexpr
%type <yy_iocc> tokeninstance %type <yy_iocc> tokeninstance
%type <yy_int> optexpr optexact optstack %type <yy_int> optexpr optexact optstack
%type <yy_set> tokenset %type <yy_set> tokenset
@ -770,7 +770,14 @@ kill_list_el
$$->vi_int[1]=$3; $$->vi_int[1]=$3;
cursetno = -1; cursetno = -1;
} }
| regvarexpr
{ NEW($$,struct varinfo);
$$->vi_next = 0;
$$->vi_int[0] = -($1.ex_index + 1);
$$->vi_int[1] = 0;
}
; ;
allocates allocates
: /* empty */ : /* empty */
{ $$ = 0; nallreg=0;} { $$ = 0; nallreg=0;}
@ -1055,7 +1062,11 @@ expr
{ $$ = make_expr(TYPINT,EX_INREG,i_expr($3),0); } { $$ = make_expr(TYPINT,EX_INREG,i_expr($3),0); }
| regvartype | regvartype
{ $$ = make_expr(TYPINT,EX_CON, $1+1, 0); } { $$ = make_expr(TYPINT,EX_CON, $1+1, 0); }
| REGVAR '(' expr optregvartype ')' | regvarexpr
;
regvarexpr
: REGVAR '(' expr optregvartype ')'
{ $$ = regvar_expr($3,$4); } { $$ = regvar_expr($3,$4); }
; ;

View file

@ -121,6 +121,9 @@ errorexit() {
#define codeint(x) fprintf(code," %d",x) #define codeint(x) fprintf(code," %d",x)
#define codenl() fprintf(code,"\n") #define codenl() fprintf(code,"\n")
#else #else
#define codenl()
#define code8nl(x) code8(x)
code8(x) { code8(x) {
codeindex++; codeindex++;
@ -130,11 +133,6 @@ code8(x) {
putc(x,code); putc(x,code);
} }
code8nl(x) {
code8(x);
}
code53(x,y) { code53(x,y) {
code8(x+(y<<5)); code8(x+(y<<5));
@ -151,8 +149,6 @@ codeint(x) {
} }
} }
codenl() {
}
#endif #endif
int prevind=0; int prevind=0;
int npatbytes= -1; int npatbytes= -1;
@ -686,12 +682,14 @@ varinfo *kills,*allocates,*generates,*yields,*leaving;
code53(DO_REMOVE,1); code53(DO_REMOVE,1);
codeint(vp->vi_int[0]); codeint(vp->vi_int[0]);
codeint(vp->vi_int[1]); codeint(vp->vi_int[1]);
codenl(); } else if (vp->vi_int[1] >= 0) {
} else {
code53(DO_REMOVE,0); code53(DO_REMOVE,0);
codeint(vp->vi_int[0]); codeint(vp->vi_int[0]);
codenl(); } else {
code8(DO_RREMOVE);
codeint(vp->vi_int[0]);
} }
codenl();
} }
nremoves=0; nremoves=0;
for(vp=generates;vp!=0;vp=vp->vi_next) { for(vp=generates;vp!=0;vp=vp->vi_next) {