diff options
author | Jan Hubicka <jh@suse.cz> | 2020-06-01 15:57:32 +0200 |
---|---|---|
committer | Jan Hubicka <jh@suse.cz> | 2020-06-01 15:57:32 +0200 |
commit | ff7da2b5d621d0aaf4a467344d0621eefd4aa78f (patch) | |
tree | a0e9ee399c1b3a9360691446bca622ae11e2d109 /gcc/lto-streamer-out.c | |
parent | c055929ff2de906b7706428d42152b1a51cb3b0a (diff) | |
download | gcc-ff7da2b5d621d0aaf4a467344d0621eefd4aa78f.zip gcc-ff7da2b5d621d0aaf4a467344d0621eefd4aa78f.tar.gz gcc-ff7da2b5d621d0aaf4a467344d0621eefd4aa78f.tar.bz2 |
Cleanup global decl stream reference streaming, part 1
This patch further simplifies way we reffer to global stream. Every function
section has vector of references to global trees which are populated during
streaming. This vector is for some reason divided into field_decls, fn_decls,
type_decls, types, namespace_decls, labels_decls and var_decls which contains
also other things.
There is no benefit for this split except perhaps for making the indexes
bit smaller and possibly better encodable by ulebs. This however does not
pay back and makes things unnecesarily complex.
We may want to re-add multiple tables if we start streaming something else than
trees into the global stream, but that would not work with current
infrastructure anyway.
The patch drops different streams and I checked that it results in reduction of
global stream and apparently very small increase in function streams but it may
be just because I updated tree in between the tests. This will be fixed by
incremental patch.
[WPA] Compression: 86220483 input bytes, 217762146 uncompressed bytes (ratio: 2.525643)
[WPA] Compression: 111735464 input bytes, 297410918 uncompressed bytes (ratio: 2.661741)
[WPA] Size of mmap'd section decls: 86220483 bytes
[WPA] Size of mmap'd section function_body: 14353447 bytes
to:
[WPA] Compression: 85754594 input bytes, 216006049 uncompressed bytes (ratio: 2.518886)
[WPA] Compression: 111370381 input bytes, 295746052 uncompressed bytes (ratio: 2.655518)
[WPA] Size of mmap'd section decls: 85754594 bytes
[WPA] Size of mmap'd section function_body: 14447946 bytes
The patch also removes some of ugly macro generators of accessors functions and
makes it easier to further optimize the way we stream references to trees which
I plan to do incrementally.
I also made the API for streaming referneces symmetric. I.e. you
stream out by
lto_output_var_decl_ref
and stream in by
lto_input_var_decl_ref
instead streaming out by
lto_output_var_decl_index
and streaming in by
decl_index = streamer_read_uhwi (ib);
lto_file_decl_data_get_fn_decl (file_data, decl_index);
lto-bootstrapped/regtested x86_64-linux, will commit it shortly.
gcc/ChangeLog:
2020-06-01 Jan Hubicka <hubicka@ucw.cz>
* ipa-reference.c (stream_out_bitmap): Use lto_output_var_decl_ref.
(ipa_reference_read_optimization_summary): Use lto_intput_var_decl_ref.
* lto-cgraph.c (lto_output_node): Likewise.
(lto_output_varpool_node): Likewise.
(output_offload_tables): Likewise.
(input_node): Likewise.
(input_varpool_node): Likewise.
(input_offload_tables): Likewise.
* lto-streamer-in.c (lto_input_tree_ref): Declare.
(lto_input_var_decl_ref): Declare.
(lto_input_fn_decl_ref): Declare.
* lto-streamer-out.c (lto_indexable_tree_ref): Use only one decl stream.
(lto_output_var_decl_index): Rename to ..
(lto_output_var_decl_ref): ... this.
(lto_output_fn_decl_index): Rename to ...
(lto_output_fn_decl_ref): ... this.
* lto-streamer.h (enum lto_decl_stream_e_t): Remove per-type streams.
(DEFINE_DECL_STREAM_FUNCS): Remove.
(lto_output_var_decl_index): Remove.
(lto_output_fn_decl_index): Remove.
(lto_output_var_decl_ref): Declare.
(lto_output_fn_decl_ref): Declare.
(lto_input_var_decl_ref): Declare.
(lto_input_fn_decl_ref): Declare.
Diffstat (limited to 'gcc/lto-streamer-out.c')
-rw-r--r-- | gcc/lto-streamer-out.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c index 1910ee2..a44ed00 100644 --- a/gcc/lto-streamer-out.c +++ b/gcc/lto-streamer-out.c @@ -260,7 +260,7 @@ lto_indexable_tree_ref (struct output_block *ob, tree expr, if (TYPE_P (expr)) { *tag = LTO_type_ref; - encoder = LTO_DECL_STREAM_TYPE; + encoder = LTO_DECL_STREAM; } else { @@ -275,12 +275,12 @@ lto_indexable_tree_ref (struct output_block *ob, tree expr, case FIELD_DECL: *tag = LTO_field_decl_ref; - encoder = LTO_DECL_STREAM_FIELD_DECL; + encoder = LTO_DECL_STREAM; break; case FUNCTION_DECL: *tag = LTO_function_decl_ref; - encoder = LTO_DECL_STREAM_FN_DECL; + encoder = LTO_DECL_STREAM; break; case VAR_DECL: @@ -290,37 +290,37 @@ lto_indexable_tree_ref (struct output_block *ob, tree expr, /* FALLTHRU */ case PARM_DECL: *tag = LTO_global_decl_ref; - encoder = LTO_DECL_STREAM_VAR_DECL; + encoder = LTO_DECL_STREAM; break; case CONST_DECL: *tag = LTO_const_decl_ref; - encoder = LTO_DECL_STREAM_VAR_DECL; + encoder = LTO_DECL_STREAM; break; case TYPE_DECL: *tag = LTO_type_decl_ref; - encoder = LTO_DECL_STREAM_TYPE_DECL; + encoder = LTO_DECL_STREAM; break; case NAMESPACE_DECL: *tag = LTO_namespace_decl_ref; - encoder = LTO_DECL_STREAM_NAMESPACE_DECL; + encoder = LTO_DECL_STREAM; break; case LABEL_DECL: *tag = LTO_label_decl_ref; - encoder = LTO_DECL_STREAM_VAR_DECL; + encoder = LTO_DECL_STREAM; break; case RESULT_DECL: *tag = LTO_result_decl_ref; - encoder = LTO_DECL_STREAM_VAR_DECL; + encoder = LTO_DECL_STREAM; break; case TRANSLATION_UNIT_DECL: *tag = LTO_translation_unit_decl_ref; - encoder = LTO_DECL_STREAM_VAR_DECL; + encoder = LTO_DECL_STREAM; break; default: @@ -336,12 +336,12 @@ lto_indexable_tree_ref (struct output_block *ob, tree expr, /* Output a static or extern var DECL to OBS. */ void -lto_output_var_decl_index (struct lto_out_decl_state *decl_state, - struct lto_output_stream * obs, tree decl) +lto_output_var_decl_ref (struct lto_out_decl_state *decl_state, + struct lto_output_stream * obs, tree decl) { gcc_checking_assert (TREE_CODE (decl) == VAR_DECL); streamer_write_uhwi_stream - (obs, lto_get_index (&decl_state->streams[LTO_DECL_STREAM_VAR_DECL], + (obs, lto_get_index (&decl_state->streams[LTO_DECL_STREAM], decl)); } @@ -349,12 +349,12 @@ lto_output_var_decl_index (struct lto_out_decl_state *decl_state, /* Output a static or extern var DECL to OBS. */ void -lto_output_fn_decl_index (struct lto_out_decl_state *decl_state, - struct lto_output_stream * obs, tree decl) +lto_output_fn_decl_ref (struct lto_out_decl_state *decl_state, + struct lto_output_stream * obs, tree decl) { gcc_checking_assert (TREE_CODE (decl) == FUNCTION_DECL); streamer_write_uhwi_stream - (obs, lto_get_index (&decl_state->streams[LTO_DECL_STREAM_FN_DECL], decl)); + (obs, lto_get_index (&decl_state->streams[LTO_DECL_STREAM], decl)); } /* Return true if EXPR is a tree node that can be written to disk. */ |