dwarf2out.c (dwarf2out_stack_adjust): Add after_p argument.

* dwarf2out.c (dwarf2out_stack_adjust): Add after_p argument.  Save
	args_size adjustments for calls even with cfa as stack pointer.
	Search calls for stack adjustments after the insn is issued.
	(dwarf2out_frame_debug): Add after_p argument; pass it on.
	* dwarf2out.h (dwarf2out_frame_debug): Update to match.
	* final.c (final_start_function, final_scan_insn): Likewise.

From-SVN: r91319
This commit is contained in:
Richard Henderson 2004-11-25 18:21:38 -08:00 committed by Richard Henderson
parent 58767f002a
commit e0c0490bfe
4 changed files with 48 additions and 32 deletions

View File

@ -1,4 +1,13 @@
2004-11-25 Ricahrd Henderson <rth@redhat.com> 2004-11-25 Richard Henderson <rth@redhat.com>
* dwarf2out.c (dwarf2out_stack_adjust): Add after_p argument. Save
args_size adjustments for calls even with cfa as stack pointer.
Search calls for stack adjustments after the insn is issued.
(dwarf2out_frame_debug): Add after_p argument; pass it on.
* dwarf2out.h (dwarf2out_frame_debug): Update to match.
* final.c (final_start_function, final_scan_insn): Likewise.
2004-11-25 Richard Henderson <rth@redhat.com>
PR c++/6764 PR c++/6764
* reload1.c (set_initial_eh_label_offset): New. * reload1.c (set_initial_eh_label_offset): New.

View File

