Makefile.in (tree-eh.o): Kill gt-tree-eh.h dependency.
* 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. From-SVN: r99585
This commit is contained in:
parent
3ca48b3e72
commit
b4660e5a25
@ -1,3 +1,30 @@
|
||||
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
|
||||
|
@ -1763,7 +1763,7 @@ tree-ssa-operands.o : tree-ssa-operands.c $(TREE_FLOW_H) $(CONFIG_H) \
|
||||
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) \
|
||||
@ -2570,7 +2570,7 @@ GTFILES = $(srcdir)/input.h $(srcdir)/coretypes.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 \
|
||||
@ -2602,7 +2602,7 @@ gt-dwarf2out.h gt-reg-stack.h gt-dwarf2asm.h \
|
||||
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 \
|
||||
|
14
gcc/except.c
14
gcc/except.c
@ -251,6 +251,8 @@ struct eh_status GTY(())
|
||||
|
||||
rtx sjlj_fc;
|
||||
rtx sjlj_exit_after;
|
||||
|
||||
htab_t GTY((param_is (struct throw_stmt_node))) throw_stmt_table;
|
||||
};
|
||||
|
||||
|
||||
@ -3436,6 +3438,18 @@ output_function_exception_table (void)
|
||||
current_function_section (current_function_decl);
|
||||
}
|
||||
|
||||
void
|
||||
set_eh_throw_stmt_table (struct function *fun, struct htab *table)
|
||||
{
|
||||
fun->eh->throw_stmt_table = table;
|
||||
}
|
||||
|
||||
htab_t
|
||||
get_eh_throw_stmt_table (struct function *fun)
|
||||
{
|
||||
return fun->eh->throw_stmt_table;
|
||||
}
|
||||
|
||||
/* Dump EH information to OUT. */
|
||||
void
|
||||
dump_eh_tree (FILE *out, struct function *fun)
|
||||
|
12
gcc/except.h
12
gcc/except.h
@ -105,6 +105,9 @@ extern void verify_eh_tree (struct function *);
|
||||
extern void dump_eh_tree (FILE *, struct function *);
|
||||
|
||||
/* tree-eh.c */
|
||||
extern void add_stmt_to_eh_region_fn (struct function *, tree, int);
|
||||
extern bool remove_stmt_from_eh_region_fn (struct function *, tree);
|
||||
extern int lookup_stmt_eh_region_fn (struct function *, tree);
|
||||
extern int lookup_stmt_eh_region (tree);
|
||||
extern bool verify_eh_edges (tree);
|
||||
|
||||
@ -158,3 +161,12 @@ extern tree (*lang_eh_runtime_type) (tree);
|
||||
#else
|
||||
# define USING_SJLJ_EXCEPTIONS MUST_USE_SJLJ_EXCEPTIONS
|
||||
#endif
|
||||
|
||||
struct throw_stmt_node GTY(())
|
||||
{
|
||||
tree stmt;
|
||||
int region_nr;
|
||||
};
|
||||
|
||||
extern struct htab *get_eh_throw_stmt_table (struct function *);
|
||||
extern void set_eh_throw_stmt_table (struct function *, struct htab *);
|
||||
|
@ -1088,7 +1088,7 @@ open_base_files (void)
|
||||
"hard-reg-set.h", "basic-block.h", "cselib.h", "insn-addr.h",
|
||||
"optabs.h", "libfuncs.h", "debug.h", "ggc.h", "cgraph.h",
|
||||
"tree-flow.h", "reload.h", "cpp-id-data.h", "tree-chrec.h",
|
||||
NULL
|
||||
"except.h", NULL
|
||||
};
|
||||
const char *const *ifp;
|
||||
outf_p gtype_desc_c;
|
||||
|
@ -81,14 +81,6 @@ struct_ptr_hash (const void *a)
|
||||
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)
|
||||
{
|
||||
@ -102,7 +94,25 @@ 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_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 (get_eh_throw_stmt_table (ifun), n, INSERT);
|
||||
gcc_assert (!*slot);
|
||||
*slot = n;
|
||||
}
|
||||
@ -110,54 +120,59 @@ record_stmt_eh_region (struct eh_region *region, tree t)
|
||||
void
|
||||
add_stmt_to_eh_region (tree t, int num)
|
||||
{
|
||||
struct throw_stmt_node *n;
|
||||
void **slot;
|
||||
|
||||
gcc_assert (num >= 0);
|
||||
|
||||
n = ggc_alloc (sizeof (*n));
|
||||
n->stmt = t;
|
||||
n->region_nr = num;
|
||||
|
||||
slot = htab_find_slot (throw_stmt_table, n, INSERT);
|
||||
gcc_assert (!*slot);
|
||||
*slot = n;
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
/* First pass of EH node decomposition. Build up a tree of TRY_FINALLY_EXPR
|
||||
@ -832,9 +847,7 @@ honor_protect_cleanup_actions (struct leh_state *outer_state,
|
||||
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);
|
||||
}
|
||||
|
||||
@ -939,9 +952,8 @@ lower_try_finally_onedest (struct leh_state *state, struct leh_tf_state *tf)
|
||||
|
||||
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;
|
||||
@ -1028,9 +1040,7 @@ lower_try_finally_copy (struct leh_state *state, struct leh_tf_state *tf)
|
||||
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);
|
||||
}
|
||||
|
||||
@ -1204,9 +1214,7 @@ lower_try_finally_switch (struct leh_state *state, struct leh_tf_state *tf)
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@ -1676,8 +1684,9 @@ lower_eh_constructs (void)
|
||||
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);
|
||||
|
||||
@ -2035,4 +2044,3 @@ maybe_clean_eh_stmt (tree stmt)
|
||||
return false;
|
||||
}
|
||||
|
||||
#include "gt-tree-eh.h"
|
||||
|
10
gcc/tree.c
10
gcc/tree.c
@ -5972,6 +5972,16 @@ build_vector_type (tree innertype, int nunits)
|
||||
return make_vector_type (innertype, nunits, VOIDmode);
|
||||
}
|
||||
|
||||
/* Build RESX_EXPR with given REGION_NUMBER. */
|
||||
tree
|
||||
build_resx (int region_number)
|
||||
{
|
||||
tree t;
|
||||
t = build1 (RESX_EXPR, void_type_node,
|
||||
build_int_cst (NULL_TREE, region_number));
|
||||
return t;
|
||||
}
|
||||
|
||||
/* Given an initializer INIT, return TRUE if INIT is zero or some
|
||||
aggregate of zeros. Otherwise return FALSE. */
|
||||
bool
|
||||
|
@ -2937,6 +2937,7 @@ extern tree build_method_type_directly (tree, tree, tree);
|
||||
extern tree build_method_type (tree, tree);
|
||||
extern tree build_offset_type (tree, tree);
|
||||
extern tree build_complex_type (tree);
|
||||
extern tree build_resx (int);
|
||||
extern tree array_type_nelts (tree);
|
||||
extern bool in_array_bounds_p (tree);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user