Commit 89e25f95 by Bernd Schmidt Committed by Richard Henderson

dwarf2out: Emit NOTE_INSN_CFI_* both with and without cfi-asm.

This patch is essentially Bernd's 006-cfilabel patch, updated
for all the other changes to dwarf2out.

The patch reduces the difference between the cfi-asm and non-cfi-asm
code paths.  We now emit the CFI notes in all cases.  Later, after we're
done producing the CFI insns we need, another pass over the rtl adds
the necessary labels and set_loc/advance_loc CFIs.  One consequence of
this is that def_cfa_1 can no longer use lookup_cfa, so it just compares
to an old_cfa variable instead.

The major change since Bernd's patch is that all the target-specific
changes are no longer necessary.

        * dwarf2cfi.c (add_cfi): Remove.
        (dwarf2out_cfi_label): Remove force argument.  Only generate the
        label name.
        (add_fde_cfi): Simplify the different code paths.
        (add_cie_cfi): New.
        (old_cfa, old_cfa_remember): New.
        (def_cfa_1, reg_save): Remove label, add for_cie parameter.
        (last_reg_save_label): Remove.
        (dwarf2out_args_size, dwarf2out_stack_adjust, queue_reg_save,
        dwarf2out_frame_debug_def_cfa, dwarf2out_frame_debug_adjust_cfa,
        dwarf2out_frame_debug_cfa_offset, dwarf2out_frame_debug_cfa_register,
        dwarf2out_frame_debug_cfa_expression,
        dwarf2out_frame_debug_cfa_restore,
        dwarf2out_frame_debug_cfa_window_save,
        dwarf2out_frame_debug_expr): Remove label parameter.
        (cfi_label_required_p, add_cfis_to_fde): New.
        (dwarf2out_frame_debug_after_prologue): New.
        (dwarf2cfi_frame_init): Initialize old_cfa.
        (dwarf2out_frame_debug_restore_state): Likewise.
        * dwarf2out.c (dwarf2out_emit_cfi): Only do output for cfi_asm.
        (dwarf2out_switch_text_section): Don't clear dw_fde_current_label here.
        * final.c (final_start_function): Call
        dwarf2out_frame_debug_after_prologue.

Co-Authored-By: Richard Henderson <rth@redhat.com>

From-SVN: r176017
parent bc5612ed
2011-07-07 Bernd Schmidt <bernds@codesourcery.com> 2011-07-07 Bernd Schmidt <bernds@codesourcery.com>
Richard Henderson <rth@redhat.com> Richard Henderson <rth@redhat.com>
* dwarf2cfi.c (add_cfi): Remove.
(dwarf2out_cfi_label): Remove force argument. Only generate the
label name.
(add_fde_cfi): Simplify the different code paths.
(add_cie_cfi): New.
(old_cfa, old_cfa_remember): New.
(def_cfa_1, reg_save): Remove label, add for_cie parameter.
(last_reg_save_label): Remove.
(dwarf2out_args_size, dwarf2out_stack_adjust, queue_reg_save,
dwarf2out_frame_debug_def_cfa, dwarf2out_frame_debug_adjust_cfa,
dwarf2out_frame_debug_cfa_offset, dwarf2out_frame_debug_cfa_register,
dwarf2out_frame_debug_cfa_expression,
dwarf2out_frame_debug_cfa_restore,
dwarf2out_frame_debug_cfa_window_save,
dwarf2out_frame_debug_expr): Remove label parameter.
(cfi_label_required_p, add_cfis_to_fde): New.
(dwarf2out_frame_debug_after_prologue): New.
(dwarf2cfi_frame_init): Initialize old_cfa.
(dwarf2out_frame_debug_restore_state): Likewise.
* dwarf2out.c (dwarf2out_emit_cfi): Only do output for cfi_asm.
(dwarf2out_switch_text_section): Don't clear dw_fde_current_label here.
* final.c (final_start_function): Call
dwarf2out_frame_debug_after_prologue.
2011-07-07 Bernd Schmidt <bernds@codesourcery.com>
Richard Henderson <rth@redhat.com>
* dwarf2cfi.c (cfi_insn): New. * dwarf2cfi.c (cfi_insn): New.
(dwarf2out_cfi_label): Don't emit cfi label here. (dwarf2out_cfi_label): Don't emit cfi label here.
(add_fde_cfi): Create a NOTE_INSN_CFI. (add_fde_cfi): Create a NOTE_INSN_CFI.
......
...@@ -945,7 +945,8 @@ output_cfi_directive (dw_cfi_ref cfi) ...@@ -945,7 +945,8 @@ output_cfi_directive (dw_cfi_ref cfi)
void void
dwarf2out_emit_cfi (dw_cfi_ref cfi) dwarf2out_emit_cfi (dw_cfi_ref cfi)
{ {
output_cfi_directive (cfi); if (dwarf2out_do_cfi_asm ())
output_cfi_directive (cfi);
} }
/* Output CFIs from VEC, up to index UPTO, to bring current FDE to the /* Output CFIs from VEC, up to index UPTO, to bring current FDE to the
...@@ -1793,10 +1794,6 @@ dwarf2out_switch_text_section (void) ...@@ -1793,10 +1794,6 @@ dwarf2out_switch_text_section (void)
} }
have_multiple_function_sections = true; have_multiple_function_sections = true;
/* Reset the current label on switching text sections, so that we
don't attempt to advance_loc4 between labels in different sections. */
fde->dw_fde_current_label = NULL;
/* There is no need to mark used sections when not debugging. */ /* There is no need to mark used sections when not debugging. */
if (cold_text_section != NULL) if (cold_text_section != NULL)
dwarf2out_note_section_used (); dwarf2out_note_section_used ();
......
...@@ -243,6 +243,7 @@ extern enum dw_cfi_oprnd_type dw_cfi_oprnd2_desc ...@@ -243,6 +243,7 @@ extern enum dw_cfi_oprnd_type dw_cfi_oprnd2_desc
extern void dwarf2out_decl (tree); extern void dwarf2out_decl (tree);
extern void dwarf2out_frame_debug (rtx, bool); extern void dwarf2out_frame_debug (rtx, bool);
extern void dwarf2out_frame_debug_init (void); extern void dwarf2out_frame_debug_init (void);
extern void dwarf2out_frame_debug_after_prologue (void);
extern void dwarf2out_emit_cfi (dw_cfi_ref cfi); extern void dwarf2out_emit_cfi (dw_cfi_ref cfi);
extern void debug_dwarf (void); extern void debug_dwarf (void);
......
...@@ -1589,6 +1589,11 @@ final_start_function (rtx first ATTRIBUTE_UNUSED, FILE *file, ...@@ -1589,6 +1589,11 @@ final_start_function (rtx first ATTRIBUTE_UNUSED, FILE *file,
/* First output the function prologue: code to set up the stack frame. */ /* First output the function prologue: code to set up the stack frame. */
targetm.asm_out.function_prologue (file, get_frame_size ()); targetm.asm_out.function_prologue (file, get_frame_size ());
#if defined (HAVE_prologue)
if (dwarf2out_do_frame ())
dwarf2out_frame_debug_after_prologue ();
#endif
/* If the machine represents the prologue as RTL, the profiling code must /* If the machine represents the prologue as RTL, the profiling code must
be emitted when NOTE_INSN_PROLOGUE_END is scanned. */ be emitted when NOTE_INSN_PROLOGUE_END is scanned. */
#ifdef HAVE_prologue #ifdef HAVE_prologue
......
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