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
This commit is contained in:
parent
b44c0c0c7f
commit
ca83487662
|
@ -1,3 +1,24 @@
|
|||
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
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
@ -757,9 +763,17 @@ extern void lto_set_in_hooks (struct lto_file_decl_data **,
|
|||
lto_free_section_data_f *);
|
||||
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 *,
|
||||
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,
|
||||
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);
|
||||
|
@ -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 *,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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))
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue