For DIAGOPT, change outshort(patno) to outshort(lino - 1).

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.
This commit is contained in:
George Koehler 2017-10-29 14:18:47 -04:00
parent c567532eee
commit cb8b28c088

View file

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