From 93f90be62c1d84539017ab6d73b061993b367f54 Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Mon, 16 Aug 2004 20:08:31 +0000 Subject: [PATCH] Patch to fix -mcpu=G5 interface to EH runtime library. Reviewed by Geoff Keating. From-SVN: r86074 --- gcc/ChangeLog | 10 ++++++++++ gcc/config/rs6000/rs6000.c | 12 ++++++++++++ gcc/except.c | 11 +++++++---- gcc/target-def.h | 4 ++++ gcc/target.h | 3 +++ gcc/targhooks.c | 6 ++++++ gcc/targhooks.h | 2 ++ 7 files changed, 44 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c6d74bd5333..85d5500d36b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2004-08-16 Fariborz Jahanian + + * except.c (get_exception_filter, build_post_landing_pads, + dw2_build_landing_pads): Use target-specific mode for 'filter'. + * target-def.h (TARGET_EH_RETURN_FILTER_MODE): macro defined and used. + * target.h (eh_return_filter_mode): New field added. + * targhooks.c (default_eh_return_filter_mode): Defined. + * targhooks.h (default_eh_return_filter_mode): Declared. + * config/rs6000/rs6000.c (rs6000_eh_return_filter_mode): Defined. + 2004-08-16 Nathanael Nerode * configure.ac: Replace _GCC_TOPLEV_NONCANONICAL_TARGET with diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index fc63c315f8b..a1760ed0e48 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -748,6 +748,8 @@ static tree rs6000_build_builtin_va_list (void); static tree rs6000_gimplify_va_arg (tree, tree, tree *, tree *); static bool rs6000_must_pass_in_stack (enum machine_mode, tree); +static enum machine_mode rs6000_eh_return_filter_mode (void); + /* Hash table stuff for keeping track of TOC entries. */ struct toc_hash_struct GTY(()) @@ -964,6 +966,9 @@ static const char alt_reg_names[][8] = #undef TARGET_GIMPLIFY_VA_ARG_EXPR #define TARGET_GIMPLIFY_VA_ARG_EXPR rs6000_gimplify_va_arg +#undef TARGET_EH_RETURN_FILTER_MODE +#define TARGET_EH_RETURN_FILTER_MODE rs6000_eh_return_filter_mode + struct gcc_target targetm = TARGET_INITIALIZER; @@ -17171,4 +17176,11 @@ rs6000_dbx_register_number (unsigned int regno) abort (); } +/* target hook eh_return_filter_mode */ +static enum machine_mode +rs6000_eh_return_filter_mode (void) +{ + return TARGET_32BIT ? SImode : word_mode; +} + #include "gt-rs6000.h" diff --git a/gcc/except.c b/gcc/except.c index d45f1b2dcda..c9e086ec758 100644 --- a/gcc/except.c +++ b/gcc/except.c @@ -628,7 +628,7 @@ get_exception_filter (struct function *fun) rtx filter = fun->eh->filter; if (fun == cfun && ! filter) { - filter = gen_reg_rtx (word_mode); + filter = gen_reg_rtx (targetm.eh_return_filter_mode ()); fun->eh->filter = filter; } return filter; @@ -1528,7 +1528,8 @@ build_post_landing_pads (void) emit_cmp_and_jump_insns (cfun->eh->filter, GEN_INT (tree_low_cst (TREE_VALUE (flt_node), 0)), - EQ, NULL_RTX, word_mode, 0, c->label); + EQ, NULL_RTX, + targetm.eh_return_filter_mode (), 0, c->label); tp_node = TREE_CHAIN (tp_node); flt_node = TREE_CHAIN (flt_node); @@ -1560,7 +1561,8 @@ build_post_landing_pads (void) emit_cmp_and_jump_insns (cfun->eh->filter, GEN_INT (region->u.allowed.filter), - EQ, NULL_RTX, word_mode, 0, region->label); + EQ, NULL_RTX, + targetm.eh_return_filter_mode (), 0, region->label); /* We delay the generation of the _Unwind_Resume until we generate landing pads. We emit a marker here so as to get good control @@ -1738,7 +1740,8 @@ dw2_build_landing_pads (void) emit_move_insn (cfun->eh->exc_ptr, gen_rtx_REG (ptr_mode, EH_RETURN_DATA_REGNO (0))); emit_move_insn (cfun->eh->filter, - gen_rtx_REG (word_mode, EH_RETURN_DATA_REGNO (1))); + gen_rtx_REG (targetm.eh_return_filter_mode (), + EH_RETURN_DATA_REGNO (1))); seq = get_insns (); end_sequence (); diff --git a/gcc/target-def.h b/gcc/target-def.h index 407ee0bb54f..7180a3e1f67 100644 --- a/gcc/target-def.h +++ b/gcc/target-def.h @@ -268,6 +268,9 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. TARGET_SCHED_DFA_NEW_CYCLE, \ TARGET_SCHED_IS_COSTLY_DEPENDENCE} +/* In except.c */ +#define TARGET_EH_RETURN_FILTER_MODE default_eh_return_filter_mode; + /* In tree.c. */ #define TARGET_MERGE_DECL_ATTRIBUTES merge_decl_attributes #define TARGET_MERGE_TYPE_ATTRIBUTES merge_type_attributes @@ -436,6 +439,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. { \ TARGET_ASM_OUT, \ TARGET_SCHED, \ + TARGET_EH_RETURN_FILTER_MODE, \ TARGET_MERGE_DECL_ATTRIBUTES, \ TARGET_MERGE_TYPE_ATTRIBUTES, \ TARGET_ATTRIBUTE_TABLE, \ diff --git a/gcc/target.h b/gcc/target.h index 9a185e5b9b7..ad37161bc48 100644 --- a/gcc/target.h +++ b/gcc/target.h @@ -276,6 +276,9 @@ struct gcc_target bool (* is_costly_dependence) (rtx, rtx, rtx, int, int); } sched; + /* Return machine mode for filter value. */ + enum machine_mode (* eh_return_filter_mode) (void); + /* Given two decls, merge their attributes and return the result. */ tree (* merge_decl_attributes) (tree, tree); diff --git a/gcc/targhooks.c b/gcc/targhooks.c index 3eff2fd4f50..00d7e8444d7 100644 --- a/gcc/targhooks.c +++ b/gcc/targhooks.c @@ -128,6 +128,12 @@ default_pretend_outgoing_varargs_named (CUMULATIVE_ARGS *ca ATTRIBUTE_UNUSED) != default_setup_incoming_varargs); } +enum machine_mode +default_eh_return_filter_mode (void) +{ + return word_mode; +} + /* Generic hook that takes a CUMULATIVE_ARGS pointer and returns true. */ bool diff --git a/gcc/targhooks.h b/gcc/targhooks.h index 5fa6a553236..077175eda9d 100644 --- a/gcc/targhooks.h +++ b/gcc/targhooks.h @@ -31,6 +31,8 @@ extern rtx default_builtin_setjmp_frame_value (void); extern bool hook_bool_CUMULATIVE_ARGS_false (CUMULATIVE_ARGS *); extern bool default_pretend_outgoing_varargs_named (CUMULATIVE_ARGS *); +extern enum machine_mode default_eh_return_filter_mode (void); + extern bool hook_bool_CUMULATIVE_ARGS_true (CUMULATIVE_ARGS *); extern tree default_cxx_guard_type (void); extern tree default_cxx_get_cookie_size (tree); -- 2.30.2