summaryrefslogtreecommitdiff
path: root/gcc/lto-section-in.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2013-08-30 07:33:06 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2013-08-30 07:33:06 +0000
commit5f74a0740ef4284ab6d53f079fa304a253abd759 (patch)
tree64eb6436c13bf84949443327cd89e6ca2e8bee1c /gcc/lto-section-in.c
parent1a74893f2d74cd02e2957f666d2fdf63449f9e69 (diff)
downloadgcc-5f74a0740ef4284ab6d53f079fa304a253abd759.tar.gz
* lto-symtab.c (lto_cgraph_replace_node): Free decl_in_state.
* cgraph.c (cgraph_release_function_body): Free decl_in_state. * lto-section-in.c (lto_free_function_in_decl_state): New function. (lto_free_function_in_decl_state_for_node): New function. * lto.c (read_cgraph_and_symbols): Remove ggc_collect; clear section node; add comment why we do not collect. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@202093 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/lto-section-in.c')
-rw-r--r--gcc/lto-section-in.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/gcc/lto-section-in.c b/gcc/lto-section-in.c
index 0ef421f6167..5821030d4cf 100644
--- a/gcc/lto-section-in.c
+++ b/gcc/lto-section-in.c
@@ -414,6 +414,41 @@ lto_get_function_in_decl_state (struct lto_file_decl_data *file_data,
return slot? ((struct lto_in_decl_state*) *slot) : NULL;
}
+/* Free decl_states. */
+
+void
+lto_free_function_in_decl_state (struct lto_in_decl_state *state)
+{
+ int i;
+ for (i = 0; i < LTO_N_DECL_STREAMS; i++)
+ ggc_free (state->streams[i].trees);
+ ggc_free (state);
+}
+
+/* Free decl_states associated with NODE. This makes it possible to furhter
+ release trees needed by the NODE's body. */
+
+void
+lto_free_function_in_decl_state_for_node (symtab_node node)
+{
+ struct lto_in_decl_state temp;
+ void **slot;
+
+ if (!node->symbol.lto_file_data)
+ return;
+
+ temp.fn_decl = node->symbol.decl;
+ slot = htab_find_slot (node->symbol.lto_file_data->function_decl_states,
+ &temp, NO_INSERT);
+ if (slot && *slot)
+ {
+ lto_free_function_in_decl_state ((struct lto_in_decl_state*) *slot);
+ htab_clear_slot (node->symbol.lto_file_data->function_decl_states,
+ slot);
+ }
+ node->symbol.lto_file_data = NULL;
+}
+
/* Report read pass end of the section. */