Only finalize dot files that have been initialized
authorTom de Vries <tom@codesourcery.com>
Sun, 17 Apr 2016 05:22:33 +0000 (05:22 +0000)
committerTom de Vries <vries@gcc.gnu.org>
Sun, 17 Apr 2016 05:22:33 +0000 (05:22 +0000)
2016-04-17  Tom de Vries  <tom@codesourcery.com>

PR other/70185
* tree-pass.h (class opt_pass): Remove graph_dump_initialized member.
* dumpfile.h (struct dump_file_info): Add graph_dump_initialized field.
* dumpfile.c (dump_files): Initialize graph_dump_initialized field.
* passes.c (finish_optimization_passes): Only call
finish_graph_dump_file if dfi->graph_dump_initialized.
(execute_function_dump, pass_init_dump_file): Use
dfi->graph_dump_initialized instead of pass->graph_dump_initialized.

From-SVN: r235074

gcc/ChangeLog
gcc/dumpfile.c
gcc/dumpfile.h
gcc/passes.c
gcc/tree-pass.h

index 23f04c23dac760a5e621fb15faf3e1d3edbb4e2a..2a20ceee5ba6898941d58d30f30191d4bf5bb23c 100644 (file)
@@ -1,3 +1,14 @@
+2016-04-17  Tom de Vries  <tom@codesourcery.com>
+
+       PR other/70185
+       * tree-pass.h (class opt_pass): Remove graph_dump_initialized member.
+       * dumpfile.h (struct dump_file_info): Add graph_dump_initialized field.
+       * dumpfile.c (dump_files): Initialize graph_dump_initialized field.
+       * passes.c (finish_optimization_passes): Only call
+       finish_graph_dump_file if dfi->graph_dump_initialized.
+       (execute_function_dump, pass_init_dump_file): Use
+       dfi->graph_dump_initialized instead of pass->graph_dump_initialized.
+
 2016-04-17  Tom de Vries  <tom@codesourcery.com>
 
        PR tree-optimization/70256
index 144e3719e6c39bef929ba6df5ad39ea68b65f477..74522a66fc0244ec3414d062accb24e62e4370d6 100644 (file)
@@ -50,29 +50,29 @@ int dump_flags;
    TREE_DUMP_INDEX enumeration in dumpfile.h.  */
 static struct dump_file_info dump_files[TDI_end] =
 {
-  {NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, false},
+  {NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, false, false},
   {".cgraph", "ipa-cgraph", NULL, NULL, NULL, NULL, NULL, TDF_IPA,
-   0, 0, 0, 0, 0, false},
+   0, 0, 0, 0, 0, false, false},
   {".type-inheritance", "ipa-type-inheritance", NULL, NULL, NULL, NULL, NULL, TDF_IPA,
-   0, 0, 0, 0, 0, false},
+   0, 0, 0, 0, 0, false, false},
   {".tu", "translation-unit", NULL, NULL, NULL, NULL, NULL, TDF_TREE,
-   0, 0, 0, 0, 1, false},
+   0, 0, 0, 0, 1, false, false},
   {".class", "class-hierarchy", NULL, NULL, NULL, NULL, NULL, TDF_TREE,
-   0, 0, 0, 0, 2, false},
+   0, 0, 0, 0, 2, false, false},
   {".original", "tree-original", NULL, NULL, NULL, NULL, NULL, TDF_TREE,
-   0, 0, 0, 0, 3, false},
+   0, 0, 0, 0, 3, false, false},
   {".gimple", "tree-gimple", NULL, NULL, NULL, NULL, NULL, TDF_TREE,
-   0, 0, 0, 0, 4, false},
+   0, 0, 0, 0, 4, false, false},
   {".nested", "tree-nested", NULL, NULL, NULL, NULL, NULL, TDF_TREE,
-   0, 0, 0, 0, 5, false},
+   0, 0, 0, 0, 5, false, false},
 #define FIRST_AUTO_NUMBERED_DUMP 6
 
   {NULL, "tree-all", NULL, NULL, NULL, NULL, NULL, TDF_TREE,
-   0, 0, 0, 0, 0, false},
+   0, 0, 0, 0, 0, false, false},
   {NULL, "rtl-all", NULL, NULL, NULL, NULL, NULL, TDF_RTL,
-   0, 0, 0, 0, 0, false},
+   0, 0, 0, 0, 0, false, false},
   {NULL, "ipa-all", NULL, NULL, NULL, NULL, NULL, TDF_IPA,
-   0, 0, 0, 0, 0, false},
+   0, 0, 0, 0, 0, false, false},
 };
 
 /* Define a name->number mapping for a dump flag value.  */
index c168cbf460bac2cfdd964f4414b82de21ef8c893..3f08b1624586049df8210baf00258ffb56f9e973 100644 (file)
@@ -120,6 +120,10 @@ struct dump_file_info
   bool owns_strings;            /* fields "suffix", "swtch", "glob" can be
                                   const strings, or can be dynamically
                                   allocated, needing free.  */
+  bool graph_dump_initialized;  /* When a given dump file is being initialized,
+                                  this flag is set to true if the corresponding
+                                  TDF_graph dump file has also been
+                                  initialized.  */
 };
 
 /* In dumpfile.c */
index b9eab06f93fdcca7f63176751ffcbdf02229640e..2b70846dd4012ff0f27d61dc06474414cca017fc 100644 (file)
@@ -364,10 +364,9 @@ finish_optimization_passes (void)
 
   /* Do whatever is necessary to finish printing the graphs.  */
   for (i = TDI_end; (dfi = dumps->get_dump_file_info (i)) != NULL; ++i)
-    if (dumps->dump_initialized_p (i)
-       && (dfi->pflags & TDF_GRAPH) != 0
-       && (name = dumps->get_dump_file_name (i)) != NULL)
+    if (dfi->graph_dump_initialized)
       {
+       name = dumps->get_dump_file_name (dfi);
        finish_graph_dump_file (name);
        free (name);
       }
@@ -1764,10 +1763,13 @@ execute_function_dump (function *fn, void *data)
       if ((fn->curr_properties & PROP_cfg)
          && (dump_flags & TDF_GRAPH))
        {
-         if (!pass->graph_dump_initialized)
+         gcc::dump_manager *dumps = g->get_dumps ();
+         struct dump_file_info *dfi
+           = dumps->get_dump_file_info (pass->static_pass_number);
+         if (!dfi->graph_dump_initialized)
            {
              clean_graph_dump_file (dump_file_name);
-             pass->graph_dump_initialized = true;
+             dfi->graph_dump_initialized = true;
            }
          print_graph_cfg (dump_file_name, fn);
        }
@@ -2111,7 +2113,9 @@ pass_init_dump_file (opt_pass *pass)
          && cfun && (cfun->curr_properties & PROP_cfg))
        {
          clean_graph_dump_file (dump_file_name);
-         pass->graph_dump_initialized = true;
+         struct dump_file_info *dfi
+           = dumps->get_dump_file_info (pass->static_pass_number);
+         dfi->graph_dump_initialized = true;
        }
       timevar_pop (TV_DUMP);
       return initializing_dump;
index 5f5055d3a6c1f944557a84deceda2da79eab3308..cd8c3399f9fe4e01c8002df2aee49cf66b29a40b 100644 (file)
@@ -108,11 +108,6 @@ public:
   /* Static pass number, used as a fragment of the dump file name.  */
   int static_pass_number;
 
-  /* When a given dump file is being initialized, this flag is set to
-     true if the corresponding TDF_graph dump file has also been
-     initialized.  */
-  bool graph_dump_initialized;
-
 protected:
   gcc::context *m_ctxt;
 };