BSD 3 development
[unix-history] / usr / src / cmd / mip / match.c
index 701bce0..53e8460 100644 (file)
@@ -17,7 +17,7 @@ static int mamask[] = { /* masks for matching dope with shapes */
        LTYPE,          /* OPLEAF */
        TYFLG,          /* ASG OPLEAF is senseless */
        0,              /* OPANY */
        LTYPE,          /* OPLEAF */
        TYFLG,          /* ASG OPLEAF is senseless */
        0,              /* OPANY */
-       ASGOPFLG|ASGFLG,        /* ASG OPANY */
+       ASGOPFLG|ASGFLG,        /* ASG OPANY */
        LOGFLG,         /* OPLOG */
        TYFLG,          /* ASG OPLOG is senseless */
        FLOFLG,         /* OPFLOAT */
        LOGFLG,         /* OPLOG */
        TYFLG,          /* ASG OPLOG is senseless */
        FLOFLG,         /* OPFLOAT */
@@ -48,10 +48,18 @@ tshape( p, shape ) NODE *p; {
                case SZERO:
                case SONE:
                case SMONE:
                case SZERO:
                case SONE:
                case SMONE:
+               case SSCON:
+               case SCCON:
                        if( o != ICON || p->name[0] ) return(0);
                        if( p->lval == 0 && shape == SZERO ) return(1);
                        else if( p->lval == 1 && shape == SONE ) return(1);
                        else if( p->lval == -1 && shape == SMONE ) return(1);
                        if( o != ICON || p->name[0] ) return(0);
                        if( p->lval == 0 && shape == SZERO ) return(1);
                        else if( p->lval == 1 && shape == SONE ) return(1);
                        else if( p->lval == -1 && shape == SMONE ) return(1);
+                       else if( p->lval > -257 && p->lval < 256 && shape == SCCON ) return(1);
+                       else if( p->lval > -32769 && p->lval < 32768 && shape == SSCON ) return(1);
+                       else return(0);
+
+               case SSOREG:    /* non-indexed OREG */
+                       if( o == OREG && !R2TEST(p->rval) ) return(1);
                        else return(0);
 
                default:
                        else return(0);
 
                default:
@@ -208,7 +216,7 @@ setrew(){
                                                if( i==NAME || i==ICON || i==OREG ) break;
                                                else if( shltype( i, NIL ) ) break;
                                                }
                                                if( i==NAME || i==ICON || i==OREG ) break;
                                                else if( shltype( i, NIL ) ) break;
                                                }
-                                       else if( (dope[i]&(opmtemp|ASGFLG)) == opmtemp ) break;
+                                       else if( (dope[i]&(opmtemp|ASGFLG)) == opmtemp ) break;
                                        }
                                }
                        opptr[i] = q;
                                        }
                                }
                        opptr[i] = q;
@@ -242,7 +250,7 @@ match( p, cookie ) NODE *p; {
                                if( p->op!=NAME && p->op!=ICON && p->op!= OREG &&
                                        ! shltype( p->op, p ) ) continue;
                                }
                                if( p->op!=NAME && p->op!=ICON && p->op!= OREG &&
                                        ! shltype( p->op, p ) ) continue;
                                }
-                       else if( (dope[p->op]&(opmtemp|ASGFLG)) != opmtemp ) continue;
+                       else if( (dope[p->op]&(opmtemp|ASGFLG)) != opmtemp ) continue;
                        }
 
                if( !(q->visit & cookie ) ) continue;
                        }
 
                if( !(q->visit & cookie ) ) continue;
@@ -270,15 +278,11 @@ match( p, cookie ) NODE *p; {
        return(MNOPE);
        }
 
        return(MNOPE);
        }
 
-int rtyflg = 0;
-
 expand( p, cookie, cp ) NODE *p;  register char *cp; {
        /* generate code by interpreting table entry */
 
        CONSZ val;
 
 expand( p, cookie, cp ) NODE *p;  register char *cp; {
        /* generate code by interpreting table entry */
 
        CONSZ val;
 
-       rtyflg = 0;
-
        for( ; *cp; ++cp ){
                switch( *cp ){
 
        for( ; *cp; ++cp ){
                switch( *cp ){
 
@@ -286,11 +290,6 @@ expand( p, cookie, cp ) NODE *p;  register char *cp; {
                        PUTCHAR( *cp );
                        continue;  /* this is the usual case... */
 
                        PUTCHAR( *cp );
                        continue;  /* this is the usual case... */
 
-               case 'T':
-                       /* rewrite register type is suppressed */
-                       rtyflg = 1;
-                       continue;
-
                case 'Z':  /* special machine dependent operations */
                        zzzcode( p, *++cp );
                        continue;
                case 'Z':  /* special machine dependent operations */
                        zzzcode( p, *++cp );
                        continue;
@@ -300,15 +299,15 @@ expand( p, cookie, cp ) NODE *p;  register char *cp; {
                        continue;
 
                case 'S':  /* field size */
                        continue;
 
                case 'S':  /* field size */
-                       printf( "%d", fldsz );
+                       printf( "$%d", fldsz );
                        continue;
 
                case 'H':  /* field shift */
                        continue;
 
                case 'H':  /* field shift */
-                       printf( "%d", fldshf );
+                       printf( "$%d", fldshf );
                        continue;
 
                case 'M':  /* field mask */
                        continue;
 
                case 'M':  /* field mask */
-               case 'N':  /* complement of field mask */
+               case 'N':       /* complement of field mask */
                        val = 1;
                        val <<= fldsz;
                        --val;
                        val = 1;
                        val <<= fldsz;
                        --val;