Commit e75f8f79 by Jan Hubicka Committed by Jan Hubicka

lto-cgraph.c (lto_symtab_encoder_new): New parameter FOR_INPUT.


	* lto-cgraph.c (lto_symtab_encoder_new): New parameter FOR_INPUT.
	(lto_symtab_encoder_delete): Update.
	(lto_symtab_encoder_encode): Update.
	(compute_ltrans_boundary): Update.
	(input_symtab): Update.
 	* lto-streamer.h (lto_symtab_encoder_new): Update.
	
	* lto.c (read_cgraph_and_symbols): Release type merging hash early;
	release input encoders.
	* lto-partition.c (new_partition): Update for new lto_symtab_encoder_new.

From-SVN: r192184
parent 7c9bc875
2012-10-07 Jan Hubicka <jh@suse.cz>
* lto-cgraph.c (lto_symtab_encoder_new): New parameter FOR_INPUT.
(lto_symtab_encoder_delete): Update.
(lto_symtab_encoder_encode): Update.
(compute_ltrans_boundary): Update.
(input_symtab): Update.
* lto-streamer.h (lto_symtab_encoder_new): Update.
2012-10-07 Richard Sandiford <rdsandiford@googlemail.com> 2012-10-07 Richard Sandiford <rdsandiford@googlemail.com>
* config/mips/mips-protos.h (mips_split_type): New enum. * config/mips/mips-protos.h (mips_split_type): New enum.
......
...@@ -72,13 +72,17 @@ enum LTO_symtab_tags ...@@ -72,13 +72,17 @@ enum LTO_symtab_tags
LTO_symtab_last_tag LTO_symtab_last_tag
}; };
/* Create a new symtab encoder. */ /* Create a new symtab encoder.
if FOR_INPUT, the encoder allocate only datastructures needed
to read the symtab. */
lto_symtab_encoder_t lto_symtab_encoder_t
lto_symtab_encoder_new (void) lto_symtab_encoder_new (bool for_input)
{ {
lto_symtab_encoder_t encoder = XCNEW (struct lto_symtab_encoder_d); lto_symtab_encoder_t encoder = XCNEW (struct lto_symtab_encoder_d);
encoder->map = pointer_map_create ();
if (!for_input)
encoder->map = pointer_map_create ();
encoder->nodes = NULL; encoder->nodes = NULL;
return encoder; return encoder;
} }
...@@ -90,7 +94,8 @@ void ...@@ -90,7 +94,8 @@ void
lto_symtab_encoder_delete (lto_symtab_encoder_t encoder) lto_symtab_encoder_delete (lto_symtab_encoder_t encoder)
{ {
VEC_free (lto_encoder_entry, heap, encoder->nodes); VEC_free (lto_encoder_entry, heap, encoder->nodes);
pointer_map_destroy (encoder->map); if (encoder->map)
pointer_map_destroy (encoder->map);
free (encoder); free (encoder);
} }
...@@ -106,6 +111,15 @@ lto_symtab_encoder_encode (lto_symtab_encoder_t encoder, ...@@ -106,6 +111,15 @@ lto_symtab_encoder_encode (lto_symtab_encoder_t encoder,
int ref; int ref;
void **slot; void **slot;
if (!encoder->map)
{
lto_encoder_entry entry = {node, false, false, false};
ref = VEC_length (lto_encoder_entry, encoder->nodes);
VEC_safe_push (lto_encoder_entry, heap, encoder->nodes, entry);
return ref;
}
slot = pointer_map_contains (encoder->map, node); slot = pointer_map_contains (encoder->map, node);
if (!slot || !*slot) if (!slot || !*slot)
{ {
...@@ -688,7 +702,7 @@ compute_ltrans_boundary (lto_symtab_encoder_t in_encoder) ...@@ -688,7 +702,7 @@ compute_ltrans_boundary (lto_symtab_encoder_t in_encoder)
lto_symtab_encoder_t encoder; lto_symtab_encoder_t encoder;
lto_symtab_encoder_iterator lsei; lto_symtab_encoder_iterator lsei;
encoder = lto_symtab_encoder_new (); encoder = lto_symtab_encoder_new (false);
/* Go over all entries in the IN_ENCODER and duplicate them to /* Go over all entries in the IN_ENCODER and duplicate them to
ENCODER. At the same time insert masters of clones so ENCODER. At the same time insert masters of clones so
...@@ -1316,7 +1330,7 @@ input_symtab (void) ...@@ -1316,7 +1330,7 @@ input_symtab (void)
if (!ib) if (!ib)
fatal_error ("cannot find LTO cgraph in %s", file_data->file_name); fatal_error ("cannot find LTO cgraph in %s", file_data->file_name);
input_profile_summary (ib, file_data); input_profile_summary (ib, file_data);
file_data->symtab_node_encoder = lto_symtab_encoder_new (); file_data->symtab_node_encoder = lto_symtab_encoder_new (true);
nodes = input_cgraph_1 (file_data, ib); nodes = input_cgraph_1 (file_data, ib);
lto_destroy_simple_input_block (file_data, LTO_section_symtab_nodes, lto_destroy_simple_input_block (file_data, LTO_section_symtab_nodes,
ib, data, len); ib, data, len);
......
...@@ -833,7 +833,7 @@ void lto_output_location (struct output_block *, location_t); ...@@ -833,7 +833,7 @@ void lto_output_location (struct output_block *, location_t);
/* In lto-cgraph.c */ /* In lto-cgraph.c */
lto_symtab_encoder_t lto_symtab_encoder_new (void); lto_symtab_encoder_t lto_symtab_encoder_new (bool);
int lto_symtab_encoder_encode (lto_symtab_encoder_t, symtab_node); int lto_symtab_encoder_encode (lto_symtab_encoder_t, symtab_node);
void lto_symtab_encoder_delete (lto_symtab_encoder_t); void lto_symtab_encoder_delete (lto_symtab_encoder_t);
bool lto_symtab_encoder_delete_node (lto_symtab_encoder_t, symtab_node); bool lto_symtab_encoder_delete_node (lto_symtab_encoder_t, symtab_node);
......
2012-10-07 Jan Hubicka <jh@suse.cz>
* lto.c (read_cgraph_and_symbols): Release type merging hash early;
release input encoders.
* lto-partition.c (new_partition): Update for new lto_symtab_encoder_new.
2012-10-06 Jan Hubicka <jh@suse.cz> 2012-10-06 Jan Hubicka <jh@suse.cz>
PR lto/54790 PR lto/54790
......
...@@ -99,7 +99,7 @@ static ltrans_partition ...@@ -99,7 +99,7 @@ static ltrans_partition
new_partition (const char *name) new_partition (const char *name)
{ {
ltrans_partition part = XCNEW (struct ltrans_partition_def); ltrans_partition part = XCNEW (struct ltrans_partition_def);
part->encoder = lto_symtab_encoder_new (); part->encoder = lto_symtab_encoder_new (false);
part->name = name; part->name = name;
part->insns = 0; part->insns = 0;
VEC_safe_push (ltrans_partition, heap, ltrans_partitions, part); VEC_safe_push (ltrans_partition, heap, ltrans_partitions, part);
......
...@@ -2946,6 +2946,17 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames) ...@@ -2946,6 +2946,17 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames)
if (resolution_file_name) if (resolution_file_name)
fclose (resolution); fclose (resolution);
/* Free gimple type merging datastructures. */
htab_delete (gimple_types);
gimple_types = NULL;
htab_delete (type_hash_cache);
type_hash_cache = NULL;
free (type_pair_cache);
type_pair_cache = NULL;
gimple_type_leader = NULL;
free_gimple_type_tables ();
ggc_collect ();
/* Set the hooks so that all of the ipa passes can read in their data. */ /* Set the hooks so that all of the ipa passes can read in their data. */
lto_set_in_hooks (all_file_decl_data, get_section_data, free_section_data); lto_set_in_hooks (all_file_decl_data, get_section_data, free_section_data);
...@@ -2989,18 +3000,10 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames) ...@@ -2989,18 +3000,10 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames)
if (seen_error ()) if (seen_error ())
fatal_error ("errors during merging of translation units"); fatal_error ("errors during merging of translation units");
/* Fixup all decls and types and free the type hash tables. */ /* Fixup all decls. */
lto_fixup_decls (all_file_decl_data); lto_fixup_decls (all_file_decl_data);
htab_delete (tree_with_vars); htab_delete (tree_with_vars);
tree_with_vars = NULL; tree_with_vars = NULL;
htab_delete (gimple_types);
gimple_types = NULL;
htab_delete (type_hash_cache);
type_hash_cache = NULL;
free (type_pair_cache);
type_pair_cache = NULL;
gimple_type_leader = NULL;
free_gimple_type_tables ();
ggc_collect (); ggc_collect ();
timevar_pop (TV_IPA_LTO_DECL_MERGE); timevar_pop (TV_IPA_LTO_DECL_MERGE);
...@@ -3015,6 +3018,13 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames) ...@@ -3015,6 +3018,13 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames)
else else
ipa_read_summaries (); ipa_read_summaries ();
for (i = 0; all_file_decl_data[i]; i++)
{
gcc_assert (all_file_decl_data[i]->symtab_node_encoder);
lto_symtab_encoder_delete (all_file_decl_data[i]->symtab_node_encoder);
all_file_decl_data[i]->symtab_node_encoder = NULL;
}
/* Finally merge the cgraph according to the decl merging decisions. */ /* Finally merge the cgraph according to the decl merging decisions. */
timevar_push (TV_IPA_LTO_CGRAPH_MERGE); timevar_push (TV_IPA_LTO_CGRAPH_MERGE);
if (cgraph_dump_file) if (cgraph_dump_file)
......
...@@ -2544,7 +2544,7 @@ ipa_write_summaries (void) ...@@ -2544,7 +2544,7 @@ ipa_write_summaries (void)
if (!flag_generate_lto || seen_error ()) if (!flag_generate_lto || seen_error ())
return; return;
encoder = lto_symtab_encoder_new (); encoder = lto_symtab_encoder_new (false);
/* Create the callgraph set in the same order used in /* Create the callgraph set in the same order used in
cgraph_expand_all_functions. This mostly facilitates debugging, cgraph_expand_all_functions. This mostly facilitates debugging,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment