aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2009-09-28 09:44:32 -0700
committerRichard Henderson <rth@gcc.gnu.org>2009-09-28 09:44:32 -0700
commit384c400a82f70420e31fbdc7c1b0b9368fc53b5b (patch)
tree96758456da27013ac77e14db7add80d1de6fb85f
parentaa633255e79391140eaff46920861926a35a1eaa (diff)
downloadgcc-384c400a82f70420e31fbdc7c1b0b9368fc53b5b.zip
gcc-384c400a82f70420e31fbdc7c1b0b9368fc53b5b.tar.gz
gcc-384c400a82f70420e31fbdc7c1b0b9368fc53b5b.tar.bz2
except.h (struct eh_region_d): Add use_cxa_end_cleanup.
* except.h (struct eh_region_d): Add use_cxa_end_cleanup. * except.c (gen_eh_region): Set it. (duplicate_eh_regions_1): Copy it. * tree-eh.c (lower_resx): Use it to determine which function to call to resume. * langhooks.h (struct lang_hooks): Add eh_use_cxa_end_cleanup. * langhooks-def.h (LANG_HOOKS_EH_USE_CXA_END_CLEANUP): New. * builtins.def (BUILT_IN_CXA_END_CLEANUP): New. * tree.c (build_common_builtin_nodes): Remove parameter. Build BUILT_IN_CXA_END_CLEANUP if necessary. * tree.h (build_common_builtin_nodes): Update decl. * c-common.c (c_define_builtins): Update call to build_common_builtin_nodes. gcc/ada/ * gcc-interface/utils.c (gnat_install_builtins): Update call to build_common_builtin_nodes. gcc/cp/ * cp-objcp-common.h (LANG_HOOKS_EH_USE_CXA_END_CLEANUP): New. gcc/fortran/ * f95-lang.c (gfc_init_builtin_functions): Update call to build_common_builtin_nodes. gcc/java/ * builtins.c (initialize_builtins): Update call to build_common_builtin_nodes. * lang.c (LANG_HOOKS_EH_USE_CXA_END_CLEANUP): New. From-SVN: r152241
-rw-r--r--gcc/ChangeLog17
-rw-r--r--gcc/ada/ChangeLog5
-rw-r--r--gcc/ada/gcc-interface/utils.c2
-rw-r--r--gcc/builtins.def1
-rw-r--r--gcc/c-common.c2
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/cp-objcp-common.h3
-rw-r--r--gcc/except.c7
-rw-r--r--gcc/except.h4
-rw-r--r--gcc/fortran/ChangeLog5
-rw-r--r--gcc/fortran/f95-lang.c2
-rw-r--r--gcc/java/ChangeLog6
-rw-r--r--gcc/java/builtins.c2
-rw-r--r--gcc/java/lang.c3
-rw-r--r--gcc/langhooks-def.h2
-rw-r--r--gcc/langhooks.h4
-rw-r--r--gcc/tree-eh.c22
-rw-r--r--gcc/tree.c33
-rw-r--r--gcc/tree.h2
19 files changed, 89 insertions, 37 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 728e272..fa89805 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,20 @@
+2009-09-28 Richard Henderson <rth@redhat.com>
+
+ * except.h (struct eh_region_d): Add use_cxa_end_cleanup.
+ * except.c (gen_eh_region): Set it.
+ (duplicate_eh_regions_1): Copy it.
+ * tree-eh.c (lower_resx): Use it to determine which function
+ to call to resume.
+
+ * langhooks.h (struct lang_hooks): Add eh_use_cxa_end_cleanup.
+ * langhooks-def.h (LANG_HOOKS_EH_USE_CXA_END_CLEANUP): New.
+ * builtins.def (BUILT_IN_CXA_END_CLEANUP): New.
+ * tree.c (build_common_builtin_nodes): Remove parameter. Build
+ BUILT_IN_CXA_END_CLEANUP if necessary.
+
+ * c-common.c (c_define_builtins): Update call to
+ build_common_builtin_nodes.
+
2009-09-28 Andrew Pinski <andrew_pinski@playstation.sony.com>
* spu.c (get_branch_target): Return NULL for ASM_OPERANDS patterns.
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index b0112a1..8e4c061 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,8 @@
+2009-09-28 Richard Henderson <rth@redhat.com>
+
+ * gcc-interface/utils.c (gnat_install_builtins): Update call to
+ build_common_builtin_nodes.
+
2009-09-26 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Array_Type>: Filter out
diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c
index abc0b7b..7acb2ce 100644
--- a/gcc/ada/gcc-interface/utils.c
+++ b/gcc/ada/gcc-interface/utils.c
@@ -5662,7 +5662,7 @@ gnat_install_builtins (void)
know about internal specificities and control attributes accordingly, for
instance __builtin_alloca vs no-throw and -fstack-check. We will ignore
the generic definition from builtins.def. */
- build_common_builtin_nodes (false);
+ build_common_builtin_nodes ();
/* Now, install the target specific builtins, such as the AltiVec family on
ppc, and the common set as exposed by builtins.def. */
diff --git a/gcc/builtins.def b/gcc/builtins.def
index 00287c7..785eefb0 100644
--- a/gcc/builtins.def
+++ b/gcc/builtins.def
@@ -761,6 +761,7 @@ DEF_BUILTIN (BUILT_IN_EMUTLS_REGISTER_COMMON,
/* Exception support. */
DEF_BUILTIN_STUB (BUILT_IN_UNWIND_RESUME, "__builtin_unwind_resume")
+DEF_BUILTIN_STUB (BUILT_IN_CXA_END_CLEANUP, "__builtin_cxa_end_cleanup")
DEF_BUILTIN_STUB (BUILT_IN_EH_POINTER, "__builtin_eh_pointer")
DEF_BUILTIN_STUB (BUILT_IN_EH_FILTER, "__builtin_eh_filter")
DEF_BUILTIN_STUB (BUILT_IN_EH_COPY_VALUES, "__builtin_eh_copy_values")
diff --git a/gcc/c-common.c b/gcc/c-common.c
index a9e1286..baa3d35 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -4574,7 +4574,7 @@ c_define_builtins (tree va_list_ref_type_node, tree va_list_arg_type_node)
targetm.init_builtins ();
- build_common_builtin_nodes (c_dialect_cxx ());
+ build_common_builtin_nodes ();
if (flag_mudflap)
mudflap_init ();
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 5949b24..de0a97f 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,7 @@
+2009-09-28 Richard Henderson <rth@redhat.com>
+
+ * cp-objcp-common.h (LANG_HOOKS_EH_USE_CXA_END_CLEANUP): New.
+
2009-09-24 Jakub Jelinek <jakub@redhat.com>
* method.c (make_thunk, make_alias_for): Don't set
diff --git a/gcc/cp/cp-objcp-common.h b/gcc/cp/cp-objcp-common.h
index 818540c..8f0cdc3 100644
--- a/gcc/cp/cp-objcp-common.h
+++ b/gcc/cp/cp-objcp-common.h
@@ -142,4 +142,7 @@ extern bool cp_function_decl_explicit_p (tree decl);
#undef LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE
#define LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE cxx_omp_privatize_by_reference
+#undef LANG_HOOKS_EH_USE_CXA_END_CLEANUP
+#define LANG_HOOKS_EH_USE_CXA_END_CLEANUP true
+
#endif /* GCC_CP_OBJCP_COMMON */
diff --git a/gcc/except.c b/gcc/except.c
index c916a18..bb26bf4 100644
--- a/gcc/except.c
+++ b/gcc/except.c
@@ -369,6 +369,10 @@ gen_eh_region (enum eh_region_type type, eh_region outer)
new_eh->index = VEC_length (eh_region, cfun->eh->region_array);
VEC_safe_push (eh_region, gc, cfun->eh->region_array, new_eh);
+ /* Copy the language's notion of whether to use __cxa_end_cleanup. */
+ if (targetm.arm_eabi_unwinder && lang_hooks.eh_use_cxa_end_cleanup)
+ new_eh->use_cxa_end_cleanup = true;
+
return new_eh;
}
@@ -573,6 +577,9 @@ duplicate_eh_regions_1 (struct duplicate_eh_regions_data *data,
EH_LANDING_PAD_NR (new_lp->post_landing_pad) = new_lp->index;
}
+ /* Make sure to preserve the original use of __cxa_end_cleanup. */
+ new_r->use_cxa_end_cleanup = old_r->use_cxa_end_cleanup;
+
for (old_r = old_r->inner; old_r ; old_r = old_r->next_peer)
duplicate_eh_regions_1 (data, old_r, new_r);
}
diff --git a/gcc/except.h b/gcc/except.h
index 3e9a39c..f1dbf90 100644
--- a/gcc/except.h
+++ b/gcc/except.h
@@ -171,6 +171,10 @@ struct GTY(()) eh_region_d
Each region gets its own psuedos so that if there are nested exceptions
we do not overwrite the values of the first exception. */
rtx exc_ptr_reg, filter_reg;
+
+ /* True if this region should use __cxa_end_cleanup instead
+ of _Unwind_Resume. */
+ bool use_cxa_end_cleanup;
};
typedef struct eh_landing_pad_d *eh_landing_pad;
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index e7826e0..ab55bd8 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,8 @@
+2009-09-28 Richard Henderson <rth@redhat.com>
+
+ * f95-lang.c (gfc_init_builtin_functions): Update call to
+ build_common_builtin_nodes.
+
2009-09-25 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* simplify.c (gfc_simplify_acos, gfc_simplify_acosh,
diff --git a/gcc/fortran/f95-lang.c b/gcc/fortran/f95-lang.c
index a21044c..5d2846c 100644
--- a/gcc/fortran/f95-lang.c
+++ b/gcc/fortran/f95-lang.c
@@ -1131,7 +1131,7 @@ gfc_init_builtin_functions (void)
BUILT_IN_EMUTLS_REGISTER_COMMON,
"__emutls_register_common", false);
- build_common_builtin_nodes (false);
+ build_common_builtin_nodes ();
targetm.init_builtins ();
}
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 6c58a99..5a9f1d6 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,9 @@
+2009-09-28 Richard Henderson <rth@redhat.com>
+
+ * builtins.c (initialize_builtins): Update call to
+ build_common_builtin_nodes.
+ * lang.c (LANG_HOOKS_EH_USE_CXA_END_CLEANUP): New.
+
2009-09-14 Richard Henderson <rth@redhat.com>
* builtins.c (initialize_builtins): Update call to
diff --git a/gcc/java/builtins.c b/gcc/java/builtins.c
index a05ff53..6e4815b 100644
--- a/gcc/java/builtins.c
+++ b/gcc/java/builtins.c
@@ -584,7 +584,7 @@ initialize_builtins (void)
build_function_type_list (ptr_type_node, int_type_node, NULL_TREE),
"__builtin_return_address", BUILTIN_NOTHROW);
- build_common_builtin_nodes (true);
+ build_common_builtin_nodes ();
}
/* If the call matches a builtin, return the
diff --git a/gcc/java/lang.c b/gcc/java/lang.c
index 504d029..f1d8f44 100644
--- a/gcc/java/lang.c
+++ b/gcc/java/lang.c
@@ -164,6 +164,9 @@ struct GTY(()) language_function {
#undef LANG_HOOKS_EH_PERSONALITY
#define LANG_HOOKS_EH_PERSONALITY java_eh_personality
+#undef LANG_HOOKS_EH_USE_CXA_END_CLEANUP
+#define LANG_HOOKS_EH_USE_CXA_END_CLEANUP true
+
/* Each front end provides its own. */
struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
diff --git a/gcc/langhooks-def.h b/gcc/langhooks-def.h
index fa078ad..40a4de9 100644
--- a/gcc/langhooks-def.h
+++ b/gcc/langhooks-def.h
@@ -110,6 +110,7 @@ extern void lhd_omp_firstprivatize_type_sizes (struct gimplify_omp_ctx *,
#define LANG_HOOKS_INIT_TS lhd_do_nothing
#define LANG_HOOKS_EH_PERSONALITY lhd_gcc_personality
#define LANG_HOOKS_EH_RUNTIME_TYPE lhd_pass_through_t
+#define LANG_HOOKS_EH_USE_CXA_END_CLEANUP false
/* Attribute hooks. */
#define LANG_HOOKS_ATTRIBUTE_TABLE NULL
@@ -283,6 +284,7 @@ extern tree lhd_make_node (enum tree_code);
LANG_HOOKS_EXPR_TO_DECL, \
LANG_HOOKS_EH_PERSONALITY, \
LANG_HOOKS_EH_RUNTIME_TYPE, \
+ LANG_HOOKS_EH_USE_CXA_END_CLEANUP, \
}
#endif /* GCC_LANG_HOOKS_DEF_H */
diff --git a/gcc/langhooks.h b/gcc/langhooks.h
index ab64040..b133ea0 100644
--- a/gcc/langhooks.h
+++ b/gcc/langhooks.h
@@ -430,6 +430,10 @@ struct lang_hooks
/* Map a type to a runtime object to match type. */
tree (*eh_runtime_type) (tree);
+ /* True if this language uses __cxa_end_cleanup when the ARM EABI
+ is enabled. */
+ bool eh_use_cxa_end_cleanup;
+
/* Whenever you add entries here, make sure you adjust langhooks-def.h
and langhooks.c accordingly. */
};
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index 70c009d..0f5931e 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -2949,21 +2949,16 @@ lower_resx (basic_block bb, gimple stmt, struct pointer_map_t *mnt_map)
up the call chain. We resolve this by generating a call to the
_Unwind_Resume library function. */
- /* ??? The ARM EABI redefines _Unwind_Resume as __cxa_end_cleanup
+ /* The ARM EABI redefines _Unwind_Resume as __cxa_end_cleanup
with no arguments for C++ and Java. Check for that. */
- switch (targetm.arm_eabi_unwinder)
+ if (src_r->use_cxa_end_cleanup)
+ {
+ fn = implicit_built_in_decls[BUILT_IN_CXA_END_CLEANUP];
+ x = gimple_build_call (fn, 0);
+ gsi_insert_before (&gsi, x, GSI_SAME_STMT);
+ }
+ else
{
- default:
- fn = implicit_built_in_decls[BUILT_IN_UNWIND_RESUME];
- if (TYPE_ARG_TYPES (TREE_TYPE (fn)) == void_list_node)
- {
- x = gimple_build_call (fn, 0);
- gsi_insert_before (&gsi, x, GSI_SAME_STMT);
- break;
- }
- /* FALLTHRU */
-
- case 0:
fn = implicit_built_in_decls[BUILT_IN_EH_POINTER];
src_nr = build_int_cst (NULL, src_r->index);
x = gimple_build_call (fn, 1, src_nr);
@@ -2975,7 +2970,6 @@ lower_resx (basic_block bb, gimple stmt, struct pointer_map_t *mnt_map)
fn = implicit_built_in_decls[BUILT_IN_UNWIND_RESUME];
x = gimple_build_call (fn, 1, var);
gsi_insert_before (&gsi, x, GSI_SAME_STMT);
- break;
}
gcc_assert (EDGE_COUNT (bb->succs) == 0);
diff --git a/gcc/tree.c b/gcc/tree.c
index 846dd98..315df90 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -8890,13 +8890,10 @@ local_define_builtin (const char *name, tree type, enum built_in_function code,
/* Call this function after instantiating all builtins that the language
front end cares about. This will build the rest of the builtins that
- are relied upon by the tree optimizers and the middle-end.
-
- ENABLE_CXA_END_CLEANUP should be true for C++ and Java, where the ARM
- EABI requires a slightly different implementation of _Unwind_Resume. */
+ are relied upon by the tree optimizers and the middle-end. */
void
-build_common_builtin_nodes (bool enable_cxa_end_cleanup)
+build_common_builtin_nodes (void)
{
tree tmp, tmp2, ftype;
@@ -9003,23 +9000,23 @@ build_common_builtin_nodes (bool enable_cxa_end_cleanup)
local_define_builtin ("__builtin_profile_func_exit", ftype,
BUILT_IN_PROFILE_FUNC_EXIT, "profile_func_exit", 0);
- if (enable_cxa_end_cleanup && targetm.arm_eabi_unwinder)
+ /* If there's a possibility that we might use the ARM EABI, build the
+ alternate __cxa_end_cleanup node used to resume from C++ and Java. */
+ if (targetm.arm_eabi_unwinder)
{
ftype = build_function_type (void_type_node, void_list_node);
- local_define_builtin ("__builtin_unwind_resume", ftype,
- BUILT_IN_UNWIND_RESUME,
+ local_define_builtin ("__builtin_cxa_end_cleanup", ftype,
+ BUILT_IN_CXA_END_CLEANUP,
"__cxa_end_cleanup", ECF_NORETURN);
}
- else
- {
- tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node);
- ftype = build_function_type (void_type_node, tmp);
- local_define_builtin ("__builtin_unwind_resume", ftype,
- BUILT_IN_UNWIND_RESUME,
- (USING_SJLJ_EXCEPTIONS
- ? "_Unwind_SjLj_Resume" : "_Unwind_Resume"),
- ECF_NORETURN);
- }
+
+ tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node);
+ ftype = build_function_type (void_type_node, tmp);
+ local_define_builtin ("__builtin_unwind_resume", ftype,
+ BUILT_IN_UNWIND_RESUME,
+ (USING_SJLJ_EXCEPTIONS
+ ? "_Unwind_SjLj_Resume" : "_Unwind_Resume"),
+ ECF_NORETURN);
/* The exception object and filter values from the runtime. The argument
must be zero before exception lowering, i.e. from the front end. After
diff --git a/gcc/tree.h b/gcc/tree.h
index 4f4fd30..a5a22f4 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -4949,7 +4949,7 @@ extern int real_minus_onep (const_tree);
extern void init_ttree (void);
extern void build_common_tree_nodes (bool, bool);
extern void build_common_tree_nodes_2 (int);
-extern void build_common_builtin_nodes (bool);
+extern void build_common_builtin_nodes (void);
extern tree build_nonstandard_integer_type (unsigned HOST_WIDE_INT, int);
extern tree build_range_type (tree, tree, tree);
extern bool subrange_type_for_debug_p (const_tree, tree *, tree *);