+2005-05-11 Jan Hubicka <jh@suse.cz>
+
+ * Makefile.in (tree-eh.o: Kill gt-tree-eh.h dependency.
+ (GTFILES): add except.h.
+ * except.c (eh_status): Add throw_stmt_table.
+ (set_eh_throw_stmt_table, get_eh_throw_stmt_table): New functions.
+ * except.h (add_stmt_to_eh_region_fn, remove_stmt_from_eh_region_fn,
+ lookup_stmt_eh_region_fn): Declare.
+ (throw_stmt_node): New structure.
+ (set_eh_throw_stmt_table, get_eh_throw_stmt_table): New.
+ * gengtype.c (open_base_files): Add except.h to inlines.
+ * tree-eh.c (throw_stmt_node): Kill.
+ (record_stmt_eh_region): Update.
+ (add_stmt_to_eh_region_fn): Break out from ...
+ (add_stmt_to_eh_region): ... here.
+ (remove_stmt_from_eh_region_fn): Break out from ...
+ (remove_stmt_from_eh_region): ... here.
+ (lookup_stmt_eh_region_fn): Break out from ...
+ (lookup_stmt_eh_region): ... here.
+ (honor_protect_cleanup_actions): Use build_resx.
+ (lower_try_finally_onedest): Likewise.
+ (lower_try_finally_copy): Likewise.
+ (lower_try_finally_switch): Likewise.
+ (lower_eh_constructs): Update eh table construction.
+ * tree.c (build_resx): New.
+ * tree.h (build_resx): Declare.
+
2005-05-11 H.J. Lu <hongjiu.lu@intel.com>
* libgcov.c (gcov_exit): Set prefix_length to 0 if no relocation
gt-tree-ssa-operands.h coretypes.h langhooks.h tree-ssa-opfinalize.h
tree-eh.o : tree-eh.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
$(RTL_H) $(TREE_H) $(TM_H) $(FLAGS_H) function.h except.h langhooks.h \
- $(GGC_H) tree-pass.h gt-tree-eh.h coretypes.h $(TIMEVAR_H) $(TM_P_H) \
+ $(GGC_H) tree-pass.h coretypes.h $(TIMEVAR_H) $(TM_P_H) \
$(TREE_DUMP_H) tree-inline.h tree-iterator.h
tree-ssa-loop.o : tree-ssa-loop.c $(TREE_FLOW_H) $(CONFIG_H) \
$(SYSTEM_H) $(RTL_H) $(TREE_H) $(TM_P_H) $(CFGLOOP_H) \
$(srcdir)/dbxout.c $(srcdir)/dwarf2out.c $(srcdir)/dwarf2asm.c \
$(srcdir)/dojump.c $(srcdir)/tree-profile.c \
$(srcdir)/emit-rtl.c $(srcdir)/except.c $(srcdir)/explow.c $(srcdir)/expr.c \
- $(srcdir)/function.c \
+ $(srcdir)/function.c $(srcdir)/except.h \
$(srcdir)/gcse.c $(srcdir)/integrate.c $(srcdir)/lists.c $(srcdir)/optabs.c \
$(srcdir)/profile.c $(srcdir)/regclass.c \
$(srcdir)/reg-stack.c $(srcdir)/cfglayout.c \
gt-dbxout.h gt-c-common.h gt-c-decl.h gt-c-parser.h \
gt-c-pragma.h gtype-c.h gt-cfglayout.h \
gt-tree-mudflap.h gt-tree-complex.h \
-gt-tree-eh.h gt-tree-profile.h \
+gt-tree-profile.h \
gt-tree-ssanames.h gt-tree-iterator.h gt-gimplify.h \
gt-tree-phinodes.h gt-tree-nested.h \
gt-tree-ssa-operands.h gt-tree-ssa-propagate.h \
compared to those that can. We should be saving some amount
of space by only allocating memory for those that can throw. */
-struct throw_stmt_node GTY(())
-{
- tree stmt;
- int region_nr;
-};
-
-static GTY((param_is (struct throw_stmt_node))) htab_t throw_stmt_table;
-
static void
record_stmt_eh_region (struct eh_region *region, tree t)
{
n->stmt = t;
n->region_nr = get_eh_region_number (region);
- slot = htab_find_slot (throw_stmt_table, n, INSERT);
+ slot = htab_find_slot (get_eh_throw_stmt_table (cfun), n, INSERT);
gcc_assert (!*slot);
*slot = n;
}
void
-add_stmt_to_eh_region (tree t, int num)
+add_stmt_to_eh_region_fn (struct function *ifun, tree t, int num)
{
struct throw_stmt_node *n;
void **slot;
gcc_assert (num >= 0);
+ gcc_assert (TREE_CODE (t) != RESX_EXPR);
n = ggc_alloc (sizeof (*n));
n->stmt = t;
n->region_nr = num;
- slot = htab_find_slot (throw_stmt_table, n, INSERT);
+ slot = htab_find_slot (get_eh_throw_stmt_table (ifun), n, INSERT);
gcc_assert (!*slot);
*slot = n;
}
+void
+add_stmt_to_eh_region (tree t, int num)
+{
+ add_stmt_to_eh_region_fn (cfun, t, num);
+}
+
bool
-remove_stmt_from_eh_region (tree t)
+remove_stmt_from_eh_region_fn (struct function *ifun, tree t)
{
struct throw_stmt_node dummy;
void **slot;
- if (!throw_stmt_table)
+ if (!get_eh_throw_stmt_table (ifun))
return false;
dummy.stmt = t;
- slot = htab_find_slot (throw_stmt_table, &dummy, NO_INSERT);
+ slot = htab_find_slot (get_eh_throw_stmt_table (ifun), &dummy,
+ NO_INSERT);
if (slot)
{
- htab_clear_slot (throw_stmt_table, slot);
+ htab_clear_slot (get_eh_throw_stmt_table (ifun), slot);
return true;
}
else
return false;
}
+bool
+remove_stmt_from_eh_region (tree t)
+{
+ return remove_stmt_from_eh_region_fn (cfun, t);
+}
+
int
-lookup_stmt_eh_region (tree t)
+lookup_stmt_eh_region_fn (struct function *ifun, tree t)
{
struct throw_stmt_node *p, n;
- if (!throw_stmt_table)
+ if (!get_eh_throw_stmt_table (ifun))
return -2;
n.stmt = t;
- p = htab_find (throw_stmt_table, &n);
+ p = htab_find (get_eh_throw_stmt_table (ifun), &n);
return (p ? p->region_nr : -1);
}
+int
+lookup_stmt_eh_region (tree t)
+{
+ /* We can get called from initialized data when -fnon-call-exceptions
+ is on; prevent crash. */
+ if (!cfun)
+ return -1;
+ return lookup_stmt_eh_region_fn (cfun, t);
+}
\f
/* First pass of EH node decomposition. Build up a tree of TRY_FINALLY_EXPR
x = build (MODIFY_EXPR, void_type_node, x, save_filt);
tsi_link_after (&i, x, TSI_CONTINUE_LINKING);
- x = build1 (RESX_EXPR, void_type_node,
- build_int_cst (NULL_TREE,
- get_eh_region_number (tf->region)));
+ x = build_resx (get_eh_region_number (tf->region));
tsi_link_after (&i, x, TSI_CONTINUE_LINKING);
}
append_to_statement_list (finally, tf->top_p);
- x = build1 (RESX_EXPR, void_type_node,
- build_int_cst (NULL_TREE,
- get_eh_region_number (tf->region)));
+ x = build_resx (get_eh_region_number (tf->region));
+
append_to_statement_list (x, tf->top_p);
return;
lower_eh_constructs_1 (state, &x);
append_to_statement_list (x, &new_stmt);
- x = build1 (RESX_EXPR, void_type_node,
- build_int_cst (NULL_TREE,
- get_eh_region_number (tf->region)));
+ x = build_resx (get_eh_region_number (tf->region));
append_to_statement_list (x, &new_stmt);
}
x = build (LABEL_EXPR, void_type_node, CASE_LABEL (last_case));
append_to_statement_list (x, &switch_body);
- x = build1 (RESX_EXPR, void_type_node,
- build_int_cst (NULL_TREE,
- get_eh_region_number (tf->region)));
+ x = build_resx (get_eh_region_number (tf->region));
append_to_statement_list (x, &switch_body);
}
tree *tp = &DECL_SAVED_TREE (current_function_decl);
finally_tree = htab_create (31, struct_ptr_hash, struct_ptr_eq, free);
- throw_stmt_table = htab_create_ggc (31, struct_ptr_hash, struct_ptr_eq,
- ggc_free);
+ set_eh_throw_stmt_table (cfun, htab_create_ggc (31, struct_ptr_hash,
+ struct_ptr_eq,
+ ggc_free));
collect_finally_tree (*tp, NULL);
return false;
}
-#include "gt-tree-eh.h"