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
-static char sccsid[] = "@(#)c21.c 1.4 (Berkeley/CCI) %G%";
+static char sccsid[] = "@(#)c21.c 1.5 (Berkeley/CCI) %G%";
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
#endif EMOD
) && cp1==regs[RT2] || (dblflg&2)) &&
++r<NUSE && uses[r]==0) {
#endif EMOD
) && cp1==regs[RT2] || (dblflg&2)) &&
++r<NUSE && uses[r]==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) {