aboutsummaryrefslogtreecommitdiff
path: root/gcc/lto-streamer.h
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2020-06-01 15:57:32 +0200
committerJan Hubicka <jh@suse.cz>2020-06-01 15:57:32 +0200
commitff7da2b5d621d0aaf4a467344d0621eefd4aa78f (patch)
treea0e9ee399c1b3a9360691446bca622ae11e2d109 /gcc/lto-streamer.h
parentc055929ff2de906b7706428d42152b1a51cb3b0a (diff)
downloadgcc-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.h')
-rw-r--r--gcc/lto-streamer.h46
1 files changed, 7 insertions, 39 deletions
diff --git a/gcc/lto-streamer.h b/gcc/lto-streamer.h
index 6ab0505..fc7e431 100644
--- a/gcc/lto-streamer.h
+++ b/gcc/lto-streamer.h
@@ -249,38 +249,12 @@ enum lto_section_type
/* Indices to the various function, type and symbol streams. */
enum lto_decl_stream_e_t
{
- LTO_DECL_STREAM_TYPE = 0, /* Must be first. */
- LTO_DECL_STREAM_FIELD_DECL,
- LTO_DECL_STREAM_FN_DECL,
- LTO_DECL_STREAM_VAR_DECL,
- LTO_DECL_STREAM_TYPE_DECL,
- LTO_DECL_STREAM_NAMESPACE_DECL,
- LTO_DECL_STREAM_LABEL_DECL,
+ LTO_DECL_STREAM = 0, /* Must be first. */
LTO_N_DECL_STREAMS
};
typedef enum ld_plugin_symbol_resolution ld_plugin_symbol_resolution_t;
-
-/* Macro to define convenience functions for type and decl streams
- in lto_file_decl_data. */
-#define DEFINE_DECL_STREAM_FUNCS(UPPER_NAME, name) \
-static inline tree \
-lto_file_decl_data_get_ ## name (struct lto_file_decl_data *data, \
- unsigned int idx) \
-{ \
- struct lto_in_decl_state *state = data->current_decl_state; \
- return (*state->streams[LTO_DECL_STREAM_## UPPER_NAME])[idx]; \
-} \
-\
-static inline unsigned int \
-lto_file_decl_data_num_ ## name ## s (struct lto_file_decl_data *data) \
-{ \
- struct lto_in_decl_state *state = data->current_decl_state; \
- return vec_safe_length (state->streams[LTO_DECL_STREAM_## UPPER_NAME]); \
-}
-
-
/* Return a char pointer to the start of a data stream for an lto pass
or function. The first parameter is the file data that contains
the information. The second parameter is the type of information
@@ -908,10 +882,12 @@ extern struct output_block *create_output_block (enum lto_section_type);
extern void destroy_output_block (struct output_block *);
extern void lto_output_tree (struct output_block *, tree, bool, bool);
extern void stream_write_tree_ref (struct output_block *, tree);
-extern void lto_output_var_decl_index (struct lto_out_decl_state *,
- struct lto_output_stream *, tree);
-extern void lto_output_fn_decl_index (struct lto_out_decl_state *,
- struct lto_output_stream *, tree);
+extern void lto_output_var_decl_ref (struct lto_out_decl_state *,
+ struct lto_output_stream *, tree);
+extern void lto_output_fn_decl_ref (struct lto_out_decl_state *,
+ struct lto_output_stream *, tree);
+extern tree lto_input_var_decl_ref (lto_input_block *, lto_file_decl_data *);
+extern tree lto_input_fn_decl_ref (lto_input_block *, lto_file_decl_data *);
extern void lto_output_toplevel_asms (void);
extern void produce_asm (struct output_block *ob, tree fn);
extern void lto_output ();
@@ -1251,14 +1227,6 @@ lsei_start_variable_in_partition (lto_symtab_encoder_t encoder)
return lsei;
}
-DEFINE_DECL_STREAM_FUNCS (TYPE, type)
-DEFINE_DECL_STREAM_FUNCS (FIELD_DECL, field_decl)
-DEFINE_DECL_STREAM_FUNCS (FN_DECL, fn_decl)
-DEFINE_DECL_STREAM_FUNCS (VAR_DECL, var_decl)
-DEFINE_DECL_STREAM_FUNCS (TYPE_DECL, type_decl)
-DEFINE_DECL_STREAM_FUNCS (NAMESPACE_DECL, namespace_decl)
-DEFINE_DECL_STREAM_FUNCS (LABEL_DECL, label_decl)
-
/* Entry for the delayed registering of decl -> DIE references. */
struct dref_entry {
tree decl;