final.c (final_scan_insn): Hand BARRIERs off to the dwarf2 code.
* final.c (final_scan_insn): Hand BARRIERs off to the dwarf2 code. * dwarf2out.c (dwarf2out_frame_debug): Pass the whole insn along. (dwarf2out_stack_adjust): A BARRIER resets the args space to 0. * except.c (end_eh_unwinder): Subtract 1 from return address. * libgcc2.c (__throw): Likewise. (find_exception_handler): Don't change PC here. Compare end with >. From-SVN: r15554
This commit is contained in:
parent
feb5876a0b
commit
6020d3605c
|
@ -1,3 +1,13 @@
|
|||
Thu Sep 18 14:22:22 1997 Jason Merrill <jason@yorick.cygnus.com>
|
||||
|
||||
* final.c (final_scan_insn): Hand BARRIERs off to the dwarf2 code.
|
||||
* dwarf2out.c (dwarf2out_frame_debug): Pass the whole insn along.
|
||||
(dwarf2out_stack_adjust): A BARRIER resets the args space to 0.
|
||||
|
||||
* except.c (end_eh_unwinder): Subtract 1 from return address.
|
||||
* libgcc2.c (__throw): Likewise.
|
||||
(find_exception_handler): Don't change PC here. Compare end with >.
|
||||
|
||||
Thu Sep 18 10:43:07 1997 Nick Clifton <nickc@cygnus.com>
|
||||
|
||||
* v850.c (compute_register_save_size): Correct register
|
||||
|
|
|
@ -913,44 +913,64 @@ static void
|
|||
dwarf2out_stack_adjust (insn)
|
||||
rtx insn;
|
||||
{
|
||||
rtx src, dest;
|
||||
enum rtx_code code;
|
||||
long offset;
|
||||
char *label;
|
||||
|
||||
if (GET_CODE (insn) != SET)
|
||||
return;
|
||||
|
||||
src = SET_SRC (insn);
|
||||
dest = SET_DEST (insn);
|
||||
if (dest == stack_pointer_rtx)
|
||||
if (GET_CODE (insn) == BARRIER)
|
||||
{
|
||||
/* (set (reg sp) (plus (reg sp) (const_int))) */
|
||||
code = GET_CODE (src);
|
||||
if (! (code == PLUS || code == MINUS)
|
||||
|| XEXP (src, 0) != stack_pointer_rtx
|
||||
|| GET_CODE (XEXP (src, 1)) != CONST_INT)
|
||||
return;
|
||||
|
||||
offset = INTVAL (XEXP (src, 1));
|
||||
/* When we see a BARRIER, we know to reset args_size to 0. Usually
|
||||
the compiler will have already emitted a stack adjustment, but
|
||||
doesn't bother for calls to noreturn functions. */
|
||||
#ifdef STACK_GROWS_DOWNWARD
|
||||
offset = -args_size;
|
||||
#else
|
||||
offset = args_size;
|
||||
#endif
|
||||
}
|
||||
else if (GET_CODE (dest) == MEM)
|
||||
else if (GET_CODE (PATTERN (insn)) == SET)
|
||||
{
|
||||
/* (set (mem (pre_dec (reg sp))) (foo)) */
|
||||
src = XEXP (dest, 0);
|
||||
code = GET_CODE (src);
|
||||
rtx src, dest;
|
||||
enum rtx_code code;
|
||||
|
||||
if (! (code == PRE_DEC || code == PRE_INC)
|
||||
|| XEXP (src, 0) != stack_pointer_rtx)
|
||||
insn = PATTERN (insn);
|
||||
src = SET_SRC (insn);
|
||||
dest = SET_DEST (insn);
|
||||
|
||||
if (dest == stack_pointer_rtx)
|
||||
{
|
||||
/* (set (reg sp) (plus (reg sp) (const_int))) */
|
||||
code = GET_CODE (src);
|
||||
if (! (code == PLUS || code == MINUS)
|
||||
|| XEXP (src, 0) != stack_pointer_rtx
|
||||
|| GET_CODE (XEXP (src, 1)) != CONST_INT)
|
||||
return;
|
||||
|
||||
offset = INTVAL (XEXP (src, 1));
|
||||
}
|
||||
else if (GET_CODE (dest) == MEM)
|
||||
{
|
||||
/* (set (mem (pre_dec (reg sp))) (foo)) */
|
||||
src = XEXP (dest, 0);
|
||||
code = GET_CODE (src);
|
||||
|
||||
if (! (code == PRE_DEC || code == PRE_INC)
|
||||
|| XEXP (src, 0) != stack_pointer_rtx)
|
||||
return;
|
||||
|
||||
offset = GET_MODE_SIZE (GET_MODE (dest));
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
||||
offset = GET_MODE_SIZE (GET_MODE (dest));
|
||||
if (code == PLUS || code == PRE_INC)
|
||||
offset = -offset;
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
||||
if (code == PLUS || code == PRE_INC)
|
||||
offset = -offset;
|
||||
if (offset == 0)
|
||||
return;
|
||||
|
||||
if (cfa_reg == STACK_POINTER_REGNUM)
|
||||
cfa_offset += offset;
|
||||
|
||||
|
@ -997,7 +1017,7 @@ dwarf2out_frame_debug (insn)
|
|||
|
||||
if (! RTX_FRAME_RELATED_P (insn))
|
||||
{
|
||||
dwarf2out_stack_adjust (PATTERN (insn));
|
||||
dwarf2out_stack_adjust (insn);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1668,6 +1668,8 @@ end_eh_unwinder ()
|
|||
/* Get the address we need to use to determine what exception
|
||||
handler should be invoked, and store it in __eh_pc. */
|
||||
return_val_rtx = eh_outer_context (return_val_rtx);
|
||||
return_val_rtx = expand_binop (Pmode, sub_optab, return_val_rtx, GEN_INT (1),
|
||||
NULL_RTX, 0, OPTAB_LIB_WIDEN);
|
||||
emit_move_insn (eh_saved_pc_rtx, return_val_rtx);
|
||||
|
||||
/* Either set things up so we do a return directly to __throw, or
|
||||
|
|
|
@ -1589,6 +1589,12 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes)
|
|||
is true. */
|
||||
if (NEXT_INSN (insn))
|
||||
ASM_OUTPUT_ALIGN_CODE (file);
|
||||
#endif
|
||||
#if defined (DWARF2_UNWIND_INFO) && !defined (ACCUMULATE_OUTGOING_ARGS)
|
||||
/* If we push arguments, we need to check all insns for stack
|
||||
adjustments. */
|
||||
if (dwarf2out_do_frame ())
|
||||
dwarf2out_frame_debug (insn);
|
||||
#endif
|
||||
break;
|
||||
|
||||
|
|
|
@ -3337,15 +3337,11 @@ find_exception_handler (void *pc, exception_table *table)
|
|||
int pos;
|
||||
int best = -1;
|
||||
|
||||
/* We subtract 1 from PC to avoid hitting the beginning of the next
|
||||
region. */
|
||||
--pc;
|
||||
|
||||
/* We can't do a binary search because the table isn't guaranteed
|
||||
to be sorted from function to function. */
|
||||
for (pos = 0; table[pos].exception_handler != (void *) -1; ++pos)
|
||||
{
|
||||
if (table[pos].start <= pc && table[pos].end >= pc)
|
||||
if (table[pos].start <= pc && table[pos].end > pc)
|
||||
{
|
||||
/* This can apply. Make sure it is at least as small as
|
||||
the previous best. */
|
||||
|
@ -3354,7 +3350,7 @@ find_exception_handler (void *pc, exception_table *table)
|
|||
best = pos;
|
||||
}
|
||||
/* But it is sorted by starting PC within a function. */
|
||||
else if (best && table[pos].start > pc)
|
||||
else if (best >= 0 && table[pos].start > pc)
|
||||
break;
|
||||
}
|
||||
if (best != -1)
|
||||
|
@ -3686,8 +3682,9 @@ label:
|
|||
break;
|
||||
}
|
||||
|
||||
/* Otherwise, we continue searching. */
|
||||
pc = get_return_addr (udata, sub_udata);
|
||||
/* Otherwise, we continue searching. We subtract 1 from PC to avoid
|
||||
hitting the beginning of the next region. */
|
||||
pc = get_return_addr (udata, sub_udata) - 1;
|
||||
}
|
||||
|
||||
/* If we haven't found a handler by now, this is an unhandled
|
||||
|
@ -3736,7 +3733,7 @@ label:
|
|||
put_reg (i, val, my_udata);
|
||||
}
|
||||
|
||||
pc = get_return_addr (udata, sub_udata);
|
||||
pc = get_return_addr (udata, sub_udata) - 1;
|
||||
}
|
||||
|
||||
#ifdef INCOMING_REGNO
|
||||
|
|
Loading…
Reference in New Issue