@ -363,7 +363,7 @@ static void initial_return_save (rtx);
static HOST_WIDE_INT stack_adjust_offset (rtx); static HOST_WIDE_INT stack_adjust_offset (rtx);
static void output_cfi (dw_cfi_ref, dw_fde_ref, int); static void output_cfi (dw_cfi_ref, dw_fde_ref, int);
static void output_call_frame_info (int); static void output_call_frame_info (int);
static void dwarf2out_stack_adjust (rtx); static void dwarf2out_stack_adjust (rtx, bool);
static void flush_queued_reg_saves (void); static void flush_queued_reg_saves (void);
static bool clobbers_queued_reg_save (rtx); static bool clobbers_queued_reg_save (rtx);
static void dwarf2out_frame_debug_expr (rtx, const char *); static void dwarf2out_frame_debug_expr (rtx, const char *);
@ -1051,7 +1051,7 @@ stack_adjust_offset (rtx pattern)
much extra space it needs to pop off the stack. */ much extra space it needs to pop off the stack. */
static void static void
dwarf2out_stack_adjust (rtx insn) dwarf2out_stack_adjust (rtx insn, bool after_p)
{ {
HOST_WIDE_INT offset; HOST_WIDE_INT offset;
const char *label; const char *label;
@ -1064,26 +1064,31 @@ dwarf2out_stack_adjust (rtx insn)
if (prologue_epilogue_contains (insn) || sibcall_epilogue_contains (insn)) if (prologue_epilogue_contains (insn) || sibcall_epilogue_contains (insn))
return; return;
if (!flag_asynchronous_unwind_tables && CALL_P (insn)) /* If only calls can throw, and we have a frame pointer,
save up adjustments until we see the CALL_INSN. */
if (!flag_asynchronous_unwind_tables && cfa.reg != STACK_POINTER_REGNUM)
{ {
/* Extract the size of the args from the CALL rtx itself. */ if (CALL_P (insn) && !after_p)
insn = PATTERN (insn); {
if (GET_CODE (insn) == PARALLEL) /* Extract the size of the args from the CALL rtx itself. */
insn = XVECEXP (insn, 0, 0); insn = PATTERN (insn);
if (GET_CODE (insn) == SET) if (GET_CODE (insn) == PARALLEL)
insn = SET_SRC (insn); insn = XVECEXP (insn, 0, 0);
gcc_assert (GET_CODE (insn) == CALL); if (GET_CODE (insn) == SET)
insn = SET_SRC (insn);
dwarf2out_args_size ("", INTVAL (XEXP (insn, 1))); gcc_assert (GET_CODE (insn) == CALL);
dwarf2out_args_size ("", INTVAL (XEXP (insn, 1)));
}
return; return;
} }
/* If only calls can throw, and we have a frame pointer, if (CALL_P (insn) && !after_p)
save up adjustments until we see the CALL_INSN. */ {
else if (!flag_asynchronous_unwind_tables && cfa.reg != STACK_POINTER_REGNUM) if (!flag_asynchronous_unwind_tables)
return; dwarf2out_args_size ("", args_size);
return;
if (BARRIER_P (insn)) }
else if (BARRIER_P (insn))
{ {
/* When we see a BARRIER, we know to reset args_size to 0. Usually /* When we see a BARRIER, we know to reset args_size to 0. Usually
the compiler will have already emitted a stack adjustment, but the compiler will have already emitted a stack adjustment, but
@ -1124,7 +1129,8 @@ dwarf2out_stack_adjust (rtx insn)
label = dwarf2out_cfi_label (); label = dwarf2out_cfi_label ();
def_cfa_1 (label, &cfa); def_cfa_1 (label, &cfa);
dwarf2out_args_size (label, args_size); if (flag_asynchronous_unwind_tables)
dwarf2out_args_size (label, args_size);
} }
#endif #endif
@ -1772,10 +1778,13 @@ dwarf2out_frame_debug_expr (rtx expr, const char *label)
/* Record call frame debugging information for INSN, which either /* Record call frame debugging information for INSN, which either
sets SP or FP (adjusting how we calculate the frame address) or saves a sets SP or FP (adjusting how we calculate the frame address) or saves a
register to the stack. If INSN is NULL_RTX, initialize our state. */ register to the stack. If INSN is NULL_RTX, initialize our state.
If AFTER_P is false, we're being called before the insn is emitted,
otherwise after. Call instructions get invoked twice. */
void void
dwarf2out_frame_debug (rtx insn) dwarf2out_frame_debug (rtx insn, bool after_p)
{ {
const char *label; const char *label;
rtx src; rtx src;
@ -1812,8 +1821,7 @@ dwarf2out_frame_debug (rtx insn)
if (! RTX_FRAME_RELATED_P (insn)) if (! RTX_FRAME_RELATED_P (insn))
{ {
if (!ACCUMULATE_OUTGOING_ARGS) if (!ACCUMULATE_OUTGOING_ARGS)
dwarf2out_stack_adjust (insn); dwarf2out_stack_adjust (insn, after_p);
return; return;
} }

View File

@ -20,7 +20,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */ 02111-1307, USA. */
extern void dwarf2out_decl (tree); extern void dwarf2out_decl (tree);
extern void dwarf2out_frame_debug (rtx); extern void dwarf2out_frame_debug (rtx, bool);
extern void debug_dwarf (void); extern void debug_dwarf (void);
struct die_struct; struct die_struct;

View File

@ -1366,7 +1366,7 @@ final_start_function (rtx first ATTRIBUTE_UNUSED, FILE *file,
#if defined (DWARF2_UNWIND_INFO) && defined (HAVE_prologue) #if defined (DWARF2_UNWIND_INFO) && defined (HAVE_prologue)
if (dwarf2out_do_frame ()) if (dwarf2out_do_frame ())
dwarf2out_frame_debug (NULL_RTX); dwarf2out_frame_debug (NULL_RTX, false);
#endif #endif
/* If debugging, assign block numbers to all of the blocks in this /* If debugging, assign block numbers to all of the blocks in this
@ -1848,7 +1848,7 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED,
case BARRIER: case BARRIER:
#if defined (DWARF2_UNWIND_INFO) #if defined (DWARF2_UNWIND_INFO)
if (dwarf2out_do_frame ()) if (dwarf2out_do_frame ())
dwarf2out_frame_debug (insn); dwarf2out_frame_debug (insn, false);
#endif #endif
break; break;
@ -2168,7 +2168,7 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED,
#if defined (DWARF2_UNWIND_INFO) #if defined (DWARF2_UNWIND_INFO)
if (dwarf2out_do_frame ()) if (dwarf2out_do_frame ())
for (i = 1; i < XVECLEN (body, 0); i++) for (i = 1; i < XVECLEN (body, 0); i++)
dwarf2out_frame_debug (XVECEXP (body, 0, i)); dwarf2out_frame_debug (XVECEXP (body, 0, i), false);
#endif #endif
/* The first insn in this SEQUENCE might be a JUMP_INSN that will /* The first insn in this SEQUENCE might be a JUMP_INSN that will
@ -2460,7 +2460,7 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED,
#if defined (DWARF2_UNWIND_INFO) #if defined (DWARF2_UNWIND_INFO)
if (CALL_P (insn) && dwarf2out_do_frame ()) if (CALL_P (insn) && dwarf2out_do_frame ())
dwarf2out_frame_debug (insn); dwarf2out_frame_debug (insn, false);
#endif #endif
/* Find the proper template for this insn. */ /* Find the proper template for this insn. */
@ -2527,13 +2527,12 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED,
the unwind info. We've already done this for delay slots the unwind info. We've already done this for delay slots
and call instructions. */ and call instructions. */
#if defined (DWARF2_UNWIND_INFO) #if defined (DWARF2_UNWIND_INFO)
if (NONJUMP_INSN_P (insn) if (final_sequence == 0
#if !defined (HAVE_prologue) #if !defined (HAVE_prologue)
&& !ACCUMULATE_OUTGOING_ARGS && !ACCUMULATE_OUTGOING_ARGS
#endif #endif
&& final_sequence == 0
&& dwarf2out_do_frame ()) && dwarf2out_do_frame ())
dwarf2out_frame_debug (insn); dwarf2out_frame_debug (insn, true);
#endif #endif
current_output_insn = debug_insn = 0; current_output_insn = debug_insn = 0;