For DIAGOPT, change outshort(patno) to outshort(lino - 1).
authorGeorge Koehler <xkernigh@netscape.net>
Sun, 29 Oct 2017 18:18:47 +0000 (14:18 -0400)
committerGeorge Koehler <xkernigh@netscape.net>
Sun, 29 Oct 2017 18:18:47 +0000 (14:18 -0400)
This is more useful when looking for patterns; lino - 1 is probably
the line number in the patterns file.  DIAGOPT is off by default but
one can edit optim.h to enable it.

The other changes just clean up whitespace.

util/opt/mktab.y

index e2a6c0b..7208919 100644 (file)
@@ -87,7 +87,7 @@ pattern       :
                          if (patCBO) {
                                register int i;
 
-                               if (! rplCBO) {
+                               if (! rplCBO) {
                                        yyerror("No CBO in replacement");
                                }
                                for (i=0; i<sizeof(CBO_instrs)/sizeof(int); i++) {
@@ -153,8 +153,7 @@ optexpr     :       /* empty */
                        { $$ = 0; }
        |       expr
        ;
-expr   
-       :       '$' argno
+expr   :       '$' argno
                        { $$ = lookup(0,EX_ARG,$2,0); }
        |       NUMBER
                        { $$ = lookup(0,EX_CON,(int)(short)$1,0); }
@@ -382,25 +381,26 @@ outpat(exprno, instrno)
 {
        register int i;
 
-       outbyte(0); outshort(prevind); prevind=curind-3;
-       out(patlen);
-       for (i=0;i<patlen;i++) {
+       outbyte(0); outshort(prevind); prevind=curind-3;
+       out(patlen);
+       for (i=0;i<patlen;i++) {
                if (patmnem[i] == op_CBO) outbyte(instrno);
                else outbyte(patmnem[i]);
        }
-       out(exprno);
-       out(rpllen);
-       for (i=0;i<rpllen;i++) {
+       out(exprno);
+       out(rpllen);
+       for (i=0;i<rpllen;i++) {
                if (rplmnem[i] == op_CBO) outbyte(instrno);
                else outbyte(rplmnem[i]);
                out(rplexpr[i]);
-       }
+       }
 #ifdef DIAGOPT
-       outshort(patno);
+       /* outshort(patno); */
+       outshort(lino - 1);
 #endif
-       patno++;
-       printf("\n");
-       if (patlen>maxpatlen) maxpatlen=patlen;
+       patno++;
+       printf("\n");
+       if (patlen>maxpatlen) maxpatlen=patlen;
 }
 
 outbyte(b) {
@@ -424,4 +424,3 @@ out(w) {
                outshort(w);
        }
 }
-