+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
/* 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,
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. */
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);
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
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
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;
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;
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
/* 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;
/* 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;
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 *);
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 *,
+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
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))
{
/* 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,
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);