From b4da704c6ea9e69c6733fe86b5045b00f2775462 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Wed, 13 Jun 2018 12:52:29 +0000 Subject: cgraph.c (cgraph_node::get_untransformed_body): Dump function bodies streamed in with -Q. * 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/lto-streamer-out.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) (limited to 'gcc/lto-streamer-out.c') diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c index eb726bf..49f72e9 100644 --- a/gcc/lto-streamer-out.c +++ b/gcc/lto-streamer-out.c @@ -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); } -- cgit v1.1