Improve LTO streaming dumps
this patch cleans up dumping of streaming so it is clear how dump is organized and how much space individual components needs. Compiling: int a=1; main() { return a; } The output is now: Creating output block for function_body Streaming tree <result_decl 0x7ffff7457a50 D.1931> Start of LTO_trees of size 1 Encoding indexable <integer_type 0x7ffff7463000 sizetype> as 0 10 bytes ^^^ I do not think we should need 10 bytes to stream single indexable reference to 0 :) Start of LTO_trees of size 1 Encoding indexable <integer_type 0x7ffff74630a8 bitsizetype> as 1 10 bytes Streaming header of <result_decl 0x7ffff7457a50 D.1931> to function_body Streaming body of <result_decl 0x7ffff7457a50 D.1931> to function_body Encoding indexable <integer_type 0x7ffff74635e8 int> as 2 Encoding indexable <function_decl 0x7ffff757b500 main> as 0 Streaming ref to <integer_cst 0x7ffff744af18 32> Streaming ref to <integer_cst 0x7ffff744af30 4> 52 bytes ^^^ Instead of having multiple LTO_trees sections followed by the final tree it would make a lot of sense to have only one LTO_trees where the first tree is one lto_input_tree should return. This is easy to arrange in DFS walk - one does not need to pop after every SCC component but pop once at the end of walk. However this breaks handling of integer_csts because they may now become of LTO_trees block and streamed as header + body. This bypasses the separate code for shared integer_cst streaming. I think I want to stream everything into header and materialize the tree since it is not part of SCC anyway. Streaming tree <block 0x7ffff757e420> Streaming header of <block 0x7ffff757e420> to function_body Streaming body of <block 0x7ffff757e420> to function_body 8 bytes Streaming gimple stmt _2 = a; Streaming ref to <block 0x7ffff757e420> 4 bytes Streaming tree <mem_ref 0x7ffff7576f78> Start of LTO_trees of size 1 Encoding indexable <pointer_type 0x7ffff746b9d8> as 3 10 bytes Start of LTO_trees of size 1 Streaming header of <addr_expr 0x7ffff75893c0> to function_body Streaming body of <addr_expr 0x7ffff75893c0> to function_body Encoding indexable <var_decl 0x7ffff7fcfb40 a> as 0 15 bytes Streaming header of <mem_ref 0x7ffff7576f78> to function_body Streaming body of <mem_ref 0x7ffff7576f78> to function_body Streaming ref to <addr_expr 0x7ffff75893c0> Streaming ref to <integer_cst 0x7ffff75a3240 0> 42 bytes Streaming gimple stmt return _2; Outputting global stream 0: <function_decl 0x7ffff757b500 main> Streaming tree <function_decl 0x7ffff757b500 main> Start of LTO_tree_scc of size 1 Streaming header of <optimization_node 0x7ffff744b000> to decls Streaming body of <optimization_node 0x7ffff744b000> to decls 576 bytes Start of LTO_tree_scc of size 1 Streaming header of <target_option_node 0x7ffff744a018> to decls Streaming body of <target_option_node 0x7ffff744a018> to decls 68 bytes Streaming single tree Streaming header of <identifier_node 0x7ffff7577aa0 main> to decls Streaming body of <identifier_node 0x7ffff7577aa0 main> to decls 3 bytes Streaming single tree Streaming header of <identifier_node 0x7ffff758a8c0 t.c> to decls Streaming body of <identifier_node 0x7ffff758a8c0 t.c> to decls 3 bytes Streaming single tree Streaming header of <translation_unit_decl 0x7ffff7457ac8 t.c> to decls Streaming body of <translation_unit_decl 0x7ffff7457ac8 t.c> to decls Streaming ref to <identifier_node 0x7ffff758a8c0 t.c> 22 bytes Start of LTO_tree_scc of size 1 Streaming header of <function_type 0x7ffff74717e0> to decls Streaming body of <function_type 0x7ffff74717e0> to decls Streaming ref to <integer_type 0x7ffff74635e8 int> Streaming ref to <integer_cst 0x7ffff744adc8 8> Streaming ref to <integer_cst 0x7ffff744ade0 1> Streaming ref to <function_type 0x7ffff74717e0> 38 bytes Start of LTO_tree_scc of size 1 Streaming header of <function_type 0x7ffff75832a0> to decls Streaming body of <function_type 0x7ffff75832a0> to decls Streaming ref to <integer_type 0x7ffff74635e8 int> Streaming ref to <integer_cst 0x7ffff744adc8 8> Streaming ref to <integer_cst 0x7ffff744ade0 1> Streaming ref to <function_type 0x7ffff74717e0> 38 bytes Start of LTO_tree_scc of size 1 Streaming header of <function_decl 0x7ffff757b500 main> to decls Streaming body of <function_decl 0x7ffff757b500 main> to decls Streaming ref to <function_type 0x7ffff75832a0> Streaming ref to <identifier_node 0x7ffff7577aa0 main> Streaming ref to <translation_unit_decl 0x7ffff7457ac8 t.c> Streaming ref to <identifier_node 0x7ffff7577aa0 main> Streaming ref to <target_option_node 0x7ffff744a018> Streaming ref to <optimization_node 0x7ffff744b000> 58 bytes 806 bytes 0: <var_decl 0x7ffff7fcfb40 a> Streaming tree <var_decl 0x7ffff7fcfb40 a> Streaming single tree Streaming header of <identifier_node 0x7ffff758a870 a> to decls Streaming body of <identifier_node 0x7ffff758a870 a> to decls 3 bytes Streaming single tree Streaming ref to <integer_type 0x7ffff7463000 sizetype> 7 bytes Streaming single tree Streaming ref to <integer_type 0x7ffff74630a8 bitsizetype> 7 bytes Start of LTO_tree_scc of size 1 Streaming header of <var_decl 0x7ffff7fcfb40 a> to decls Streaming body of <var_decl 0x7ffff7fcfb40 a> to decls Streaming ref to <integer_type 0x7ffff74635e8 int> Streaming ref to <identifier_node 0x7ffff758a870 a> Streaming ref to <translation_unit_decl 0x7ffff7457ac8 t.c> Streaming ref to <integer_cst 0x7ffff744af18 32> Streaming ref to <integer_cst 0x7ffff744af30 4> Streaming ref to <identifier_node 0x7ffff758a870 a> Streaming ref to <integer_cst 0x7ffff7468090 1> 49 bytes 66 bytes gcc/ChangeLog: 2020-05-22 Jan Hubicka <hubicka@ucw.cz> * lto-section-out.c (lto_output_decl_index): Adjust dump indentation. * lto-streamer-out.c (create_output_block): Fix whitespace (lto_write_tree_1): Add (debug) dump. (DFS::DFS): Add dump. (DFS::DFS_write_tree_body): Do not dump here. (lto_output_tree): Improve dumping; do not stream ref when not needed. (produce_asm_for_decls): Fix whitespace. * tree-streamer-out.c (streamer_write_tree_header): Add dump.
Loading
Please register or sign in to comment