diff options
author | Jan Hubicka <hubicka@ucw.cz> | 2015-12-13 03:12:15 +0100 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2015-12-13 02:12:15 +0000 |
commit | ca83487662329ae9130ffbf72fae7dbfe4fddb83 (patch) | |
tree | d18c6e4f8e505e7d6ec7206494843089e5e6d216 | |
parent | b44c0c0c7fd037165e5c8ddd20d5f2986e29d309 (diff) | |
download | gcc-ca83487662329ae9130ffbf72fae7dbfe4fddb83.zip gcc-ca83487662329ae9130ffbf72fae7dbfe4fddb83.tar.gz gcc-ca83487662329ae9130ffbf72fae7dbfe4fddb83.tar.bz2 |
cgraph.c (cgraph_node::get_untransformed_body): Pass compressed flag to lto_get_section_data.
* cgraph.c (cgraph_node::get_untransformed_body): Pass compressed
flag to lto_get_section_data.
* varpool.c (varpool_node::get_constructor): Likewise.
* lto-section-in.c (lto_get_section_data): Add new flag decompress.
(lto_free_section_data): Likewise.
(lto_get_raw_section_data): New function.
(lto_free_raw_section_data): New function.
(copy_function_or_variable): Copy sections w/o decompressing.
(lto_output_decl_state_refs): Picke compressed bit.
* lto-streamer.h (lto_in_decl_state): New flag compressed.
(lto_out_decl_state): Likewise.
(lto_get_section_data, lto_free_section_data): Update prototypes
(lto_get_raw_section_data, lto_free_raw_section_data): Declare.
(lto_write_raw_data): Declare.
(lto_begin_section): Remove FIXME.
(lto_write_raw_data): New function.
(lto_write_stream): Remove FIXME.
(lto_new_out_decl_state): Set compressed flag.
* lto.c (lto_read_in_decl_state): Unpickle compressed bit.
From-SVN: r231593
-rw-r--r-- | gcc/ChangeLog | 21 | ||||
-rw-r--r-- | gcc/cgraph.c | 6 | ||||
-rw-r--r-- | gcc/lto-section-in.c | 36 | ||||
-rw-r--r-- | gcc/lto-streamer.h | 21 | ||||
-rw-r--r-- | gcc/lto/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/lto/lto.c | 2 | ||||
-rw-r--r-- | gcc/varpool.c | 6 |
7 files changed, 81 insertions, 15 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2ec0e5b..1e68758 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,26 @@ 2015-12-10 Jan Hubicka <hubicka@ucw.cz> + * cgraph.c (cgraph_node::get_untransformed_body): Pass compressed + flag to lto_get_section_data. + * varpool.c (varpool_node::get_constructor): Likewise. + * lto-section-in.c (lto_get_section_data): Add new flag decompress. + (lto_free_section_data): Likewise. + (lto_get_raw_section_data): New function. + (lto_free_raw_section_data): New function. + (copy_function_or_variable): Copy sections w/o decompressing. + (lto_output_decl_state_refs): Picke compressed bit. + * lto-streamer.h (lto_in_decl_state): New flag compressed. + (lto_out_decl_state): Likewise. + (lto_get_section_data, lto_free_section_data): Update prototypes + (lto_get_raw_section_data, lto_free_raw_section_data): Declare. + (lto_write_raw_data): Declare. + (lto_begin_section): Remove FIXME. + (lto_write_raw_data): New function. + (lto_write_stream): Remove FIXME. + (lto_new_out_decl_state): Set compressed flag. + +2015-12-10 Jan Hubicka <hubicka@ucw.cz> + * tree.c (free_lang_data_in_type, find_decls_types_r): Also free unnecesary type decls. * tree.h (is_redundant_typedef): Declare. diff --git a/gcc/cgraph.c b/gcc/cgraph.c index 35cd98c..c8c3370 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -3251,9 +3251,11 @@ cgraph_node::get_untransformed_body (void) /* We may have renamed the declaration, e.g., a static function. */ name = lto_get_decl_name_mapping (file_data, name); + struct lto_in_decl_state *decl_state + = lto_get_function_in_decl_state (file_data, decl); data = lto_get_section_data (file_data, LTO_section_function_body, - name, &len); + name, &len, decl_state->compressed); if (!data) fatal_error (input_location, "%s: section %s is missing", file_data->file_name, @@ -3264,7 +3266,7 @@ cgraph_node::get_untransformed_body (void) lto_input_function_body (file_data, this, data); lto_stats.num_function_bodies++; lto_free_section_data (file_data, LTO_section_function_body, name, - data, len); + data, len, decl_state->compressed); lto_free_function_in_decl_state_for_node (this); /* Keep lto file data so ipa-inline-analysis knows about cross module inlining. */ diff --git a/gcc/lto-section-in.c b/gcc/lto-section-in.c index e7ace09..1529fdd 100644 --- a/gcc/lto-section-in.c +++ b/gcc/lto-section-in.c @@ -130,7 +130,7 @@ const char * lto_get_section_data (struct lto_file_decl_data *file_data, enum lto_section_type section_type, const char *name, - size_t *len) + size_t *len, bool decompress) { const char *data = (get_section_f) (file_data, section_type, name, len); const size_t header_length = sizeof (struct lto_data_header); @@ -142,9 +142,10 @@ lto_get_section_data (struct lto_file_decl_data *file_data, if (data == NULL) return NULL; - /* FIXME lto: WPA mode does not write compressed sections, so for now - suppress uncompression if flag_ltrans. */ - if (!flag_ltrans) + /* WPA->ltrans streams are not compressed with exception of function bodies + and variable initializers that has been verbatim copied from earlier + compilations. */ + if (!flag_ltrans || decompress) { /* Create a mapping header containing the underlying data and length, and prepend this to the uncompression buffer. The uncompressed data @@ -170,6 +171,16 @@ lto_get_section_data (struct lto_file_decl_data *file_data, return data; } +/* Get the section data without any header parsing or uncompression. */ + +const char * +lto_get_raw_section_data (struct lto_file_decl_data *file_data, + enum lto_section_type section_type, + const char *name, + size_t *len) +{ + return (get_section_f) (file_data, section_type, name, len); +} /* Free the data found from the above call. The first three parameters are the same as above. DATA is the data to be freed and @@ -180,7 +191,7 @@ lto_free_section_data (struct lto_file_decl_data *file_data, enum lto_section_type section_type, const char *name, const char *data, - size_t len) + size_t len, bool decompress) { const size_t header_length = sizeof (struct lto_data_header); const char *real_data = data - header_length; @@ -189,9 +200,7 @@ lto_free_section_data (struct lto_file_decl_data *file_data, gcc_assert (free_section_f); - /* FIXME lto: WPA mode does not write compressed sections, so for now - suppress uncompression mapping if flag_ltrans. */ - if (flag_ltrans) + if (flag_ltrans && !decompress) { (free_section_f) (file_data, section_type, name, data, len); return; @@ -203,6 +212,17 @@ lto_free_section_data (struct lto_file_decl_data *file_data, free (CONST_CAST (char *, real_data)); } +/* Free data allocated by lto_get_raw_section_data. */ + +void +lto_free_raw_section_data (struct lto_file_decl_data *file_data, + enum lto_section_type section_type, + const char *name, + const char *data, + size_t len) +{ + (free_section_f) (file_data, section_type, name, data, len); +} /* Load a section of type SECTION_TYPE from FILE_DATA, parse the header and then return an input block pointing to the section. The diff --git a/gcc/lto-streamer.h b/gcc/lto-streamer.h index f4997aa..06c8d7a 100644 --- a/gcc/lto-streamer.h +++ b/gcc/lto-streamer.h @@ -501,6 +501,9 @@ struct GTY((for_user)) lto_in_decl_state /* If this in-decl state is associated with a function. FN_DECL point to the FUNCTION_DECL. */ tree fn_decl; + + /* True if decl state is compressed. */ + bool compressed; }; typedef struct lto_in_decl_state *lto_in_decl_state_ptr; @@ -534,6 +537,9 @@ struct lto_out_decl_state /* If this out-decl state belongs to a function, fn_decl points to that function. Otherwise, it is NULL. */ tree fn_decl; + + /* True if decl state is compressed. */ + bool compressed; }; typedef struct lto_out_decl_state *lto_out_decl_state_ptr; @@ -758,10 +764,18 @@ extern void lto_set_in_hooks (struct lto_file_decl_data **, extern struct lto_file_decl_data **lto_get_file_decl_data (void); extern const char *lto_get_section_data (struct lto_file_decl_data *, enum lto_section_type, - const char *, size_t *); + const char *, size_t *, + bool decompress = false); +extern const char *lto_get_raw_section_data (struct lto_file_decl_data *, + enum lto_section_type, + const char *, size_t *); extern void lto_free_section_data (struct lto_file_decl_data *, - enum lto_section_type, - const char *, const char *, size_t); + enum lto_section_type, + const char *, const char *, size_t, + bool decompress = false); +extern void lto_free_raw_section_data (struct lto_file_decl_data *, + enum lto_section_type, + const char *, const char *, size_t); extern htab_t lto_create_renaming_table (void); extern void lto_record_renamed_decl (struct lto_file_decl_data *, const char *, const char *); @@ -782,6 +796,7 @@ extern void lto_value_range_error (const char *, extern void lto_begin_section (const char *, bool); extern void lto_end_section (void); extern void lto_write_data (const void *, unsigned int); +extern void lto_write_raw_data (const void *, unsigned int); extern void lto_write_stream (struct lto_output_stream *); extern bool lto_output_decl_index (struct lto_output_stream *, struct lto_tree_ref_encoder *, diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index f0d90fc..6e90527 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,7 @@ +2015-12-10 Jan Hubicka <hubicka@ucw.cz> + + * lto.c (lto_read_in_decl_state): Unpickle compressed bit. + 2015-12-11 Jan Hubicka <hubicka@ucw.cz> PR ipa/61886 diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c index 1b11439..fcf7caf 100644 --- a/gcc/lto/lto.c +++ b/gcc/lto/lto.c @@ -234,6 +234,8 @@ lto_read_in_decl_state (struct data_in *data_in, const uint32_t *data, uint32_t i, j; ix = *data++; + state->compressed = ix & 1; + ix /= 2; decl = streamer_tree_cache_get_tree (data_in->reader_cache, ix); if (!VAR_OR_FUNCTION_DECL_P (decl)) { diff --git a/gcc/varpool.c b/gcc/varpool.c index ac77269..5e4fcbf 100644 --- a/gcc/varpool.c +++ b/gcc/varpool.c @@ -296,9 +296,11 @@ varpool_node::get_constructor (void) /* We may have renamed the declaration, e.g., a static function. */ name = lto_get_decl_name_mapping (file_data, name); + struct lto_in_decl_state *decl_state + = lto_get_function_in_decl_state (file_data, decl); data = lto_get_section_data (file_data, LTO_section_function_body, - name, &len); + name, &len, decl_state->compressed); if (!data) fatal_error (input_location, "%s: section %s is missing", file_data->file_name, @@ -308,7 +310,7 @@ varpool_node::get_constructor (void) gcc_assert (DECL_INITIAL (decl) != error_mark_node); lto_stats.num_function_bodies++; lto_free_section_data (file_data, LTO_section_function_body, name, - data, len); + data, len, decl_state->compressed); lto_free_function_in_decl_state_for_node (this); timevar_pop (TV_IPA_LTO_CTORS_IN); return DECL_INITIAL (decl); |