From 34dc173c2c848264901401da687c6edea165b7c9 Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Sat, 10 May 2003 22:59:04 +0000 Subject: except.c (EH_RETURN_STACKADJ_RTX): Do not define. * except.c (EH_RETURN_STACKADJ_RTX): Do not define. (EH_RETURN_HANDLER_RTX): Likewise. (expand_builtin_eh_return): Do not copy stack adjustment if EH_RETURN_STACKADJ_RTX is not defined. (expand_eh_return): Likewise. Also, do not pass stack adjustment as argument to the eh_return pattern. * except.h (MUST_USE_SJLJ_EXCEPTIONS): Do not define just because EH_RETURN_STACKADJ_RTX is not defined. * unwind-dw.c (uw_update_context_1): If EH_RETURN_STACKADJ_RTX is not defined, treat stack pointer like a regular register. (uw_init_context_1): Set up fake initial stack pointer register. (uw_install_context_1): Do not compute stack adjustment if EH_RETURN_STACKADJ_RTX is not defined. * config/i386/i386.md ("eh_return"): Remove first argument. * config/mips/mips.md ("eh_return"): Likewise. * config/rs6000/rs6000.md ("eh_return"): Likewise. * config/sh/sh.md ("eh_return"): Likewise. * config/s390/s390.h (EH_RETURN_STACKADJ_RTX): Remove. From-SVN: r66672 --- gcc/unwind-dw2.c | 41 ++++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 15 deletions(-) (limited to 'gcc/unwind-dw2.c') diff --git a/gcc/unwind-dw2.c b/gcc/unwind-dw2.c index f752ffe..673d164 100644 --- a/gcc/unwind-dw2.c +++ b/gcc/unwind-dw2.c @@ -1076,10 +1076,10 @@ static void uw_update_context_1 (struct _Unwind_Context *context, _Unwind_FrameState *fs) { struct _Unwind_Context orig_context = *context; - _Unwind_Word tmp_sp; void *cfa; long i; +#ifdef EH_RETURN_STACKADJ_RTX /* Special handling here: Many machines do not use a frame pointer, and track the CFA only through offsets from the stack pointer from one frame to the next. In this case, the stack pointer is never @@ -1094,12 +1094,16 @@ uw_update_context_1 (struct _Unwind_Context *context, _Unwind_FrameState *fs) frame, and be able to use much easier CFA mechanisms to do it. Always zap the saved stack pointer value for the next frame; carrying the value over from one frame to another doesn't make sense. */ + + _Unwind_Word tmp_sp; + if (!_Unwind_GetGRPtr (&orig_context, __builtin_dwarf_sp_column ())) { tmp_sp = (_Unwind_Ptr) context->cfa; _Unwind_SetGRPtr (&orig_context, __builtin_dwarf_sp_column (), &tmp_sp); } _Unwind_SetGRPtr (context, __builtin_dwarf_sp_column (), NULL); +#endif /* Compute this frame's CFA. */ switch (fs->cfa_how) @@ -1202,7 +1206,7 @@ uw_init_context_1 (struct _Unwind_Context *context, abort (); /* Force the frame state to use the known cfa value. */ - context->cfa = outer_cfa; + _Unwind_SetGRPtr (context, __builtin_dwarf_sp_column (), &outer_cfa); fs.cfa_how = CFA_REG_OFFSET; fs.cfa_reg = __builtin_dwarf_sp_column (); fs.cfa_offset = 0; @@ -1240,7 +1244,6 @@ uw_install_context_1 (struct _Unwind_Context *current, struct _Unwind_Context *target) { long i; - void *target_cfa; #if __GTHREADS { @@ -1263,18 +1266,26 @@ uw_install_context_1 (struct _Unwind_Context *current, memcpy (c, t, dwarf_reg_size_table[i]); } - /* If the last frame records a saved stack pointer, use it. */ - if (_Unwind_GetGRPtr (target, __builtin_dwarf_sp_column ())) - target_cfa = (void *)(_Unwind_Ptr) - _Unwind_GetGR (target, __builtin_dwarf_sp_column ()); - else - target_cfa = target->cfa; - - /* We adjust SP by the difference between CURRENT and TARGET's CFA. */ - if (STACK_GROWS_DOWNWARD) - return target_cfa - current->cfa + target->args_size; - else - return current->cfa - target_cfa - target->args_size; +#ifdef EH_RETURN_STACKADJ_RTX + { + void *target_cfa; + + /* If the last frame records a saved stack pointer, use it. */ + if (_Unwind_GetGRPtr (target, __builtin_dwarf_sp_column ())) + target_cfa = (void *)(_Unwind_Ptr) + _Unwind_GetGR (target, __builtin_dwarf_sp_column ()); + else + target_cfa = target->cfa; + + /* We adjust SP by the difference between CURRENT and TARGET's CFA. */ + if (STACK_GROWS_DOWNWARD) + return target_cfa - current->cfa + target->args_size; + else + return current->cfa - target_cfa - target->args_size; + } +#else + return 0; +#endif } static inline _Unwind_Ptr -- cgit v1.1