Clumsy hack to get bflow() to mark 'used' the second register in a pair when
authorDonn Seeley <donn@ucbvax.Berkeley.EDU>
Sun, 10 Jan 1988 16:25:52 +0000 (08:25 -0800)
committerDonn Seeley <donn@ucbvax.Berkeley.EDU>
Sun, 10 Jan 1988 16:25:52 +0000 (08:25 -0800)
the first register is 'shared' (read from as part of the pair, and written to
-- e.g. rN+1 in 'ediv X,rN,rN,Y').

SCCS-vsn: old/pcc/c2.tahoe/c21.c 1.5

usr/src/old/pcc/c2.tahoe/c21.c

index dfffe7c..776178d 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)c21.c      1.4 (Berkeley/CCI) %G%";
+static char sccsid[] = "@(#)c21.c      1.5 (Berkeley/CCI) %G%";
 #endif
 
 /*
 #endif
 
 /*
@@ -718,17 +718,20 @@ bflow(p)
        preg=regs+RT1; 
        while (*(cp1= *preg++)) {
                /* check for  r  */
        preg=regs+RT1; 
        while (*(cp1= *preg++)) {
                /* check for  r  */
-               if (lastrand!=cp1 && tempreg(cp1,r) && uses[r]==0) {
-                       uses[r]=p;
-                       cp2=regs[r]; *cp2++=p->subop;
-                       if ((p->op==SHAL || p->op==SHAR ||
-                           p->op==SHL || p->op==SHR) &&
-                           cp1==regs[RT1])
-                               cp2[-1] = BYTE;
-                       if (p->op==CBR && (p->subop==JBC || p->subop==JBS))
-                               cp2[-1] = LONG;
-                       if (p->op==MOVA && cp1==regs[RT2])
-                               cp2[-1]=LONG;
+               if (lastrand!=cp1 && tempreg(cp1,r)) {
+                       int isunused;
+                       if (isunused=(uses[r]==0)) {
+                               uses[r]=p;
+                               cp2=regs[r]; *cp2++=p->subop;
+                               if ((p->op==SHAL || p->op==SHAR ||
+                                   p->op==SHL || p->op==SHR) &&
+                                   cp1==regs[RT1])
+                                       cp2[-1] = BYTE;
+                               if (p->op==CBR && (p->subop==JBC || p->subop==JBS))
+                                       cp2[-1] = LONG;
+                               if (p->op==MOVA && cp1==regs[RT2])
+                                       cp2[-1]=LONG;
+                       }
                        /* ediv/emod's 2nd operand is quad */
                        if (((p->op==EDIV
 #ifdef EMOD
                        /* ediv/emod's 2nd operand is quad */
                        if (((p->op==EDIV
 #ifdef EMOD
@@ -736,10 +739,15 @@ bflow(p)
 #endif EMOD
                           ) && cp1==regs[RT2] || (dblflg&2)) &&
                           ++r<NUSE && uses[r]==0) {
 #endif EMOD
                           ) && cp1==regs[RT2] || (dblflg&2)) &&
                           ++r<NUSE && uses[r]==0) {
-                               *cp2=0;
+                               if (isunused)
+                                       *cp2=0;
                                uses[r]=p;
                                cp2=regs[r]; *cp2++=p->subop;
                                uses[r]=p;
                                cp2=regs[r]; *cp2++=p->subop;
+                               if (!isunused)
+                                       *cp2=0;
                        }
                        }
+                       if (!isunused)
+                               continue;
                        if (p->op==MOV || p->op==PUSH || p->op==CVT ||
                            p->op==MOVZ || p->op==COM || p->op==NEG ||
                            p->op==STF) {
                        if (p->op==MOV || p->op==PUSH || p->op==CVT ||
                            p->op==MOVZ || p->op==COM || p->op==NEG ||
                            p->op==STF) {