fixed problem with temporary DEALLOCATES: sometimes a register was
authorceriel <none@none>
Fri, 15 Jul 1988 11:12:13 +0000 (11:12 +0000)
committerceriel <none@none>
Fri, 15 Jul 1988 11:12:13 +0000 (11:12 +0000)
used for stacking, that was only temporarily deallocated

mach/proto/ncg/codegen.c
mach/proto/ncg/equiv.c
mach/proto/ncg/reg.c
mach/proto/ncg/subr.c

index 6922301..9500a36 100644 (file)
@@ -569,7 +569,7 @@ normalfailed:       if (stackpad!=tokpatlen) {
                do {
                        npos=exactmatch=0;
                        for(rpp=reglist[propno];rp= *rpp; rpp++)
-                               if (getrefcount(rp-machregs)==0) {
+                               if (getrefcount(rp-machregs, FALSE)==0) {
                                        pos[npos++] = rp-machregs;
                                        if (eqtoken(&rp->r_contents,&token))
                                                exactmatch++;
@@ -651,7 +651,7 @@ normalfailed:       if (stackpad!=tokpatlen) {
                }
        } else {
                decision = forced;
-               if (getrefcount(decision)!=0)
+               if (getrefcount(decision, FALSE)!=0)
                        BROKE();
                token2.t_token = -1;
        }
index 82c05e9..ad1437f 100644 (file)
@@ -38,7 +38,7 @@ tuples(regls,nregneeded) rl_p *regls; {
 
        for (i=0;i<NREGS;i++) {
                regclass[i] = class++;
-               if (getrefcount(i) == 0) {
+               if (getrefcount(i, FALSE) == 0) {
                        for (j=0;j<i;j++) {
                                if (eqregclass(i,j) &&
                                    eqtoken(&machregs[i].r_contents,
index 9ebdb8b..89dc205 100644 (file)
@@ -40,7 +40,7 @@ chrefcount(regno,amount,tflag) {
 #endif
 }
 
-getrefcount(regno) {
+getrefcount(regno, tflag) {
        register struct reginfo *rp;
 #if MAXMEMBERS != 0
        register i,maxcount;
@@ -50,13 +50,13 @@ getrefcount(regno) {
 #if MAXMEMBERS!=0
        if (rp->r_members[0]==0)
 #endif
-               return(rp->r_refcount);
+               return(rp->r_refcount - (tflag ? rp->r_tcount : 0));
 #if MAXMEMBERS!=0
        else {
                maxcount=0;
                for (i=0;i<MAXMEMBERS;i++)
                        if (rp->r_members[i]!=0)
-                               maxcount=max(maxcount,getrefcount(rp->r_members[i]));
+                               maxcount=max(maxcount,getrefcount(rp->r_members[i], tflag));
                return(maxcount);
        }
 #endif
index 0f2905d..d7a4eec 100644 (file)
@@ -30,7 +30,7 @@ match(tp,tep,optexp) register token_p tp; register set_p tep; {
        if (tp->t_token == -1) {        /* register frame */
                bitno = tp->t_att[0].ar;
                if (tep->set_val[bitno>>4]&(1<<(bitno&017)))
-                       if (tep->set_val[0]&1 || getrefcount(tp->t_att[0].ar)<=1)
+                       if (tep->set_val[0]&1 || getrefcount(tp->t_att[0].ar, FALSE)<=1)
                                goto oklabel;
                return(0);
        } else {                /* token frame */
@@ -534,7 +534,7 @@ unsigned stackupto(limit,ply,toplevel) token_p limit; {
                                if (cp->c1_prop>=0) {
                                        for (rpp=reglist[cp->c1_prop];
                                               (rp = *rpp)!=0 &&
-                                              getrefcount(rp-machregs)!=0;
+                                              getrefcount(rp-machregs, TRUE)!=0;
                                                  rpp++)
                                                ;
                                        if (rp==0)