diff mbox series

[2/5] match.pd: Remove commented out line pragmas unless -vv is used.

Message ID patch-17227-tamar@arm.com
State New
Headers show
Series None | expand

Commit Message

Tamar Christina April 28, 2023, 10:38 a.m. UTC
Hi All,

genmatch currently outputs commented out line directives that have no effect
but the compiler still has to parse only to discard.

They are however handy when debugging genmatch output.  As such this moves them
behind the -vv flag.

Bootstrapped Regtested on aarch64-none-linux-gnu and no issues.

Ok for master?

Thanks,
Tamar

gcc/ChangeLog:

	PR bootstrap/84402
	* genmatch.cc (output_line_directive): Only emit commented directive
	when -vv.
	(main): Initialize verbose.

--- inline copy of patch -- 
diff --git a/gcc/genmatch.cc b/gcc/genmatch.cc
index 638606b2502f640e59527fc5a0b23fa3bedd0cee..6d62cdea2082d92e5ecc1102c80205115a4e3040 100644




--
diff --git a/gcc/genmatch.cc b/gcc/genmatch.cc
index 638606b2502f640e59527fc5a0b23fa3bedd0cee..6d62cdea2082d92e5ecc1102c80205115a4e3040 100644
--- a/gcc/genmatch.cc
+++ b/gcc/genmatch.cc
@@ -209,7 +209,7 @@ output_line_directive (FILE *f, location_t location,
       else
 	fprintf (f, "%s:%d", file, loc.line);
     }
