summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2015-12-13 02:13:15 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2015-12-13 02:13:15 +0000
commit3afbcf4cd22c81332431b9d387b1ef616310a5fe (patch)
tree53aa432f12e511d7d5bf93c922661e1f9b2417ec
parent6cbd82a69bcb08f4fc4f7ab478101809dd1b9268 (diff)
downloadgcc-3afbcf4cd22c81332431b9d387b1ef616310a5fe.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@231594 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/lto-section-out.c18
-rw-r--r--gcc/lto-streamer-out.c14
2 files changed, 19 insertions, 13 deletions
diff --git a/gcc/lto-section-out.c b/gcc/lto-section-out.c
index 56b460bea54..f547cc3b62c 100644
--- a/gcc/lto-section-out.c
+++ b/gcc/lto-section-out.c
@@ -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;
}
diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c
index 5524f84dc06..049313dd1bd 100644
--- a/gcc/lto-streamer-out.c
+++ b/gcc/lto-streamer-out.c
@@ -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++)