Don't spam the output with debug information unless -v is set.

This commit is contained in:
David Given 2022-08-01 21:58:01 +02:00
parent 3757b4ad03
commit 3f64b7c8c1

View file

@ -21,6 +21,7 @@ static void initio(void);
static int eqregclass(int r1, int r2); static int eqregclass(int r1, int r2);
static void compueq(void); static void compueq(void);
static int want_verbose = 0;
char *myalloc(int n) char *myalloc(int n)
@ -297,6 +298,9 @@ int main(int argc, char *argv[])
case 'c': case 'c':
cname = &argv[0][2]; cname = &argv[0][2];
break; break;
case 'v':
want_verbose = 1;
break;
default: default:
fprintf(stderr, "Bad flag %s\n", argv[0]); fprintf(stderr, "Bad flag %s\n", argv[0]);
break; break;
@ -316,8 +320,10 @@ int main(int argc, char *argv[])
compueq(); compueq();
hashpatterns(); hashpatterns();
finishio(); finishio();
if (want_verbose)
verbose(); verbose();
} }
if (want_verbose)
debug(); debug();
exit(nerrors); exit(nerrors);
} }
@ -777,7 +783,6 @@ static void outregvar(void)
static void verbose(void) static void verbose(void)
{ {
fprintf(stderr, "Codebytes %d\n", codebytes); fprintf(stderr, "Codebytes %d\n", codebytes);
fprintf(stderr, "Registers %d(%d)\n", nmachregs, MAXREGS); fprintf(stderr, "Registers %d(%d)\n", nmachregs, MAXREGS);
fprintf(stderr, "Properties %d(%d)\n", nprops, MAXPROPS); fprintf(stderr, "Properties %d(%d)\n", nprops, MAXPROPS);