From 1cb1a99f77b15cd8342ffbb0cd89cc0110350c48 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Tue, 3 May 2011 19:22:58 +0200 Subject: cgraph.h (cgraph_node_set_def, [...]): Move out of GTY; replace hash by pointer map. * cgraph.h (cgraph_node_set_def, varpool_node_set_def): Move out of GTY; replace hash by pointer map. (cgraph_node_set_element_def, cgraph_node_set_element, const_cgraph_node_set_element, varpool_node_set_element_def, varpool_node_set_element, const_varpool_node_set_element): Remove. (free_cgraph_node_set, free_varpool_node_set): New function. (cgraph_node_set_size, varpool_node_set_size): Use vector size. * tree-emutls.c: Free varpool node set. * ipa-utils.c (cgraph_node_set_new, cgraph_node_set_add, cgraph_node_set_remove, cgraph_node_set_find, dump_cgraph_node_set, debug_cgraph_node_set, free_cgraph_node_set, varpool_node_set_new, varpool_node_set_add, varpool_node_set_remove, varpool_node_set_find, dump_varpool_node_set, free_varpool_node_set, debug_varpool_node_set): Move here from ipa.c; implement using pointer_map * ipa.c (cgraph_node_set_new, cgraph_node_set_add, cgraph_node_set_remove, cgraph_node_set_find, dump_cgraph_node_set, debug_cgraph_node_set, varpool_node_set_new, varpool_node_set_add, varpool_node_set_remove, varpool_node_set_find, dump_varpool_node_set, debug_varpool_node_set): Move to ipa-uitls.c. * lto/lto.c (ltrans_partition_def): Remove GTY annotations. (ltrans_partitions): Move to heap. (new_partition): Update. (free_ltrans_partitions): New function. (lto_wpa_write_files): Use it. * passes.c (ipa_write_summaries): Update. From-SVN: r173334 --- gcc/lto/ChangeLog | 8 ++++++++ gcc/lto/lto.c | 28 ++++++++++++++++++++++------ 2 files changed, 30 insertions(+), 6 deletions(-) (limited to 'gcc/lto') diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index efcd633..dea5f64 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,11 @@ +2011-05-03 Jan Hubicka + + * lto.c (ltrans_partition_def): Remove GTY annotations. + (ltrans_partitions): Move to heap. + (new_partition): Update. + (free_ltrans_partitions): New function. + (lto_wpa_write_files): Use it. + 2011-04-29 Martin Jambor * lto.c: Include ipa-utils.h. diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c index a8027a4..9407a17 100644 --- a/gcc/lto/lto.c +++ b/gcc/lto/lto.c @@ -1127,19 +1127,19 @@ free_section_data (struct lto_file_decl_data *file_data ATTRIBUTE_UNUSED, /* Structure describing ltrans partitions. */ -struct GTY (()) ltrans_partition_def +struct ltrans_partition_def { cgraph_node_set cgraph_set; varpool_node_set varpool_set; - const char * GTY ((skip)) name; + const char * name; int insns; }; typedef struct ltrans_partition_def *ltrans_partition; DEF_VEC_P(ltrans_partition); -DEF_VEC_ALLOC_P(ltrans_partition,gc); +DEF_VEC_ALLOC_P(ltrans_partition,heap); -static GTY (()) VEC(ltrans_partition, gc) *ltrans_partitions; +static VEC(ltrans_partition, heap) *ltrans_partitions; static void add_cgraph_node_to_partition (ltrans_partition part, struct cgraph_node *node); static void add_varpool_node_to_partition (ltrans_partition part, struct varpool_node *vnode); @@ -1148,15 +1148,29 @@ static void add_varpool_node_to_partition (ltrans_partition part, struct varpool static ltrans_partition new_partition (const char *name) { - ltrans_partition part = ggc_alloc_ltrans_partition_def (); + ltrans_partition part = XCNEW (struct ltrans_partition_def); part->cgraph_set = cgraph_node_set_new (); part->varpool_set = varpool_node_set_new (); part->name = name; part->insns = 0; - VEC_safe_push (ltrans_partition, gc, ltrans_partitions, part); + VEC_safe_push (ltrans_partition, heap, ltrans_partitions, part); return part; } +/* Free memory used by ltrans datastructures. */ +static void +free_ltrans_partitions () +{ + unsigned int idx; + ltrans_partition part; + for (idx = 0; VEC_iterate (ltrans_partition, ltrans_partitions, idx, part); idx++) + { + free_cgraph_node_set (part->cgraph-set); + free (part); + } + VEC_free (latrans_partition, heap, ltrans_partitions); +} + /* See all references that go to comdat objects and bring them into partition too. */ static void add_references_to_partition (ltrans_partition part, struct ipa_ref_list *refs) @@ -1977,6 +1991,8 @@ lto_wpa_write_files (void) if (fclose (ltrans_output_list_stream)) fatal_error ("closing LTRANS output list %s: %m", ltrans_output_list); + free_ltrans_partitions(); + timevar_pop (TV_WHOPR_WPA_IO); } -- cgit v1.1