Added a command to kill a register

This commit is contained in:
ceriel 1989-10-26 15:41:38 +00:00
parent adc8fc6e9e
commit 74546bd985
3 changed files with 5 additions and 1 deletions

View file

@ -37,6 +37,7 @@
#define DO_DLINE 21 #define DO_DLINE 21
#define DO_SETCC 22 #define DO_SETCC 22
#define DO_TOSTACK 23 #define DO_TOSTACK 23
#define DO_KILLREG 24
#ifndef MAXATT #ifndef MAXATT
#define MAXATT TOKENSIZE #define MAXATT TOKENSIZE

View file

@ -482,12 +482,14 @@ normalfailed: if (stackpad!=tokpatlen) {
rp->r_contents.t_token=0; rp->r_contents.t_token=0;
break; break;
} }
case DO_KILLREG:
case DO_RREMOVE: { /* register remove */ case DO_RREMOVE: { /* register remove */
register i; register i;
int nodeno; int nodeno;
token_p tp; token_p tp;
tkdef_p tdp; tkdef_p tdp;
result_t result; result_t result;
int dokill = (codep[-1] & 037) == DO_KILLREG;
DEBUG("RREMOVE"); DEBUG("RREMOVE");
getint(nodeno,codep); getint(nodeno,codep);
@ -495,6 +497,7 @@ normalfailed: if (stackpad!=tokpatlen) {
if (result.e_typ!=EV_REG) if (result.e_typ!=EV_REG)
break; break;
if ( in_stack(result.e_v.e_reg) ) BROKE() ; /* Check aside-stack */ if ( in_stack(result.e_v.e_reg) ) BROKE() ; /* Check aside-stack */
if (dokill) machregs[result.e_v.e_reg].r_contents.t_token = 0;
for (tp= &fakestack[stackheight-tokpatlen-1];tp>=&fakestack[0];tp--) for (tp= &fakestack[stackheight-tokpatlen-1];tp>=&fakestack[0];tp--)
if (tp->t_token==-1) { if (tp->t_token==-1) {
if(tp->t_att[0].ar==result.e_v.e_reg) if(tp->t_att[0].ar==result.e_v.e_reg)

View file

@ -716,7 +716,7 @@ varinfo *kills,*allocates,*generates,*yields,*leaving;
code53(DO_REMOVE,0); code53(DO_REMOVE,0);
codeint(vp->vi_int[0]); codeint(vp->vi_int[0]);
} else { } else {
code8(DO_RREMOVE); code8(DO_KILLREG);
codeint(-vp->vi_int[0] - 1); codeint(-vp->vi_int[0] - 1);
} }
codenl(); codenl();