diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-09-13 19:40:33 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-09-13 19:40:33 +0000 |
commit | 58d82cd04d30e16e38e5fcac6d2d120fa55d64ed (patch) | |
tree | 5e937f9960fc5af8114c7b2d8943ecdd565debb2 /gcc/tree-inline.c | |
parent | 9c837e05f000e50dd55238bc77c20c6d5ba828d9 (diff) | |
download | gcc-58d82cd04d30e16e38e5fcac6d2d120fa55d64ed.tar.gz |
2009-09-13 Richard Guenther <rguenther@suse.de>
Rafael Avila de Espindola <espindola@google.com>
* langhooks-def.h (LANG_HOOKS_EH_RUNTIME_TYPE): Define.
(LANG_HOOKS_EH_PERSONALITY): Likewise.
(LANG_HOOKS_INITIALIZER): Adjust.
(lhd_pass_through_t): Declare.
* langhooks.h (struct lang_hooks): Add eh_runtime_type and
eh_personality.
* langhooks.c (lhd_pass_through_t): New function.
* dwarf2out.c (output_call_frame_info, dwarf2out_do_cfi_startproc,
dwarf2out_begin_prologue): Use personality from current_function_decl.
* expr.h (get_personality_function): Declare.
* expr.c (get_personality_function): New function.
(build_personality_function): Likewise.
* libfuncs.h (libfunc_index): Remove LTI_eh_personality.
(eh_personality_libfunc): Remove.
* optabs.c (build_libfunc_function): New function split out from ...
(init_one_libfunc): ... here.
* tree.h (DECL_FUNCTION_PERSONALITY): New.
(tree_function_decl): Add personality.
(lhd_gcc_personality): Declare.
(build_personality_function): Likewise.
* tree.c (gcc_eh_personality_decl): New.
(lhd_gcc_personality): New function.
* except.h (lang_eh_runtime_type): Remove.
(enum eh_personality_kind): New.
(build_personality_function): Declare.
(function_needs_eh_personality): Declare.
* except.c (lang_eh_runtime_type): Remove.
(function_needs_eh_personality): New function.
(add_type_for_runtime): Call lang_hooks.type_for_runtime instead.
(sjlj_emit_function_enter, output_function_exception_table):
Use personality from current_function_decl.
* tree-eh.c (lower_eh_constructs): Set DECL_FUNCTION_PERSONALITY.
* tree-inline.c (tree_can_inline_p): Do not inline across different
EH personalities.
(expand_call_inline): Likewise. Adjust the callers EH personality.
(tree_function_versioning): Copy DECL_FUNCTION_PERSONALITY.
* cgraph.c (cgraph_add_new_function): Set DECL_FUNCTION_PERSONALITY.
* Makefile.in (cgraph.o): Add $(EXCEPT_H) dependency.
(c-parser.o): Likewise
* c-tree.h (c_eh_initialized_p): Remove.
(c_maybe_initialize_eh): Likewise.
* c-decl.c (finish_decl): Don't call c_maybe_initialize_eh.
(finish_decl): Don't call c_maybe_initialize_eh.
(c_eh_initialized_p): Remove.
(c_maybe_initialize_eh): Likewise.
* c-parser.c (c_parser_omp_construct): Likewise.
(c_parse_file): Initialize exception handling.
objc/
* objc-act.c (objc_eh_runtime_type): Export.
(objc_init_exceptions): Remove. Move warning code ...
(objc_begin_try_stmt): ... here
(objc_build_throw_stmt): ... and here.
(objc_eh_personality_decl): New.
(objc_eh_personality): New function.
* objc-act.h (objc_eh_runtime_type): Declare.
(objc_eh_personality): Likewise.
* objc-lang.c (LANG_HOOKS_EH_RUNTIME_TYPE): Define.
(LANG_HOOKS_EH_PERSONALITY): Likewise.
cp/
* except.c (init_exception_processing): Do not set
lang_eh_runtime_type.
(choose_personality_routine): Do not set eh_personality_decl,
set pragma_java_exceptions.
* cp-lang.c (LANG_HOOKS_EH_RUNTIME_TYPE): Define.
(LANG_HOOKS_EH_PERSONALITY): Likewise.
(cp_eh_personality_decl): New.
(cp_eh_personality): Likewise.
* Make-lang.in (cp-lang.o): Add $(EXPR_H) and $(EXCEPT_H)
dependencies.
java/
* decl.c (do_nothing): Remove.
(java_init_decl_processing): Do not set lang_eh_runtime_type.
* Make-lang.in (lang.o): Add $(EXCEPT_H) dependency.
* lang.c (java_eh_personality): New.
(java_eh_personality_decl): Likewise.
(LANG_HOOKS_EH_PERSONALITY): Define.
ada/
* gcc-interface/misc.c (gnat_init_gcc_eh): Do not set
lang_eh_runtime_type.
(LANG_HOOKS_EH_PERSONALITY): Define.
(gnat_eh_personality_decl): New.
(gnat_eh_personality): Likewise.
* Make-lang.in (misc.o): Add gt-ada-misc.h dependency.
* config-lang.in (gtfiles): Add misc.c.
fortran/
* f95-lang.c (gfc_maybe_initialize_eh): Do not init
eh_personality_libfunc.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151676 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-inline.c')
-rw-r--r-- | gcc/tree-inline.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index b5e73467127..b83c52f5370 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -3505,6 +3505,13 @@ expand_call_inline (basic_block bb, gimple stmt, copy_body_data *id) cg_edge = cgraph_edge (id->dst_node, stmt); + /* Don't inline functions with different EH personalities. */ + if (DECL_FUNCTION_PERSONALITY (cg_edge->caller->decl) + && DECL_FUNCTION_PERSONALITY (cg_edge->callee->decl) + && (DECL_FUNCTION_PERSONALITY (cg_edge->caller->decl) + != DECL_FUNCTION_PERSONALITY (cg_edge->callee->decl))) + goto egress; + /* Don't try to inline functions that are not well-suited to inlining. */ if (!cgraph_inline_p (cg_edge, &reason)) @@ -3546,6 +3553,11 @@ expand_call_inline (basic_block bb, gimple stmt, copy_body_data *id) /* We will be inlining this callee. */ id->eh_region = lookup_stmt_eh_region (stmt); + /* Update the callers EH personality. */ + if (DECL_FUNCTION_PERSONALITY (cg_edge->callee->decl)) + DECL_FUNCTION_PERSONALITY (cg_edge->caller->decl) + = DECL_FUNCTION_PERSONALITY (cg_edge->callee->decl); + /* Split the block holding the GIMPLE_CALL. */ e = split_block (bb, stmt); bb = e->src; @@ -4730,6 +4742,7 @@ tree_function_versioning (tree old_decl, tree new_decl, DECL_ARTIFICIAL (new_decl) = 1; DECL_ABSTRACT_ORIGIN (new_decl) = DECL_ORIGIN (old_decl); + DECL_FUNCTION_PERSONALITY (new_decl) = DECL_FUNCTION_PERSONALITY (old_decl); /* Prepare the data structures for the tree copy. */ memset (&id, 0, sizeof (id)); @@ -5000,6 +5013,18 @@ tree_can_inline_p (struct cgraph_edge *e) caller = e->caller->decl; callee = e->callee->decl; + /* We cannot inline a function that uses a different EH personality + than the caller. */ + if (DECL_FUNCTION_PERSONALITY (caller) + && DECL_FUNCTION_PERSONALITY (callee) + && (DECL_FUNCTION_PERSONALITY (caller) + != DECL_FUNCTION_PERSONALITY (callee))) + { + e->inline_failed = CIF_UNSPECIFIED; + gimple_call_set_cannot_inline (e->call_stmt, true); + return false; + } + /* Allow the backend to decide if inlining is ok. */ if (!targetm.target_option.can_inline_p (caller, callee)) { |