aboutsummaryrefslogtreecommitdiff
path: root/gcc/stmt.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@cygnus.com>1999-09-04 19:41:35 -0700
committerMark Mitchell <mmitchel@gcc.gnu.org>1999-09-05 02:41:35 +0000
commit87ff9c8e4bb514b8298fcd6431339197de456c0a (patch)
treee5cebe68f9343bcd10b7be75a8d15ab8791ec212 /gcc/stmt.c
parent6621f41de9e59ab84880d506f7de8b6ca6eccecb (diff)
downloadgcc-87ff9c8e4bb514b8298fcd6431339197de456c0a.zip
gcc-87ff9c8e4bb514b8298fcd6431339197de456c0a.tar.gz
gcc-87ff9c8e4bb514b8298fcd6431339197de456c0a.tar.bz2
Makefile.in (tree.o): Depend on ggc.h.
* Makefile.in (tree.o): Depend on ggc.h. (varasm.o): Likewise. (function.o): Likewise. (stmt.o): Likewise. (except.o): Likewise. (optabs.o): Likewise. (emit-rtl.o): Likewise. * emit-rtl.c: Include ggc.h. (sequence_element_free_list): Remove, and all references. (mark_sequence): New functions. (mark_emit_state): New function. * except.c: Include ggc.h. (mark_eh_node, mark_eh_stack, mark_eh_queue): New functions. (mark_tree_label_node): New functions. (mark_eh_state): New function. * function.c: Include ggc.h. (mark_temp_slot, mark_function_chain): New functions. (mark_function_state): New function. (init_function_once): New function. * function.h (init_function_once): New function. * ggc-callbacks.c (lang_mark_false_label_stack): New function. * ggc.h (label_node): Declare. (eh_status, emit_status, stmt_status, varasm_status): Likewise. (lang_mark_false_label_stack): New function. (mark_temp_slot): Remove declaration. (mark_function_chain): Likewise. (mark_eh_state): Adjust prototype. (mark_stmt_state, mark_emit_state, mark_varasm_state, mark_optab): Likewise. * optabs.c: Include ggc.h. (mark_optab): New function. (init_optabs): Add gc roots. * stmt.c: Include ggc.h. (mark_cond_nesting, mark_loop_nesting): New functions. (mark_block_nesting, mark_case_nesting, mark_goto_fixup): Likewise. (mark_stmt_state): New function. * toplev.c (compile_file): Call init_function_once. * tree.c: Include ggc.h. (type_hash): Move declaration earlier in file. (TYPE_HASH_SIZE, type_hash_table): Likewise. (init_obstacks): Add gc roots. (mark_type_hash): New function. * varasm.c: Include ggc.h. (mark_pool_constant): New function. (mark_varasm_state): New function. Co-Authored-By: Bernd Schmidt <bernds@cygnus.co.uk> Co-Authored-By: Mark Mitchell <mark@codesourcery.com> From-SVN: r29119
Diffstat (limited to 'gcc/stmt.c')
-rw-r--r--gcc/stmt.c140
1 files changed, 140 insertions, 0 deletions
diff --git a/gcc/stmt.c b/gcc/stmt.c
index 255d635..a9f8592 100644
--- a/gcc/stmt.c
+++ b/gcc/stmt.c
@@ -52,6 +52,7 @@ Boston, MA 02111-1307, USA. */
#include "machmode.h"
#include "toplev.h"
#include "output.h"
+#include "ggc.h"
#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free free
@@ -425,6 +426,12 @@ static void emit_jump_if_reachable PROTO((rtx));
static void emit_case_nodes PROTO((rtx, case_node_ptr, rtx, tree));
static int add_case_node PROTO((tree, tree, tree, tree *));
static struct case_node *case_tree2list PROTO((case_node *, case_node *));
+static void mark_cond_nesting PROTO((struct nesting *));
+static void mark_loop_nesting PROTO((struct nesting *));
+static void mark_block_nesting PROTO((struct nesting *));
+static void mark_case_nesting PROTO((struct nesting *));
+static void mark_goto_fixup PROTO((struct goto_fixup *));
+
void
using_eh_for_cleanups ()
@@ -432,6 +439,139 @@ using_eh_for_cleanups ()
using_eh_for_cleanups_p = 1;
}
+/* Mark N (known to be a cond-nesting) for GC. */
+
+static void
+mark_cond_nesting (n)
+ struct nesting *n;
+{
+ while (n)
+ {
+ ggc_mark_rtx (n->exit_label);
+ ggc_mark_rtx (n->data.cond.endif_label);
+ ggc_mark_rtx (n->data.cond.next_label);
+
+ n = n->next;
+ }
+}
+
+/* Mark N (known to be a loop-nesting) for GC. */
+
+static void
+mark_loop_nesting (n)
+ struct nesting *n;
+{
+
+ while (n)
+ {
+ ggc_mark_rtx (n->exit_label);
+ ggc_mark_rtx (n->data.loop.start_label);
+ ggc_mark_rtx (n->data.loop.end_label);
+ ggc_mark_rtx (n->data.loop.alt_end_label);
+ ggc_mark_rtx (n->data.loop.continue_label);
+
+ n = n->next;
+ }
+}
+
+/* Mark N (known to be a block-nesting) for GC. */
+
+static void
+mark_block_nesting (n)
+ struct nesting *n;
+{
+ while (n)
+ {
+ struct label_chain *l;
+
+ ggc_mark_rtx (n->exit_label);
+ ggc_mark_rtx (n->data.block.stack_level);
+ ggc_mark_rtx (n->data.block.first_insn);
+ ggc_mark_tree (n->data.block.cleanups);
+ ggc_mark_tree (n->data.block.outer_cleanups);
+
+ for (l = n->data.block.label_chain; l != NULL; l = l->next)
+ ggc_mark_tree (l->label);
+
+ ggc_mark_rtx (n->data.block.last_unconditional_cleanup);
+
+ /* ??? cleanup_ptr never points outside the stack, does it? */
+
+ n = n->next;
+ }
+}
+
+/* Mark N (known to be a case-nesting) for GC. */
+
+static void
+mark_case_nesting (n)
+ struct nesting *n;
+{
+ while (n)
+ {
+ struct case_node *node;
+
+ ggc_mark_rtx (n->exit_label);
+ ggc_mark_rtx (n->data.case_stmt.start);
+
+ node = n->data.case_stmt.case_list;
+ while (node)
+ {
+ ggc_mark_tree (node->low);
+ ggc_mark_tree (node->high);
+ ggc_mark_tree (node->code_label);
+ node = node->right;
+ }
+
+ ggc_mark_tree (n->data.case_stmt.default_label);
+ ggc_mark_tree (n->data.case_stmt.index_expr);
+ ggc_mark_tree (n->data.case_stmt.nominal_type);
+
+ n = n->next;
+ }
+}
+
+/* Mark G for GC. */
+
+static void
+mark_goto_fixup (g)
+ struct goto_fixup *g;
+{
+ while (g)
+ {
+ ggc_mark_rtx (g->before_jump);
+ ggc_mark_tree (g->target);
+ ggc_mark_tree (g->context);
+ ggc_mark_rtx (g->target_rtl);
+ ggc_mark_rtx (g->stack_level);
+ ggc_mark_tree (g->cleanup_list_list);
+
+ g = g->next;
+ }
+}
+
+/* Mark P for GC. */
+
+void
+mark_stmt_state (p)
+ struct stmt_status *p;
+{
+ if (p == 0)
+ return;
+
+ mark_block_nesting (p->x_block_stack);
+ mark_cond_nesting (p->x_cond_stack);
+ mark_loop_nesting (p->x_loop_stack);
+ mark_case_nesting (p->x_case_stack);
+
+ ggc_mark_tree (p->x_last_expr_type);
+ /* last_epxr_value is only valid if last_expr_type is nonzero. */
+ if (p->x_last_expr_type)
+ ggc_mark_rtx (p->x_last_expr_value);
+
+ mark_goto_fixup (p->x_goto_fixup_chain);
+}
+
void
init_stmt ()
{