]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
* passes.c (execute_function_dump): Set graph_dump_initialized
authoraldyh <aldyh@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 18 Dec 2013 17:38:07 +0000 (17:38 +0000)
committeraldyh <aldyh@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 18 Dec 2013 17:38:07 +0000 (17:38 +0000)
appropriately.
(pass_init_dump_file): Similarly.
(execute_one_pass): Pass new argument to do_per_function.
* tree-pass.h (class opt_pass): New field graph_dump_initialized.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@206092 138bc75d-0d04-0410-961f-82ee72b054a4

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

index e595132f8d3355c7fe823d7d619d41e3ee458dfe..b83157ff2504e432f121f1a399c168156cd1ac60 100644 (file)
@@ -1,3 +1,11 @@
+2013-12-18  Aldy Hernandez  <aldyh@redhat.com>
+
+       * passes.c (execute_function_dump): Set graph_dump_initialized
+       appropriately.
+       (pass_init_dump_file): Similarly.
+       (execute_one_pass): Pass new argument to do_per_function.
+       * tree-pass.h (class opt_pass): New field graph_dump_initialized.
+
 2013-12-18  Aldy Hernandez  <aldyh@redhat.com>
 
        * doc/tree-ssa.texi (SSA Operands): Remove reference to
index f30f159813e26caf6272cd183da0ba70aac89d0b..bc7bf06448998f7b1242499cd84907f2dc96312b 100644 (file)
@@ -1640,8 +1640,10 @@ do_per_function_toporder (void (*callback) (void *data), void *data)
 /* Helper function to perform function body dump.  */
 
 static void
-execute_function_dump (void *data ATTRIBUTE_UNUSED)
+execute_function_dump (void *data)
 {
+  opt_pass *pass = (opt_pass *)data;
+
   if (dump_file && current_function_decl)
     {
       if (cfun->curr_properties & PROP_trees)
@@ -1655,7 +1657,14 @@ execute_function_dump (void *data ATTRIBUTE_UNUSED)
 
       if ((cfun->curr_properties & PROP_cfg)
          && (dump_flags & TDF_GRAPH))
-       print_graph_cfg (dump_file_name, cfun);
+       {
+         if (!pass->graph_dump_initialized)
+           {
+             clean_graph_dump_file (dump_file_name);
+             pass->graph_dump_initialized = true;
+           }
+         print_graph_cfg (dump_file_name, cfun);
+       }
     }
 }
 
@@ -1936,6 +1945,7 @@ verify_curr_properties (void *data)
 bool
 pass_init_dump_file (opt_pass *pass)
 {
+  pass->graph_dump_initialized = false;
   /* If a dump file name is present, open it if enabled.  */
   if (pass->static_pass_number != -1)
     {
@@ -1950,7 +1960,10 @@ pass_init_dump_file (opt_pass *pass)
       if (initializing_dump
          && dump_file && (dump_flags & TDF_GRAPH)
          && cfun && (cfun->curr_properties & PROP_cfg))
-       clean_graph_dump_file (dump_file_name);
+       {
+         clean_graph_dump_file (dump_file_name);
+         pass->graph_dump_initialized = true;
+       }
       timevar_pop (TV_DUMP);
       return initializing_dump;
     }
@@ -2230,7 +2243,7 @@ execute_one_pass (opt_pass *pass)
 
   verify_interpass_invariants ();
   if (dump_file)
-    do_per_function (execute_function_dump, NULL);
+    do_per_function (execute_function_dump, pass);
   if (pass->type == IPA_PASS)
     {
       struct cgraph_node *node;
index 44b330803d58868b0c2d2368020c4ac9593903df..308631f3dd1db8a5f1e6fb4a88e7253dd9af2b5f 100644 (file)
@@ -114,6 +114,11 @@ 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;
 };