summaryrefslogtreecommitdiff
path: root/gcc/lto-cgraph.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2012-10-07 17:16:02 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2012-10-07 17:16:02 +0000
commitb8925abddf74b7f8630817c04b392610e8449ff1 (patch)
tree087897b09e6c3cf173e2c0cc37e7b9dc85b7043a /gcc/lto-cgraph.c
parent814225d3103c52c69a3e9e6634d86670dc3258e5 (diff)
downloadgcc-b8925abddf74b7f8630817c04b392610e8449ff1.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@192184 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/lto-cgraph.c')
-rw-r--r--gcc/lto-cgraph.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c
index f96ed3d36d3..4f952f59bf9 100644
--- a/gcc/lto-cgraph.c
+++ b/gcc/lto-cgraph.c
@@ -72,13 +72,17 @@ enum LTO_symtab_tags
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_new (void)
+lto_symtab_encoder_new (bool for_input)
{
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;
return encoder;
}
@@ -90,7 +94,8 @@ void
lto_symtab_encoder_delete (lto_symtab_encoder_t encoder)
{
VEC_free (lto_encoder_entry, heap, encoder->nodes);
- pointer_map_destroy (encoder->map);
+ if (encoder->map)
+ pointer_map_destroy (encoder->map);
free (encoder);
}
@@ -106,6 +111,15 @@ lto_symtab_encoder_encode (lto_symtab_encoder_t encoder,
int ref;
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);
if (!slot || !*slot)
{
@@ -688,7 +702,7 @@ compute_ltrans_boundary (lto_symtab_encoder_t in_encoder)
lto_symtab_encoder_t encoder;
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
ENCODER. At the same time insert masters of clones so
@@ -1316,7 +1330,7 @@ input_symtab (void)
if (!ib)
fatal_error ("cannot find LTO cgraph in %s", file_data->file_name);
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);
lto_destroy_simple_input_block (file_data, LTO_section_symtab_nodes,
ib, data, len);