From 86c99549914362bc54b0872166324522901c2ca1 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Fri, 8 Jun 2001 15:57:23 -0700 Subject: [PATCH] except.c (get_exception_pointer, [...]): Take a struct function. * except.c (get_exception_pointer, get_exception_filter): Take a struct function. Update all callers. * except.h (get_exception_pointer): Update declaration. * expr.c (expand_expr): Update get_exception_pointer call. * integrate.c (expand_inline_function): Remap the exception pointer from callee to caller. From-SVN: r43060 --- gcc/ChangeLog | 9 +++++++++ gcc/except.c | 28 +++++++++++++++------------- gcc/except.h | 2 +- gcc/expr.c | 2 +- gcc/integrate.c | 5 +++++ 5 files changed, 31 insertions(+), 15 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7fcaca4e39c..2dc96830cac 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2001-06-08 Richard Henderson + + * except.c (get_exception_pointer, get_exception_filter): Take a + struct function. Update all callers. + * except.h (get_exception_pointer): Update declaration. + * expr.c (expand_expr): Update get_exception_pointer call. + * integrate.c (expand_inline_function): Remap the exception pointer + from callee to caller. + 2001-06-08 Mark Mitchell * c-decl.c (grokdeclarator): Make the TREE_TYPE for declarations diff --git a/gcc/except.c b/gcc/except.c index 24e70799de7..6e90fe4e6ab 100644 --- a/gcc/except.c +++ b/gcc/except.c @@ -256,7 +256,7 @@ static tree lookup_type_for_runtime PARAMS ((tree)); static struct eh_region *expand_eh_region_end PARAMS ((void)); -static rtx get_exception_filter PARAMS ((void)); +static rtx get_exception_filter PARAMS ((struct function *)); static void collect_eh_region_array PARAMS ((void)); static void resolve_fixup_regions PARAMS ((void)); @@ -720,9 +720,9 @@ expand_eh_region_end_cleanup (handler) /* In case this cleanup involves an inline destructor with a try block in it, we need to save the EH return data registers around it. */ data_save[0] = gen_reg_rtx (Pmode); - emit_move_insn (data_save[0], get_exception_pointer ()); + emit_move_insn (data_save[0], get_exception_pointer (cfun)); data_save[1] = gen_reg_rtx (word_mode); - emit_move_insn (data_save[1], get_exception_filter ()); + emit_move_insn (data_save[1], get_exception_filter (cfun)); expand_expr (handler, const0_rtx, VOIDmode, 0); @@ -951,13 +951,14 @@ expand_eh_region_end_fixup (handler) within a handler. */ rtx -get_exception_pointer () +get_exception_pointer (fun) + struct function *fun; { - rtx exc_ptr = cfun->eh->exc_ptr; - if (! exc_ptr) + rtx exc_ptr = fun->eh->exc_ptr; + if (fun == cfun && ! exc_ptr) { exc_ptr = gen_reg_rtx (Pmode); - cfun->eh->exc_ptr = exc_ptr; + fun->eh->exc_ptr = exc_ptr; } return exc_ptr; } @@ -966,13 +967,14 @@ get_exception_pointer () within a handler. */ static rtx -get_exception_filter () +get_exception_filter (fun) + struct function *fun; { - rtx filter = cfun->eh->filter; - if (! filter) + rtx filter = fun->eh->filter; + if (fun == cfun && ! filter) { filter = gen_reg_rtx (word_mode); - cfun->eh->filter = filter; + fun->eh->filter = filter; } return filter; } @@ -2356,8 +2358,8 @@ finish_eh_generation () /* These registers are used by the landing pads. Make sure they have been generated. */ - get_exception_pointer (); - get_exception_filter (); + get_exception_pointer (cfun); + get_exception_filter (cfun); /* Construct the landing pads. */ diff --git a/gcc/except.h b/gcc/except.h index 1671cf67b5c..b5a219ec2ea 100644 --- a/gcc/except.h +++ b/gcc/except.h @@ -137,7 +137,7 @@ extern rtx expand_builtin_dwarf_fp_regnum PARAMS ((void)); extern void expand_builtin_eh_return PARAMS ((tree, tree)); extern void expand_eh_return PARAMS ((void)); -extern rtx get_exception_pointer PARAMS ((void)); +extern rtx get_exception_pointer PARAMS ((struct function *)); struct function; struct inline_remap; diff --git a/gcc/expr.c b/gcc/expr.c index aaaab7a32f6..732b1108ddf 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -8827,7 +8827,7 @@ expand_expr (exp, target, tmode, modifier) return expand_builtin_va_arg (TREE_OPERAND (exp, 0), type); case EXC_PTR_EXPR: - return get_exception_pointer (); + return get_exception_pointer (cfun); default: return (*lang_expand_expr) (exp, original_target, tmode, modifier); diff --git a/gcc/integrate.c b/gcc/integrate.c index ff9d33f20c4..f4246f06dc4 100644 --- a/gcc/integrate.c +++ b/gcc/integrate.c @@ -1111,6 +1111,11 @@ expand_inline_function (fndecl, parms, target, ignore, type, else abort (); + /* Remap the exception handler data pointer from one to the other. */ + temp = get_exception_pointer (inl_f); + if (temp) + map->reg_map[REGNO (temp)] = get_exception_pointer (cfun); + /* Initialize label_map. get_label_from_map will actually make the labels. */ memset ((char *) &map->label_map[min_labelno], 0, -- 2.30.2