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. From-SVN: r231594
This commit is contained in:
parent
ca83487662
commit
7fa658c2cc
@ -66,9 +66,6 @@ lto_begin_section (const char *name, bool compress)
|
||||
{
|
||||
lang_hooks.lto.begin_section (name);
|
||||
|
||||
/* FIXME lto: for now, suppress compression if the lang_hook that appends
|
||||
data is anything other than assembler output. The effect here is that
|
||||
we get compression of IL only in non-ltrans object files. */
|
||||
gcc_assert (compression_stream == NULL);
|
||||
if (compress)
|
||||
compression_stream = lto_start_compression (lto_append_data, NULL);
|
||||
@ -99,6 +96,14 @@ lto_write_data (const void *data, unsigned int size)
|
||||
lang_hooks.lto.append_data ((const char *)data, size, NULL);
|
||||
}
|
||||
|
||||
/* Write SIZE bytes starting at DATA to the assembler. */
|
||||
|
||||
void
|
||||
lto_write_raw_data (const void *data, unsigned int size)
|
||||
{
|
||||
lang_hooks.lto.append_data ((const char *)data, size, NULL);
|
||||
}
|
||||
|
||||
/* Write all of the chars in OBS to the assembler. Recycle the blocks
|
||||
in obs as this is being done. */
|
||||
|
||||
@ -123,10 +128,6 @@ lto_write_stream (struct lto_output_stream *obs)
|
||||
if (!next_block)
|
||||
num_chars -= obs->left_in_block;
|
||||
|
||||
/* FIXME lto: WPA mode uses an ELF function as a lang_hook to append
|
||||
output data. This hook is not happy with the way that compression
|
||||
blocks up output differently to the way it's blocked here. So for
|
||||
now, we don't compress WPA output. */
|
||||
if (compression_stream)
|
||||
lto_compress_block (compression_stream, base, num_chars);
|
||||
else
|
||||
@ -295,6 +296,9 @@ lto_new_out_decl_state (void)
|
||||
for (i = 0; i < LTO_N_DECL_STREAMS; i++)
|
||||
lto_init_tree_ref_encoder (&state->streams[i]);
|
||||
|
||||
/* At WPA time we do not compress sections by default. */
|
||||
state->compressed = !flag_wpa;
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
|
@ -2191,22 +2191,23 @@ copy_function_or_variable (struct symtab_node *node)
|
||||
struct lto_in_decl_state *in_state;
|
||||
struct lto_out_decl_state *out_state = lto_get_out_decl_state ();
|
||||
|
||||
lto_begin_section (section_name, !flag_wpa);
|
||||
lto_begin_section (section_name, false);
|
||||
free (section_name);
|
||||
|
||||
/* We may have renamed the declaration, e.g., a static function. */
|
||||
name = lto_get_decl_name_mapping (file_data, name);
|
||||
|
||||
data = lto_get_section_data (file_data, LTO_section_function_body,
|
||||
name, &len);
|
||||
data = lto_get_raw_section_data (file_data, LTO_section_function_body,
|
||||
name, &len);
|
||||
gcc_assert (data);
|
||||
|
||||
/* Do a bit copy of the function body. */
|
||||
lto_write_data (data, len);
|
||||
lto_write_raw_data (data, len);
|
||||
|
||||
/* Copy decls. */
|
||||
in_state =
|
||||
lto_get_function_in_decl_state (node->lto_file_data, function);
|
||||
out_state->compressed = in_state->compressed;
|
||||
gcc_assert (in_state);
|
||||
|
||||
for (i = 0; i < LTO_N_DECL_STREAMS; i++)
|
||||
@ -2224,8 +2225,8 @@ copy_function_or_variable (struct symtab_node *node)
|
||||
encoder->trees.safe_push ((*trees)[j]);
|
||||
}
|
||||
|
||||
lto_free_section_data (file_data, LTO_section_function_body, name,
|
||||
data, len);
|
||||
lto_free_raw_section_data (file_data, LTO_section_function_body, name,
|
||||
data, len);
|
||||
lto_end_section ();
|
||||
}
|
||||
|
||||
@ -2431,6 +2432,7 @@ lto_output_decl_state_refs (struct output_block *ob,
|
||||
decl = (state->fn_decl) ? state->fn_decl : void_type_node;
|
||||
streamer_tree_cache_lookup (ob->writer_cache, decl, &ref);
|
||||
gcc_assert (ref != (unsigned)-1);
|
||||
ref = ref * 2 + (state->compressed ? 1 : 0);
|
||||
lto_write_data (&ref, sizeof (uint32_t));
|
||||
|
||||
for (i = 0; i < LTO_N_DECL_STREAMS; i++)
|
||||
|
Loading…
Reference in New Issue
Block a user