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 /gcc/lto-section-in.c | |
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
Diffstat (limited to 'gcc/lto-section-in.c')
-rw-r--r-- | gcc/lto-section-in.c | 36 |
1 files changed, 28 insertions, 8 deletions
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 |