* 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
+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
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;
+
+ 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;
- if (! (code == PRE_DEC || code == PRE_INC)
- || XEXP (src, 0) != stack_pointer_rtx)
+ 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;
if (! RTX_FRAME_RELATED_P (insn))
{
- dwarf2out_stack_adjust (PATTERN (insn));
+ dwarf2out_stack_adjust (insn);
return;
}
/* 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
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;
case CODE_LABEL:
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. */
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)
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
put_reg (i, val, my_udata);
}
- pc = get_return_addr (udata, sub_udata);
+ pc = get_return_addr (udata, sub_udata) - 1;
}
#ifdef INCOMING_REGNO