summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>1999-09-16 01:12:25 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>1999-09-16 01:12:25 +0000
commit3c3bb26851dc0028e761a92256ad356cb3644b7a (patch)
tree0b720d86986661e0024880e115976d9fa928b8f1
parentf45c08bf71c972d86b29e21a3c7b32c9ce41a616 (diff)
downloadgcc-3c3bb26851dc0028e761a92256ad356cb3644b7a.tar.gz
* emit-rtl.c (free_emit_status): Don't check DECL_DEFER_OUTPUT.
Free the struct. (mark_emit_status): Renamed from mark_emit_state. * except.c (mark_eh_status): Renamed from mark_eh_state. Check not null before marking. (free_eh_status): New. * expr.c (mark_expr_status, free_expr_status): New. * function.c (free_machine_status): New. (free_after_parsing): New. (free_after_compilation): Move bits to free_after_parsing; call free_eh_status, free_expr_status; zero the marked members of the function state. (prepare_function_start): No can_garbage_collect. Call init_eh_for_function. (expand_dummy_function_end): Free up current_function state. (mark_function_status): Renamed from mark_function_state. (mark_function_chain): No can_garbage_collect. Call mark_expr_status. * function.h (struct function): No can_garbage_collect. (free_machine_status, free_after_parsing): Declare. (free_eh_status, free_expr_status): Declare. * ggc.h (mark_expr_status): Declare. * stmt.c (free_stmt_status): Free the struct. (mark_stmt_status): Renamed from mark_stmt_state. (init_stmt): Don't call init_eh. (init_stmt_for_function): Don't call init_eh_for_function. * toplev.c (compile_file): Call init_eh. (rest_of_compilation): Free basic block info before ggc_collect. Call free_after_parsing; conditionally call free_after_compilation. * varasm.c (mark_varasm_status): Renamed from mark_varasm_state. Check not null before marking. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@29448 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog34
-rw-r--r--gcc/emit-rtl.c8
-rw-r--r--gcc/except.c16
-rw-r--r--gcc/expr.c20
-rw-r--r--gcc/function.c89
-rw-r--r--gcc/function.h8
-rw-r--r--gcc/ggc.h10
-rw-r--r--gcc/stmt.c9
-rw-r--r--gcc/toplev.c11
-rw-r--r--gcc/varasm.c17
10 files changed, 165 insertions, 57 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index aff2d71ac04..63a9a6f120a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,37 @@
+Wed Sep 15 17:56:00 1999 Richard Henderson <rth@cygnus.com>
+
+ * emit-rtl.c (free_emit_status): Don't check DECL_DEFER_OUTPUT.
+ Free the struct.
+ (mark_emit_status): Renamed from mark_emit_state.
+ * except.c (mark_eh_status): Renamed from mark_eh_state.
+ Check not null before marking.
+ (free_eh_status): New.
+ * expr.c (mark_expr_status, free_expr_status): New.
+ * function.c (free_machine_status): New.
+ (free_after_parsing): New.
+ (free_after_compilation): Move bits to free_after_parsing; call
+ free_eh_status, free_expr_status; zero the marked members of the
+ function state.
+ (prepare_function_start): No can_garbage_collect.
+ Call init_eh_for_function.
+ (expand_dummy_function_end): Free up current_function state.
+ (mark_function_status): Renamed from mark_function_state.
+ (mark_function_chain): No can_garbage_collect. Call mark_expr_status.
+ * function.h (struct function): No can_garbage_collect.
+ (free_machine_status, free_after_parsing): Declare.
+ (free_eh_status, free_expr_status): Declare.
+ * ggc.h (mark_expr_status): Declare.
+ * stmt.c (free_stmt_status): Free the struct.
+ (mark_stmt_status): Renamed from mark_stmt_state.
+ (init_stmt): Don't call init_eh.
+ (init_stmt_for_function): Don't call init_eh_for_function.
+ * toplev.c (compile_file): Call init_eh.
+ (rest_of_compilation): Free basic block info before ggc_collect.
+ Call free_after_parsing; conditionally call free_after_compilation.
+ * varasm.c (mark_varasm_status): Renamed from mark_varasm_state.
+ Check not null before marking.
+ (free_varasm_status): Don't check DECL_DEFER_OUTPUT. Free the struct.
+
Wed Sep 15 17:53:16 1999 Richard Henderson <rth@cygnus.com>
* c-lex.c (yylex): Initialize warn.
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 70b080eb37c..08f8c275398 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -1609,13 +1609,11 @@ void
free_emit_status (f)
struct function *f;
{
- if (DECL_DEFER_OUTPUT (f->decl))
- return;
-
free (f->emit->x_regno_reg_rtx);
free (f->emit->regno_pointer_flag);
free (f->emit->regno_pointer_align);
- f->emit->x_regno_reg_rtx = 0;
+ free (f->emit);
+ f->emit = NULL;
}
/* Go through all the RTL insn bodies and copy any invalid shared structure.
@@ -3486,7 +3484,7 @@ mark_sequence_stack (ss)
/* Mark ES for GC. */
void
-mark_emit_state (es)
+mark_emit_status (es)
struct emit_status *es;
{
rtx *r;
diff --git a/gcc/except.c b/gcc/except.c
index 9a190c7513d..f063c9ab4ac 100644
--- a/gcc/except.c
+++ b/gcc/except.c
@@ -2405,9 +2405,12 @@ mark_tree_label_node (node)
/* Mark EH for GC. */
void
-mark_eh_state (eh)
+mark_eh_status (eh)
struct eh_status *eh;
{
+ if (eh == 0)
+ return;
+
mark_eh_stack (&eh->x_ehstack);
mark_eh_stack (&eh->x_catchstack);
mark_eh_queue (&eh->x_ehqueue);
@@ -2479,7 +2482,8 @@ init_eh ()
void
init_eh_for_function ()
{
- current_function->eh = (struct eh_status *) xmalloc (sizeof (struct eh_status));
+ current_function->eh
+ = (struct eh_status *) xmalloc (sizeof (struct eh_status));
ehstack.top = 0;
catchstack.top = 0;
@@ -2494,6 +2498,14 @@ init_eh_for_function ()
eh_return_handler = NULL_RTX;
eh_return_stub_label = NULL_RTX;
}
+
+void
+free_eh_status (f)
+ struct function *f;
+{
+ free (f->eh);
+ f->eh = NULL;
+}
/* This section is for the exception handling specific optimization
pass. First are the internal routines, and then the main
diff --git a/gcc/expr.c b/gcc/expr.c
index c51a97a93f4..daa06d0e849 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -290,6 +290,26 @@ init_expr ()
forced_labels = 0;
}
+void
+mark_expr_status (p)
+ struct expr_status *p;
+{
+ if (p == NULL)
+ return;
+
+ ggc_mark_rtx (p->x_saveregs_value);
+ ggc_mark_rtx (p->x_apply_args_value);
+ ggc_mark_rtx (p->x_forced_labels);
+}
+
+void
+free_expr_status (f)
+ struct function *f;
+{
+ free (f->expr);
+ f->expr = NULL;
+}
+
/* Small sanity check that the queue is empty at the end of a function. */
void
finish_expr_for_function ()
diff --git a/gcc/function.c b/gcc/function.c
index c2d585e0cb5..a6c967995c0 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -122,6 +122,7 @@ void (*init_machine_status) PROTO((struct function *));
void (*save_machine_status) PROTO((struct function *));
void (*restore_machine_status) PROTO((struct function *));
void (*mark_machine_status) PROTO((struct function *));
+void (*free_machine_status) PROTO((struct function *));
/* Likewise, but for language-specific data. */
void (*init_lang_status) PROTO((struct function *));
@@ -276,7 +277,7 @@ static boolean insns_for_mem_comp PROTO ((hash_table_key, hash_table_key));
static int insns_for_mem_walk PROTO ((rtx *, void *));
static void compute_insns_for_mem PROTO ((rtx, rtx, struct hash_table *));
static void mark_temp_slot PROTO ((struct temp_slot *));
-static void mark_function_state PROTO ((struct function *));
+static void mark_function_status PROTO ((struct function *));
static void mark_function_chain PROTO ((void *));
@@ -390,6 +391,24 @@ pop_function_context ()
}
/* Clear out all parts of the state in F that can safely be discarded
+ after the function has been parsed, but not compiled, to let
+ garbage collection reclaim the memory. */
+
+void
+free_after_parsing (f)
+ struct function *f;
+{
+ /* f->expr->forced_labels is used by code generation. */
+ /* f->emit->regno_reg_rtx is used by code generation. */
+ /* f->varasm is used by code generation. */
+ /* f->eh->eh_return_stub_label is used by code generation. */
+
+ if (free_lang_status)
+ (*free_lang_status) (f);
+ free_stmt_status (f);
+}
+
+/* Clear out all parts of the state in F that can safely be discarded
after the function has been compiled, to let garbage collection
reclaim the memory. */
@@ -397,18 +416,44 @@ void
free_after_compilation (f)
struct function *f;
{
+ free_eh_status (f);
+ free_expr_status (f);
free_emit_status (f);
free_varasm_status (f);
- free_stmt_status (f);
- if (free_lang_status)
- (*free_lang_status) (f);
- if (!DECL_DEFER_OUTPUT (f->decl))
- {
- free (f->x_parm_reg_stack_loc);
- f->can_garbage_collect = 1;
- }
+ if (free_machine_status)
+ (*free_machine_status) (f);
+
+ free (f->x_parm_reg_stack_loc);
+
+ f->arg_offset_rtx = NULL;
+ f->return_rtx = NULL;
+ f->internal_arg_pointer = NULL;
+ f->x_nonlocal_labels = NULL;
+ f->x_nonlocal_goto_handler_slots = NULL;
+ f->x_nonlocal_goto_handler_labels = NULL;
+ f->x_nonlocal_goto_stack_level = NULL;
+ f->x_cleanup_label = NULL;
+ f->x_return_label = NULL;
+ f->x_save_expr_regs = NULL;
+ f->x_stack_slot_list = NULL;
+ f->x_rtl_expr_chain = NULL;
+ f->x_tail_recursion_label = NULL;
+ f->x_tail_recursion_reentry = NULL;
+ f->x_arg_pointer_save_area = NULL;
+ f->x_context_display = NULL;
+ f->x_trampoline_list = NULL;
+ f->x_parm_birth_insn = NULL;
+ f->x_last_parm_insn = NULL;
+ f->x_parm_reg_stack_loc = NULL;
+ f->x_temp_slots = NULL;
+ f->fixup_var_refs_queue = NULL;
+ f->original_arg_vector = NULL;
+ f->original_decl_initial = NULL;
+ f->inl_last_parm_insn = NULL;
+ f->epilogue_delay_list = NULL;
}
+
/* Allocate fixed slots in the stack frame of the current function. */
@@ -5495,9 +5540,9 @@ static void
prepare_function_start ()
{
current_function = (struct function *) xcalloc (1, sizeof (struct function));
- current_function->can_garbage_collect = 0;
init_stmt_for_function ();
+ init_eh_for_function ();
cse_not_expected = ! optimize;
@@ -5981,6 +6026,10 @@ expand_dummy_function_end ()
/* Outside function body, can't compute type's actual size
until next function's body starts. */
+
+ free_after_parsing (current_function);
+ free_after_compilation (current_function);
+ free (current_function);
current_function = 0;
}
@@ -6664,7 +6713,7 @@ mark_temp_slot (t)
/* Mark P for GC. */
static void
-mark_function_state (p)
+mark_function_status (p)
struct function *p;
{
int i;
@@ -6724,20 +6773,14 @@ mark_function_chain (arg)
for (; f; f = f->next_global)
{
- if (f->can_garbage_collect)
- continue;
-
ggc_mark_tree (f->decl);
- mark_function_state (f);
- mark_stmt_state (f->stmt);
- mark_eh_state (f->eh);
- mark_emit_state (f->emit);
- mark_varasm_state (f->varasm);
-
- ggc_mark_rtx (f->expr->x_saveregs_value);
- ggc_mark_rtx (f->expr->x_apply_args_value);
- ggc_mark_rtx (f->expr->x_forced_labels);
+ mark_function_status (f);
+ mark_eh_status (f->eh);
+ mark_stmt_status (f->stmt);
+ mark_expr_status (f->expr);
+ mark_emit_status (f->emit);
+ mark_varasm_status (f->varasm);
if (mark_machine_status)
(*mark_machine_status) (f);
diff --git a/gcc/function.h b/gcc/function.h
index a574b67ca4b..0d70b7d6aed 100644
--- a/gcc/function.h
+++ b/gcc/function.h
@@ -184,9 +184,6 @@ struct function
struct emit_status *emit;
struct varasm_status *varasm;
- /* Nonzero if we are done compiling this function. */
- int can_garbage_collect;
-
/* For function.c. */
/* Name of this function. */
@@ -539,6 +536,7 @@ extern void (*init_machine_status) PROTO((struct function *));
extern void (*mark_machine_status) PROTO((struct function *));
extern void (*save_machine_status) PROTO((struct function *));
extern void (*restore_machine_status) PROTO((struct function *));
+extern void (*free_machine_status) PROTO((struct function *));
/* Likewise, but for language-specific data. */
extern void (*init_lang_status) PROTO((struct function *));
@@ -551,12 +549,16 @@ extern void (*free_lang_status) PROTO((struct function *));
extern void save_tree_status PROTO((struct function *));
extern void restore_tree_status PROTO((struct function *));
extern void restore_emit_status PROTO((struct function *));
+extern void free_after_parsing PROTO((struct function *));
extern void free_after_compilation PROTO((struct function *));
extern void init_varasm_status PROTO((struct function *));
extern void free_varasm_status PROTO((struct function *));
extern void free_emit_status PROTO((struct function *));
extern void free_stmt_status PROTO((struct function *));
+extern void free_eh_status PROTO((struct function *));
+extern void free_expr_status PROTO((struct function *));
+
extern rtx get_first_block_beg PROTO((void));
extern void init_virtual_regs PROTO((struct emit_status *));
diff --git a/gcc/ggc.h b/gcc/ggc.h
index da29d249bff..20b3bb8771d 100644
--- a/gcc/ggc.h
+++ b/gcc/ggc.h
@@ -33,6 +33,7 @@ extern int ggc_p;
just forward-declare them here. */
struct eh_status;
struct emit_status;
+struct expr_status;
struct hash_table;
struct label_node;
struct rtvec_def;
@@ -121,8 +122,9 @@ void lang_mark_false_label_stack PROTO ((struct label_node *));
/* Mark functions for various structs scattered about. */
-void mark_eh_state PROTO ((struct eh_status *));
-void mark_stmt_state PROTO ((struct stmt_status *));
-void mark_emit_state PROTO ((struct emit_status *));
-void mark_varasm_state PROTO ((struct varasm_status *));
+void mark_eh_status PROTO ((struct eh_status *));
+void mark_emit_status PROTO ((struct emit_status *));
+void mark_expr_status PROTO ((struct expr_status *));
+void mark_stmt_status PROTO ((struct stmt_status *));
+void mark_varasm_status PROTO ((struct varasm_status *));
void mark_optab PROTO ((void *));
diff --git a/gcc/stmt.c b/gcc/stmt.c
index 068803cd4d4..fcfdb06e4d2 100644
--- a/gcc/stmt.c
+++ b/gcc/stmt.c
@@ -561,13 +561,15 @@ free_stmt_status (f)
/* We're about to free the function obstack. If we hold pointers to
things allocated there, then we'll try to mark them when we do
GC. So, we clear them out here explicitly. */
- f->stmt->x_goto_fixup_chain = 0;
+
+ free (f->stmt);
+ f->stmt = NULL;
}
/* Mark P for GC. */
void
-mark_stmt_state (p)
+mark_stmt_status (p)
struct stmt_status *p;
{
if (p == 0)
@@ -590,7 +592,6 @@ void
init_stmt ()
{
gcc_obstack_init (&stmt_obstack);
- init_eh ();
}
void
@@ -617,8 +618,6 @@ init_stmt_for_function ()
expr_stmts_for_value = 0;
last_expr_type = 0;
last_expr_value = NULL_RTX;
-
- init_eh_for_function ();
}
/* Return nonzero if anything is pushed on the loop, condition, or case
diff --git a/gcc/toplev.c b/gcc/toplev.c
index e14c20a7318..aa3d62ed1d8 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -2862,6 +2862,7 @@ compile_file (name)
init_decl_processing ();
init_optabs ();
init_stmt ();
+ init_eh ();
init_loop ();
init_reload ();
init_alias_once ();
@@ -4425,6 +4426,8 @@ rest_of_compilation (decl)
/* Show no temporary slots allocated. */
init_temp_slots ();
+
+ free_basic_block_vars (0);
});
/* Make sure volatile mem refs aren't considered valid operands for
@@ -4439,8 +4442,9 @@ rest_of_compilation (decl)
init_recog_no_volatile ();
/* We're done with this function. Free up memory if we can. */
- free_after_compilation (current_function);
-
+ free_after_parsing (current_function);
+ if (! DECL_DEFER_OUTPUT (decl))
+ free_after_compilation (current_function);
current_function = 0;
if (ggc_p)
@@ -4450,9 +4454,6 @@ rest_of_compilation (decl)
*except* what is spent in this function. */
parse_time -= get_run_time () - start_time;
-
- /* Reset global variables. */
- free_basic_block_vars (0);
}
static void
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 779aeaa04d8..cf56a09f3ad 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -3228,9 +3228,12 @@ mark_pool_sym_hash_table (pps)
/* Mark P for GC. */
void
-mark_varasm_state (p)
- struct varasm_status *p;
+mark_varasm_status (p)
+ struct varasm_status *p;
{
+ if (p == NULL)
+ return;
+
mark_pool_constant (p->x_first_pool);
mark_pool_sym_hash_table (p->x_const_rtx_sym_hash_table);
ggc_mark_rtx (p->x_const_double_chain);
@@ -3246,17 +3249,11 @@ free_varasm_status (f)
{
struct varasm_status *p;
- if (DECL_DEFER_OUTPUT (f->decl))
- return;
-
p = f->varasm;
free (p->x_const_rtx_hash_table);
free (p->x_const_rtx_sym_hash_table);
-
- p->x_first_pool = p->x_last_pool = 0;
- p->x_const_rtx_hash_table = 0;
- p->x_const_rtx_sym_hash_table = 0;
- p->x_const_double_chain = 0;
+ free (p);
+ f->varasm = NULL;
}
enum kind { RTX_DOUBLE, RTX_INT };