cgraph.c (cgraph_node::get_untransformed_body): Dump function bodies streamed in...
authorJan Hubicka <hubicka@gcc.gnu.org>
Wed, 13 Jun 2018 12:52:29 +0000 (12:52 +0000)
committerJan Hubicka <hubicka@gcc.gnu.org>
Wed, 13 Jun 2018 12:52:29 +0000 (12:52 +0000)
* cgraph.c (cgraph_node::get_untransformed_body): Dump function
bodies streamed in with -Q.
* dumpfile.c (dump_files): Add lto-stream-out dump file.
* dumpfile.h (tree_dump_index): Add lto_stream_out.
* gimple-streamer-out.c: Include gimple-pretty-print.h
(output_bb): Dump stmts streamed.
* lto-section-out.c: Include print-tree.h
(lto_begin_section): Dump sections created.
(lto_output_decl_index): Dump decl encoded.
* lto-streamer-out.c: Include print-tree.h
(create_output_block): Dump output block created.
(DFS::DFS_write_tree_body): Dump DFS SCCs streamed.
(output_function): Dump function output.
(output_constructor): Dump constructor streamed.
(write_global_stream): Output indexes encoded.
(produce_asm_for_decls): Dump streams encoded.
* lto-streamer.c (streamer_dump_file): New global var.
* lto-streamer.h (streamer_dump_file): Declare.
* passes.c (ipa_write_summaries): Initialize streamer dump.
* varpool.c (varpool_node::get_constructor): Dump constructors streamed
in.

From-SVN: r261546

gcc/ChangeLog
gcc/cgraph.c
gcc/dumpfile.c
gcc/dumpfile.h
gcc/gimple-streamer-out.c
gcc/lto-section-out.c
gcc/lto-streamer-out.c
gcc/lto-streamer.c
gcc/lto-streamer.h
gcc/passes.c
gcc/varpool.c

index 103877a7e32f4f84a24a213eebfafbc528cd71c0..fc462248e781fa444c18dfe2de5d0d61b526b370 100644 (file)
@@ -1,3 +1,27 @@
+2018-06-13  Jan Hubicka  <hubicka@gcc.gnu.org>
+
+       * cgraph.c (cgraph_node::get_untransformed_body): Dump function
+       bodies streamed in with -Q.
+       * dumpfile.c (dump_files): Add lto-stream-out dump file.
+       * dumpfile.h (tree_dump_index): Add lto_stream_out.
+       * gimple-streamer-out.c: Include gimple-pretty-print.h
+       (output_bb): Dump stmts streamed.
+       * lto-section-out.c: Include print-tree.h
+       (lto_begin_section): Dump sections created.
+       (lto_output_decl_index): Dump decl encoded.
+       * lto-streamer-out.c: Include print-tree.h
+       (create_output_block): Dump output block created.
+       (DFS::DFS_write_tree_body): Dump DFS SCCs streamed.
+       (output_function): Dump function output.
+       (output_constructor): Dump constructor streamed.
+       (write_global_stream): Output indexes encoded.
+       (produce_asm_for_decls): Dump streams encoded.
+       * lto-streamer.c (streamer_dump_file): New global var.
+       * lto-streamer.h (streamer_dump_file): Declare.
+       * passes.c (ipa_write_summaries): Initialize streamer dump.
+       * varpool.c (varpool_node::get_constructor): Dump constructors streamed
+       in.
+
 2018-06-13  Eric Botcazou  <ebotcazou@adacore.com>
 
        PR target/86048
index bafbed7f13d9fbb1ad5991d1226f0520271a7fe8..3899467f94d3c54869ddbd68f2ea7687347a46fe 100644 (file)
@@ -3543,6 +3543,8 @@ cgraph_node::get_untransformed_body (void)
 
   gcc_assert (DECL_STRUCT_FUNCTION (decl) == NULL);
 
