X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/0f4556f12c8f75078501c9d1338ae7648a97f975..95f51977ddc18faa2e212f30c00a39540b39f325:/usr/src/lib/mip/allo.c diff --git a/usr/src/lib/mip/allo.c b/usr/src/lib/mip/allo.c index 41d2c9c7b3..ba1fa423ba 100644 --- a/usr/src/lib/mip/allo.c +++ b/usr/src/lib/mip/allo.c @@ -1,5 +1,8 @@ -static char *sccsid ="%W% (Berkeley) %G%"; -# include "mfile2" +#ifndef lint +static char *sccsid ="@(#)allo.c 4.8 (Berkeley) 1/8/86"; +#endif lint + +# include "pass2.h" NODE resc[3]; @@ -29,8 +32,6 @@ allo0(){ /* free everything */ } # endif -# define TBUSY 01000 - # ifndef ALLO allo( p, q ) NODE *p; struct optab *q; { @@ -197,8 +198,23 @@ usable( p, n, r ) NODE *p; { else { if( n & NBMASK ) return(0); } - if( (n&NAMASK) && (szty(p->in.type) == 2) ){ /* only do the pairing for real regs */ + /* + * Some special cases that require register pairs... + * Have to check for ==, <=, etc. because the result is type int + * but need a register pair temp if either side is wide. + * For +=, *= etc. where lhs is narrow and rhs is wide, the temp + * register must be wide. + */ + if( (n&NAMASK) && + (szty(p->in.type) == 2 || + (logop(p->in.op) && (szty(p->in.left->in.type) == 2 || + szty(p->in.right->in.type) == 2)) || + (asgop(p->in.op) && szty(p->in.right->in.type) == 2 && + szty(p->in.left->in.type) == 1)) + ){ +#ifndef NOEVENODD if( r&01 ) return(0); +#endif if( !istreg(r+1) ) return( 0 ); if( busy[r+1] > 1 ) return( 0 ); if( busy[r] == 0 && busy[r+1] == 0 || @@ -292,7 +308,11 @@ rfree( r, t ) TWORD t; { if( istreg(r) ){ if( --busy[r] < 0 ) cerror( "register overfreed"); if( szty(t) == 2 ){ +#ifdef NOEVENODD + if( istreg(r) ^ istreg(r+1) ) cerror( "illegal free" ); +#else if( (r&01) || (istreg(r)^istreg(r+1)) ) cerror( "illegal free" ); +#endif if( --busy[r+1] < 0 ) cerror( "register overfreed" ); } } @@ -313,7 +333,11 @@ rbusy(r,t) TWORD t; { if( istreg(r) ) ++busy[r]; if( szty(t) == 2 ){ if( istreg(r+1) ) ++busy[r+1]; +#ifdef NOEVENODD + if( istreg(r) ^ istreg(r+1) ) cerror( "illegal register pair freed" ); +#else if( (r&01) || (istreg(r)^istreg(r+1)) ) cerror( "illegal register pair freed" ); +#endif } } # endif @@ -461,7 +485,9 @@ reclaim( p, rw, cookie ) NODE *p; { /* the "T" command in match supresses this type changing */ if( p->in.type == CHAR || p->in.type == SHORT ) p->in.type = INT; else if( p->in.type == UCHAR || p->in.type == USHORT ) p->in.type = UNSIGNED; +#if !defined(FORT) && !defined(SPRECC) else if( p->in.type == FLOAT ) p->in.type = DOUBLE; +#endif } if( ! (p->in.rall & MUSTDO ) ) return; /* unless necessary, ignore it */ i = p->in.rall & ~MUSTDO; @@ -488,6 +514,7 @@ reclaim( p, rw, cookie ) NODE *p; { } +#ifndef ncopy ncopy( q, p ) NODE *p, *q; { /* copy the contents of p into q, without any feeling for the contents */ @@ -511,6 +538,7 @@ ncopy( q, p ) NODE *p, *q; { #endif } +#endif NODE * tcopy( p ) register NODE *p; {