usr.bin/f77/pass1.vax/bb.c
/*
 *  eliminates copy statements of the form T1 = T2 from the intermediate
 *  code, where T1 and T2 are temporary variables which are each
 *  set only once;  eliminates the copy statement and replaces each
 *  use of T1 by T2 (T1 is therefore totally eliminated).
 */
eliminates copy statements of the form T1 = T2 from the intermediate
code, where T1 and T2 are temporary variables which are each
set only once;  eliminates the copy statement and replaces each
use of T1 by T2 (T1 is therefore totally eliminated).
eliminates copy statements of the form T1 = T2 from the intermediate code where T1 and T2 are temporary variables which are each set only once ; eliminates the copy statement and replaces each use of T1 by T2 ( T1 is therefore totally eliminated ) .
LOCAL copyprop ()
{
Slotp	sl,nextsl;
expptr	expr;
Tempp	lp,rp;
for (sl = firstslot; sl; sl = sl->next)
	sl->expr = rmcommaop (sl->expr,sl);
prop1count = prop2count = 0;
findcopies ();
for (sl = firstslot; sl; sl = nextsl)
	{
	nextsl = sl->next;
	expr = sl->expr;
	if ((sl->type == SKFRTEMP) && subfor (expr))
		{
		delslot (sl);
		expr = ENULL;
		}
	else if (expr && expr->tag == TEXPR &&
			expr->exprblock.opcode == OPASSIGN)
		{
		lp = (Tempp) expr->exprblock.leftp;
		rp = (Tempp) expr->exprblock.rightp;
		if (lp->tag == TTEMP && rp->tag == TTEMP)
			if (subfor(lp->memalloc) == rp->memalloc
					&& !subfor (rp->memalloc))
				{
				frexpr (expr);
				expr = sl->expr = ENULL;
				prop1count++;
				}
		}
	propagate (expr);
	}
if (debugflag[0])
	fprintf (diagfile,
	    "%d temporarie%s replaced by copy propagation (%d use%s)\n",
		prop1count,(prop1count==1 ? "" : "s"),
		prop2count,(prop2count==1 ? "" : "s") );
}
LOCAL copyprop ( ) { Slotp sl , nextsl ; expptr expr ; Tempp lp , rp ; for ( sl = firstslot ; sl ; sl = sl -> next ) sl -> expr = rmcommaop ( sl -> expr , sl ) ; prop1count = prop2count = 0 ; findcopies ( ) ; for ( sl = firstslot ; sl ; sl = nextsl ) { nextsl = sl -> next ; expr = sl -> expr ; if ( ( sl -> type == SKFRTEMP ) && subfor ( expr ) ) { delslot ( sl ) ; expr = ENULL ; } else if ( expr && expr -> tag == TEXPR && expr -> exprblock . opcode == OPASSIGN ) { lp = ( Tempp ) expr -> exprblock . leftp ; rp = ( Tempp ) expr -> exprblock . rightp ; if ( lp -> tag == TTEMP && rp -> tag == TTEMP ) if ( subfor ( lp -> memalloc ) == rp -> memalloc && ! subfor ( rp -> memalloc ) ) { frexpr ( expr ) ; expr = sl -> expr = ENULL ; prop1count ++ ; } } propagate ( expr ) ; } if ( debugflag [ 0 ] ) fprintf ( diagfile , " \n " , prop1count , ( prop1count == 1 ? " " : " " ) , prop2count , ( prop2count == 1 ? " " : " " ) ) ; }
eliminates copy statements of the form T1 = T2 from the intermediate
  code, where T1 and T2 are temporary variables which are each
  set only once;  eliminates the copy statement and replaces each
  use of T1 by T2 (T1 is therefore totally eliminated).
eliminates copy statements of the form T1 = T2 from the intermediate code where T1 and T2 are temporary variables which are each set only once ; eliminates the copy statement and replaces each use of T1 by T2 ( T1 is therefore totally eliminated ) .