-  else
+  else if (verbose == 2)
     /* Other gen programs really output line directives here, at least for
        development it's right now more convenient to have line information
        from the generated file.  Still keep the directives as comment for now
@@ -5221,6 +5221,7 @@ main (int argc, char **argv)
     return 1;
 
   bool gimple = true;
+  verbose = 0;
   char *input = argv[argc-1];
   for (int i = 1; i < argc - 1; ++i)
     {

Comments

Richard Biener April 28, 2023, 11:49 a.m. UTC | #1
On Fri, 28 Apr 2023, Tamar Christina wrote:

> Hi All,
> 
> genmatch currently outputs commented out line directives that have no effect
> but the compiler still has to parse only to discard.
> 
> They are however handy when debugging genmatch output.  As such this moves them
> behind the -vv flag.
> 
> Bootstrapped Regtested on aarch64-none-linux-gnu and no issues.
> 
> Ok for master?
> 
> Thanks,
> Tamar
> 
> gcc/ChangeLog:
> 
> 	PR bootstrap/84402
> 	* genmatch.cc (output_line_directive): Only emit commented directive
> 	when -vv.
> 	(main): Initialize verbose.
> 
> --- inline copy of patch -- 
> diff --git a/gcc/genmatch.cc b/gcc/genmatch.cc
> index 638606b2502f640e59527fc5a0b23fa3bedd0cee..6d62cdea2082d92e5ecc1102c80205115a4e3040 100644
> --- a/gcc/genmatch.cc
> +++ b/gcc/genmatch.cc
> @@ -209,7 +209,7 @@ output_line_directive (FILE *f, location_t location,
>        else
>  	fprintf (f, "%s:%d", file, loc.line);
>      }
> -  else
> +  else if (verbose == 2)
>      /* Other gen programs really output line directives here, at least for
>         development it's right now more convenient to have line information
>         from the generated file.  Still keep the directives as comment for now
> @@ -5221,6 +5221,7 @@ main (int argc, char **argv)
>      return 1;
>  
>    bool gimple = true;
> +  verbose = 0;

That's redundant - globals are default zero-initialized.

OK with removing this line.

Thanks,
Richard.
Paul Koning April 28, 2023, 1:17 p.m. UTC | #2
On the check for verbose==2, should that be verbose >= 2 ?

	paul

> On Apr 28, 2023, at 6:38 AM, Tamar Christina via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
> 
> Hi All,
> 
> genmatch currently outputs commented out line directives that have no effect
> but the compiler still has to parse only to discard.
> 
> They are however handy when debugging genmatch output.  As such this moves them
> behind the -vv flag.
> 
> Bootstrapped Regtested on aarch64-none-linux-gnu and no issues.
> 
> Ok for master?
> 
> Thanks,
> Tamar
> 
> gcc/ChangeLog:
> 
> 	PR bootstrap/84402
> 	* genmatch.cc (output_line_directive): Only emit commented directive
> 	when -vv.
> 	(main): Initialize verbose.
> 
> --- inline copy of patch -- 
> diff --git a/gcc/genmatch.cc b/gcc/genmatch.cc
> index 638606b2502f640e59527fc5a0b23fa3bedd0cee..6d62cdea2082d92e5ecc1102c80205115a4e3040 100644
> --- a/gcc/genmatch.cc
> +++ b/gcc/genmatch.cc
> @@ -209,7 +209,7 @@ output_line_directive (FILE *f, location_t location,
>       else
> 	fprintf (f, "%s:%d", file, loc.line);
>     }
> -  else
> +  else if (verbose == 2)
>     /* Other gen programs really output line directives here, at least for
>        development it's right now more convenient to have line information
>        from the generated file.  Still keep the directives as comment for now
> @@ -5221,6 +5221,7 @@ main (int argc, char **argv)
>     return 1;
> 
>   bool gimple = true;
> +  verbose = 0;
>   char *input = argv[argc-1];
>   for (int i = 1; i < argc - 1; ++i)
>     {
> 
> 
> 
> 
> -- 
> <rb17227.patch>
Tamar Christina April 28, 2023, 2:02 p.m. UTC | #3
> On the check for verbose==2, should that be verbose >= 2 ?
> 

That's fair enough. Made the change.

Thanks,
Tamar.

> 	paul
> 
> > On Apr 28, 2023, at 6:38 AM, Tamar Christina via Gcc-patches <gcc-
> patches@gcc.gnu.org> wrote:
> >
> > Hi All,
> >
> > genmatch currently outputs commented out line directives that have no
> > effect but the compiler still has to parse only to discard.
> >
> > They are however handy when debugging genmatch output.  As such this
> > moves them behind the -vv flag.
> >
> > Bootstrapped Regtested on aarch64-none-linux-gnu and no issues.
> >
> > Ok for master?
> >
> > Thanks,
> > Tamar
> >
> > gcc/ChangeLog:
> >
> > 	PR bootstrap/84402
> > 	* genmatch.cc (output_line_directive): Only emit commented directive
> > 	when -vv.
> > 	(main): Initialize verbose.
> >
> > --- inline copy of patch --
> > diff --git a/gcc/genmatch.cc b/gcc/genmatch.cc index
> >
> 638606b2502f640e59527fc5a0b23fa3bedd0cee..6d62cdea2082d92e5ecc1
> 102c802
> > 05115a4e3040 100644
> > --- a/gcc/genmatch.cc
> > +++ b/gcc/genmatch.cc
> > @@ -209,7 +209,7 @@ output_line_directive (FILE *f, location_t location,
> >       else
> > 	fprintf (f, "%s:%d", file, loc.line);
> >     }
> > -  else
> > +  else if (verbose == 2)
> >     /* Other gen programs really output line directives here, at least for
> >        development it's right now more convenient to have line information
> >        from the generated file.  Still keep the directives as comment
> > for now @@ -5221,6 +5221,7 @@ main (int argc, char **argv)
> >     return 1;
> >
> >   bool gimple = true;
> > +  verbose = 0;
> >   char *input = argv[argc-1];
> >   for (int i = 1; i < argc - 1; ++i)
> >     {
> >
> >
> >
> >
> > --
> > <rb17227.patch>
diff mbox series

Patch

--- a/gcc/genmatch.cc
+++ b/gcc/genmatch.cc
@@ -209,7 +209,7 @@  output_line_directive (FILE *f, location_t location,
       else
 	fprintf (f, "%s:%d", file, loc.line);
     }
-  else
+  else if (verbose == 2)
     /* Other gen programs really output line directives here, at least for
        development it's right now more convenient to have line information
        from the generated file.  Still keep the directives as comment for now
@@ -5221,6 +5221,7 @@  main (int argc, char **argv)
     return 1;
 
   bool gimple = true;
+  verbose = 0;
   char *input = argv[argc-1];
   for (int i = 1; i < argc - 1; ++i)
     {