* 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
+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.
+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
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. */
/* 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")
targetm.init_builtins ();
- build_common_builtin_nodes (c_dialect_cxx ());
+ build_common_builtin_nodes ();
if (flag_mudflap)
mudflap_init ();
+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
#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 */
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;
}
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);
}
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;
+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,
BUILT_IN_EMUTLS_REGISTER_COMMON,
"__emutls_register_common", false);
- build_common_builtin_nodes (false);
+ build_common_builtin_nodes ();
targetm.init_builtins ();
}
+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
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
#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;
#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
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 */
/* 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. */
};
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);
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);
/* 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;
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
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 *);