+  if (!quiet_flag)
+    fprintf (stderr, " in:%s", IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
   lto_input_function_body (file_data, this, data);
   lto_stats.num_function_bodies++;
   lto_free_section_data (file_data, LTO_section_function_body, name,
index 3dd41c42a7fa409ff312900b04ceae4f28929113..2f11284d488479a0c0fc4b5853d276b97b1f6f39 100644 (file)
@@ -64,6 +64,7 @@ static struct dump_file_info dump_files[TDI_end] =
   DUMP_FILE_INFO (".original", "tree-original", DK_tree, 0),
   DUMP_FILE_INFO (".gimple", "tree-gimple", DK_tree, 0),
   DUMP_FILE_INFO (".nested", "tree-nested", DK_tree, 0),
+  DUMP_FILE_INFO (".lto-stream-out", "ipa-lto-stream-out", DK_ipa, 0),
 #define FIRST_AUTO_NUMBERED_DUMP 1
 #define FIRST_ME_AUTO_NUMBERED_DUMP 4
 
index 153f91ef57e54305c1543ecae52b0aa35e6cbbbe..f6ad670f0e430eff10de54bf55531251718a9e54 100644 (file)
@@ -33,6 +33,7 @@ enum tree_dump_index
   TDI_original,                        /* dump each function before optimizing it */
   TDI_gimple,                  /* dump each function after gimplifying it */
   TDI_nested,                  /* dump each function after unnesting it */
+  TDI_lto_stream_out,          /* dump information about lto streaming */
 
   TDI_lang_all,                        /* enable all the language dumps.  */
   TDI_tree_all,                        /* enable all the GENERIC/GIMPLE dumps.  */
index 42e72618f028e164103d0169782d67e8b45ff683..d120aa902952ab5db8f795f694915a25f8913de4 100644 (file)
@@ -31,6 +31,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "gimple-iterator.h"
 #include "cgraph.h"
 #include "value-prof.h"
+#include "gimple-pretty-print.h"
 
 /* Output PHI function PHI to the main stream in OB.  */
 
@@ -220,6 +221,11 @@ output_bb (struct output_block *ob, basic_block bb, struct function *fn)
        {
          int region;
          gimple *stmt = gsi_stmt (bsi);
+         if (streamer_dump_file)
+           {
+             fprintf (streamer_dump_file, "  Streaming gimple stmt ");
+             print_gimple_stmt (streamer_dump_file, stmt, 0, TDF_SLIM);
+           }
 
          output_gimple_stmt (ob, stmt);
 
index af0cad3f906e9a61a3052e82a1c4608dd5c8e181..2dfe64c049a6ff3ffe05d71ef41d8efa6e33f333 100644 (file)
@@ -30,6 +30,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "data-streamer.h"
 #include "langhooks.h"
 #include "lto-compress.h"
+#include "print-tree.h"
 
 static vec<lto_out_decl_state_ptr> decl_state_stack;
 
@@ -66,6 +67,9 @@ lto_begin_section (const char *name, bool compress)
 {
   lang_hooks.lto.begin_section (name);
 
+  if (streamer_dump_file)
+    fprintf (streamer_dump_file, "Creating %ssection %s\n",
+            compress ? "compressed " : "", name);
   gcc_assert (compression_stream == NULL);
   if (compress)
     compression_stream = lto_start_compression (lto_append_data, NULL);
@@ -158,6 +162,12 @@ lto_output_decl_index (struct lto_output_stream *obs,
   if (!existed_p)
     {
       index = encoder->trees.length ();
+      if (streamer_dump_file)
+       {
+         print_node_brief (streamer_dump_file, "    Encoding indexable ",
+                           name, 4);
+         fprintf (streamer_dump_file, "  as %i \n", index);
+       }
       encoder->trees.safe_push (name);
       new_entry_p = TRUE;
     }
index eb726bfb22e558a99d2f71bb63344b21ec4abb77..49f72e98501b549e26d0bcbea57b6997823f2c67 100644 (file)
@@ -42,6 +42,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "gomp-constants.h"
 #include "debug.h"
 #include "omp-offload.h"
+#include "print-tree.h"
 
 
 static void lto_write_tree (struct output_block*, tree, bool);
@@ -65,6 +66,9 @@ struct output_block *
 create_output_block (enum lto_section_type section_type)
 {
   struct output_block *ob = XCNEW (struct output_block);
+  if (streamer_dump_file)
+    fprintf (streamer_dump_file, "Creating output block for %s\n",
+            lto_section_name [section_type]);
 
   ob->section_type = section_type;
   ob->decl_state = lto_get_out_decl_state ();
@@ -738,6 +742,14 @@ DFS::DFS_write_tree_body (struct output_block *ob,
 
   enum tree_code code;
 
+  if (streamer_dump_file)
+    {
+      print_node_brief (streamer_dump_file, "    Streaming ",
+                       expr, 4);
+      fprintf (streamer_dump_file, "  to %s\n",
+              lto_section_name [ob->section_type]);
+    }
+
   code = TREE_CODE (expr);
 
   if (CODE_CONTAINS_STRUCT (code, TS_TYPED))
@@ -1635,6 +1647,13 @@ lto_output_tree (struct output_block *ob, tree expr,
         we stream out.  */
       gcc_assert (!in_dfs_walk);
 
+      if (streamer_dump_file)
+       {
+         print_node_brief (streamer_dump_file, "   Streaming SCC of ",
+                           expr, 4);
+          fprintf (streamer_dump_file, "\n");
+       }
+
       /* Start the DFS walk.  */
       /* Save ob state ... */
       /* let's see ... */
@@ -1651,6 +1670,12 @@ lto_output_tree (struct output_block *ob, tree expr,
       streamer_write_uhwi (ob, ix);
       streamer_write_enum (ob->main_stream, LTO_tags, LTO_NUM_TAGS,
                           lto_tree_code_to_tag (TREE_CODE (expr)));
+      if (streamer_dump_file)
+       {
+         print_node_brief (streamer_dump_file, "   Finished SCC of ",
+                           expr, 4);
+          fprintf (streamer_dump_file, "\n\n");
+       }
       lto_stats.num_pickle_refs_output++;
     }
 }
@@ -2072,6 +2097,10 @@ output_function (struct cgraph_node *node)
   basic_block bb;
   struct output_block *ob;
 
+  if (streamer_dump_file)
+    fprintf (streamer_dump_file, "\nStreaming body of %s\n",
+            node->name ());
+
   function = node->decl;
   fn = DECL_STRUCT_FUNCTION (function);
   ob = create_output_block (LTO_section_function_body);
@@ -2190,6 +2219,9 @@ output_function (struct cgraph_node *node)
   produce_asm (ob, function);
 
   destroy_output_block (ob);
+  if (streamer_dump_file)
+    fprintf (streamer_dump_file, "Finished streaming %s\n",
+            node->name ());
 }
 
 /* Output the body of function NODE->DECL.  */
@@ -2200,6 +2232,10 @@ output_constructor (struct varpool_node *node)
   tree var = node->decl;
   struct output_block *ob;
 
+  if (streamer_dump_file)
+    fprintf (streamer_dump_file, "\nStreaming constructor of %s\n",
+            node->name ());
+
   ob = create_output_block (LTO_section_function_body);
 
   clear_line_info (ob);
@@ -2216,6 +2252,9 @@ output_constructor (struct varpool_node *node)
   produce_asm (ob, var);
 
   destroy_output_block (ob);
+  if (streamer_dump_file)
+    fprintf (streamer_dump_file, "Finished streaming %s\n",
+            node->name ());
 }
 
 
@@ -2485,6 +2524,12 @@ write_global_stream (struct output_block *ob,
   for (index = 0; index < size; index++)
     {
       t = lto_tree_ref_encoder_get_tree (encoder, index);
+      if (streamer_dump_file)
+       {
+          fprintf (streamer_dump_file, " %i:", (int)index);
+         print_node_brief (streamer_dump_file, "", t, 4);
+          fprintf (streamer_dump_file, "\n");
+       }
       if (!streamer_tree_cache_lookup (ob->writer_cache, t, NULL))
        stream_write_tree (ob, t, false);
     }
@@ -2860,12 +2905,18 @@ produce_asm_for_decls (void)
       }
 
   /* Write the global symbols.  */
+  if (streamer_dump_file)
+    fprintf (streamer_dump_file, "Outputting global stream\n");
   lto_output_decl_state_streams (ob, out_state);
   num_fns = lto_function_decl_states.length ();
   for (idx = 0; idx < num_fns; idx++)
     {
       fn_out_state =
        lto_function_decl_states[idx];
+      if (streamer_dump_file)
+        fprintf (streamer_dump_file, "Outputting stream for %s\n",
+                IDENTIFIER_POINTER
+                   (DECL_ASSEMBLER_NAME (fn_out_state->fn_decl)));
       lto_output_decl_state_streams (ob, fn_out_state);
     }
 
index 80717e5d0d3b7558d450fe1cbe84c7f60a32b9ca..f51d66574614e5e68022a410484c53b2a60908cd 100644 (file)
@@ -44,6 +44,8 @@ const char *section_name_prefix = LTO_SECTION_NAME_PREFIX;
 /* Set when streaming LTO for offloading compiler.  */
 bool lto_stream_offload_p;
 
+FILE *streamer_dump_file;
+
 /* Return a string representing LTO tag TAG.  */
 
 const char *
index 025929fe56009091df0bc52695df681e156f468d..236fcc4480bb4f421cca35851773264beb264d28 100644 (file)
@@ -1221,5 +1221,6 @@ struct dref_entry {
 
 extern vec<dref_entry> dref_queue;
 
+extern FILE *streamer_dump_file;
 
 #endif /* GCC_LTO_STREAMER_H  */
index 01a441ab280dab4262446997d5ddee0982b22abd..832f0b3e5f2df80863852f8d0f76cecc46cd83f2 100644 (file)
@@ -2641,6 +2641,9 @@ ipa_write_summaries (void)
   if ((!flag_generate_lto && !flag_generate_offload) || seen_error ())
     return;
 
+  gcc_assert (!dump_file);
+  streamer_dump_file = dump_begin (TDI_lto_stream_out, NULL);
+
   select_what_to_stream ();
 
   encoder = lto_symtab_encoder_new (false);
@@ -2683,6 +2686,11 @@ ipa_write_summaries (void)
   ipa_write_summaries_1 (compute_ltrans_boundary (encoder));
 
   free (order);
+  if (streamer_dump_file)
+    {
+      dump_end (TDI_lto_stream_out, streamer_dump_file);
+      streamer_dump_file = NULL;
+    }
 }
 
 /* Same as execute_pass_list but assume that subpasses of IPA passes
index afba2deca141f33dbdea79a98259c30a226cb30c..4c90eead390715a333d68495bf21c8d65eccf993 100644 (file)
@@ -307,6 +307,8 @@ varpool_node::get_constructor (void)
                 file_data->file_name,
                 name);
 
+  if (!quiet_flag)
+    fprintf (stderr, " in:%s", IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
   lto_input_variable_constructor (file_data, this, data);
   gcc_assert (DECL_INITIAL (decl) != error_mark_node);
   lto_stats.num_function_bodies++;