Commit fbfa55b0 by Richard Henderson Committed by Richard Henderson

dwarf2out.c (queue_reg_save): New.

        * dwarf2out.c (queue_reg_save): New.
        (flush_queued_reg_saves, clobbers_queued_reg_save): New.
        (dwarf2out_frame_debug_expr): Call queue_reg_save instead of
        dwarf2out_reg_save.
        (dwarf2out_frame_debug): Call flush_queued_reg_saves when needed.
        (cfa, cfa_store, cfa_temp): Make static.
        * final.c (final_scan_insn): Always call dwarf2out_frame_debug.

From-SVN: r40594
parent 9de8be0b
2001-03-17 Richard Henderson <rth@redhat.com> 2001-03-17 Richard Henderson <rth@redhat.com>
* dwarf2out.c (queue_reg_save): New.
(flush_queued_reg_saves, clobbers_queued_reg_save): New.
(dwarf2out_frame_debug_expr): Call queue_reg_save instead of
dwarf2out_reg_save.
(dwarf2out_frame_debug): Call flush_queued_reg_saves when needed.
(cfa, cfa_store, cfa_temp): Make static.
* final.c (final_scan_insn): Always call dwarf2out_frame_debug.
2001-03-17 Richard Henderson <rth@redhat.com>
* integrate.h (struct inline_remap): Add local_return_label. * integrate.h (struct inline_remap): Add local_return_label.
* integrate.c (expand_inline_function): Initialize it and emit * integrate.c (expand_inline_function): Initialize it and emit
it after copy_insn_notes. it after copy_insn_notes.
......
...@@ -241,6 +241,9 @@ static long stack_adjust_offset PARAMS ((rtx)); ...@@ -241,6 +241,9 @@ static long stack_adjust_offset PARAMS ((rtx));
static void output_cfi PARAMS ((dw_cfi_ref, dw_fde_ref)); static void output_cfi PARAMS ((dw_cfi_ref, dw_fde_ref));
static void output_call_frame_info PARAMS ((int)); static void output_call_frame_info PARAMS ((int));
static void dwarf2out_stack_adjust PARAMS ((rtx)); static void dwarf2out_stack_adjust PARAMS ((rtx));
static void queue_reg_save PARAMS ((const char *, rtx, long));
static void flush_queued_reg_saves PARAMS ((void));
static bool clobbers_queued_reg_save PARAMS ((rtx));
static void dwarf2out_frame_debug_expr PARAMS ((rtx, const char *)); static void dwarf2out_frame_debug_expr PARAMS ((rtx, const char *));
/* Support for complex CFA locations. */ /* Support for complex CFA locations. */
...@@ -594,11 +597,11 @@ lookup_cfa (loc) ...@@ -594,11 +597,11 @@ lookup_cfa (loc)
} }
/* The current rule for calculating the DWARF2 canonical frame address. */ /* The current rule for calculating the DWARF2 canonical frame address. */
dw_cfa_location cfa; static dw_cfa_location cfa;
/* The register used for saving registers to the stack, and its offset /* The register used for saving registers to the stack, and its offset
from the CFA. */ from the CFA. */
dw_cfa_location cfa_store; static dw_cfa_location cfa_store;
/* The running total of the size of arguments pushed onto the stack. */ /* The running total of the size of arguments pushed onto the stack. */
static long args_size; static long args_size;
...@@ -1020,10 +1023,70 @@ dwarf2out_stack_adjust (insn) ...@@ -1020,10 +1023,70 @@ dwarf2out_stack_adjust (insn)
dwarf2out_args_size (label, args_size); dwarf2out_args_size (label, args_size);
} }
/* We delay emitting a register save until either (a) we reach the end
of the prologue or (b) the register is clobbered. This clusters
register saves so that there are fewer pc advances. */
struct queued_reg_save
{
struct queued_reg_save *next;
rtx reg;
long cfa_offset;
};
static struct queued_reg_save *queued_reg_saves;
static const char *last_reg_save_label;
static void
queue_reg_save (label, reg, offset)
const char *label;
rtx reg;
long offset;
{
struct queued_reg_save *q = (struct queued_reg_save *) xmalloc (sizeof (*q));
q->next = queued_reg_saves;
q->reg = reg;
q->cfa_offset = offset;
queued_reg_saves = q;
last_reg_save_label = label;
}
static void
flush_queued_reg_saves ()
{
struct queued_reg_save *q, *next;
for (q = queued_reg_saves; q ; q = next)
{
dwarf2out_reg_save (last_reg_save_label, REGNO (q->reg), q->cfa_offset);
next = q->next;
free (q);
}
queued_reg_saves = NULL;
last_reg_save_label = NULL;
}
static bool
clobbers_queued_reg_save (insn)
rtx insn;
{
struct queued_reg_save *q;
for (q = queued_reg_saves; q ; q = q->next)
if (modified_in_p (q->reg, insn))
return true;
return false;
}
/* A temporary register holding an integral value used in adjusting SP /* A temporary register holding an integral value used in adjusting SP
or setting up the store_reg. The "offset" field holds the integer or setting up the store_reg. The "offset" field holds the integer
value, not an offset. */ value, not an offset. */
dw_cfa_location cfa_temp; static dw_cfa_location cfa_temp;
/* Record call frame debugging information for an expression EXPR, /* Record call frame debugging information for an expression EXPR,
which either sets SP or FP (adjusting how we calculate the frame which either sets SP or FP (adjusting how we calculate the frame
...@@ -1440,7 +1503,7 @@ dwarf2out_frame_debug_expr (expr, label) ...@@ -1440,7 +1503,7 @@ dwarf2out_frame_debug_expr (expr, label)
on the ARM. */ on the ARM. */
def_cfa_1 (label, &cfa); def_cfa_1 (label, &cfa);
dwarf2out_reg_save (label, STACK_POINTER_REGNUM, offset); queue_reg_save (label, stack_pointer_rtx, offset);
break; break;
} }
else else
...@@ -1462,7 +1525,7 @@ dwarf2out_frame_debug_expr (expr, label) ...@@ -1462,7 +1525,7 @@ dwarf2out_frame_debug_expr (expr, label)
} }
def_cfa_1 (label, &cfa); def_cfa_1 (label, &cfa);
dwarf2out_reg_save (label, REGNO (src), offset); queue_reg_save (label, src, offset);
break; break;
default: default:
...@@ -1483,6 +1546,9 @@ dwarf2out_frame_debug (insn) ...@@ -1483,6 +1546,9 @@ dwarf2out_frame_debug (insn)
if (insn == NULL_RTX) if (insn == NULL_RTX)
{ {
/* Flush any queued register saves. */
flush_queued_reg_saves ();
/* Set up state for generating call frame debug info. */ /* Set up state for generating call frame debug info. */
lookup_cfa (&cfa); lookup_cfa (&cfa);
if (cfa.reg != (unsigned long) DWARF_FRAME_REGNUM (STACK_POINTER_REGNUM)) if (cfa.reg != (unsigned long) DWARF_FRAME_REGNUM (STACK_POINTER_REGNUM))
...@@ -1494,9 +1560,13 @@ dwarf2out_frame_debug (insn) ...@@ -1494,9 +1560,13 @@ dwarf2out_frame_debug (insn)
return; return;
} }
if (GET_CODE (insn) != INSN || clobbers_queued_reg_save (insn))
flush_queued_reg_saves ();
if (! RTX_FRAME_RELATED_P (insn)) if (! RTX_FRAME_RELATED_P (insn))
{ {
dwarf2out_stack_adjust (insn); if (!ACCUMULATE_OUTGOING_ARGS)
dwarf2out_stack_adjust (insn);
return; return;
} }
......
...@@ -2324,9 +2324,7 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes) ...@@ -2324,9 +2324,7 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes)
case BARRIER: case BARRIER:
#if defined (DWARF2_UNWIND_INFO) #if defined (DWARF2_UNWIND_INFO)
/* If we push arguments, we need to check all insns for stack if (dwarf2out_do_frame ())
adjustments. */
if (!ACCUMULATE_OUTGOING_ARGS && dwarf2out_do_frame ())
dwarf2out_frame_debug (insn); dwarf2out_frame_debug (insn);
#endif #endif
break; break;
...@@ -2936,9 +2934,7 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes) ...@@ -2936,9 +2934,7 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes)
current_output_insn = debug_insn = insn; current_output_insn = debug_insn = insn;
#if defined (DWARF2_UNWIND_INFO) #if defined (DWARF2_UNWIND_INFO)
/* If we push arguments, we want to know where the calls are. */ if (GET_CODE (insn) == CALL_INSN && dwarf2out_do_frame ())
if (!ACCUMULATE_OUTGOING_ARGS && GET_CODE (insn) == CALL_INSN
&& dwarf2out_do_frame ())
dwarf2out_frame_debug (insn); dwarf2out_frame_debug (insn);
#endif #endif
...@@ -3006,22 +3002,15 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes) ...@@ -3006,22 +3002,15 @@ final_scan_insn (insn, file, optimize, prescan, nopeepholes)
output_asm_insn (template, recog_data.operand); output_asm_insn (template, recog_data.operand);
#if defined (DWARF2_UNWIND_INFO) #if defined (DWARF2_UNWIND_INFO)
/* If we push arguments, we need to check all insns for stack
adjustments. */
if (!ACCUMULATE_OUTGOING_ARGS)
{
if (GET_CODE (insn) == INSN && dwarf2out_do_frame ())
dwarf2out_frame_debug (insn);
}
else
{
#if defined (HAVE_prologue) #if defined (HAVE_prologue)
/* If this insn is part of the prologue, emit DWARF v2 if (GET_CODE (insn) == INSN && dwarf2out_do_frame ())
call frame info. */ dwarf2out_frame_debug (insn);
if (RTX_FRAME_RELATED_P (insn) && dwarf2out_do_frame ()) #else
dwarf2out_frame_debug (insn); if (!ACCUMULATE_OUTGOING_ARGS
&& GET_CODE (insn) == INSN
&& dwarf2out_do_frame ())
dwarf2out_frame_debug (insn);
#endif #endif
}
#endif #endif
#if 0 #if 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment