]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
genmatch: put reporting on a cold path
authorMartin Liska <mliska@suse.cz>
Tue, 4 Sep 2018 13:59:38 +0000 (15:59 +0200)
committerMartin Liska <marxin@gcc.gnu.org>
Tue, 4 Sep 2018 13:59:38 +0000 (13:59 +0000)
2018-09-04  Martin Liska  <mliska@suse.cz>

* genmatch.c (output_line_directive): Add new argument
fnargs.
(dt_simplify::gen_1): Encapsulate dump within __builtin_expect.

From-SVN: r264084

gcc/ChangeLog
gcc/genmatch.c

index 7cbfcad8d849c49e68d45ca6ad36bdfbcac25ae5..8cba0290c46a39fec84d7afa0941fde536786c78 100644 (file)
@@ -1,3 +1,9 @@
+2018-09-04  Martin Liska  <mliska@suse.cz>
+
+       * genmatch.c (output_line_directive): Add new argument
+       fnargs.
+       (dt_simplify::gen_1): Encapsulate dump within __builtin_expect.
+
 2018-09-04  Jonathan Wakely  <jwakely@redhat.com>
 
        * doc/invoke.texi (Option Summary): Add whitespace.
index 50d72f8f1e798d81c20ff23aefd956cad6109e4b..5f1691ae206abfcb147614dbc78689c9e3b4a74e 100644 (file)
@@ -184,7 +184,7 @@ fprintf_indent (FILE *f, unsigned int indent, const char *format, ...)
 
 static void
 output_line_directive (FILE *f, source_location location,
-                      bool dumpfile = false)
+                      bool dumpfile = false, bool fnargs = false)
 {
   const line_map_ordinary *map;
   linemap_resolve_location (line_table, location, LRK_SPELLING_LOCATION, &map);
@@ -202,7 +202,11 @@ output_line_directive (FILE *f, source_location location,
        file = loc.file;
       else
        ++file;
-      fprintf (f, "%s:%d", file, loc.line);
+
+      if (fnargs)
+       fprintf (f, "\"%s\", %d", file, loc.line);
+      else
+       fprintf (f, "%s:%d", file, loc.line);
     }
   else
     /* Other gen programs really output line directives here, at least for
@@ -3305,11 +3309,13 @@ dt_simplify::gen_1 (FILE *f, int indent, bool gimple, operand *result)
        }
     }
 
-  fprintf_indent (f, indent, "if (dump_file && (dump_flags & TDF_FOLDING)) "
+  fprintf_indent (f, indent, "if (__builtin_expect (dump_file && (dump_flags & TDF_FOLDING), 0)) "
           "fprintf (dump_file, \"Applying pattern ");
+  fprintf (f, "%%s:%%d, %%s:%%d\\n\", ");
   output_line_directive (f,
-                        result ? result->location : s->match->location, true);
-  fprintf (f, ", %%s:%%d\\n\", __FILE__, __LINE__);\n");
+                        result ? result->location : s->match->location, true,
+                        true);
+  fprintf (f, ", __FILE__, __LINE__);\n");
 
   if (!result)
     {