summaryrefslogtreecommitdiff
path: root/gcc/final.c
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2011-07-07 23:42:41 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2011-07-07 23:42:41 +0000
commit46346a5290f78911b8ae50503d700d0a6e3db9c8 (patch)
treeb847cd3bf525fe133a6b119fd23ec62761a5bce8 /gcc/final.c
parentdcdf448e3aa4f64d0ed7210c00c35eab34f7c404 (diff)
downloadgcc-46346a5290f78911b8ae50503d700d0a6e3db9c8.tar.gz
dwarf2out: Move insn scanning out of final.c.
This patch is essentially Bernd's 005-scanfirst patch, updated for the introduction of the dwarf2cfi.c file. We introduce NOTE_INSN_CFI and NOTE_INSN_CFI_LABEL to hold the dwarf2 info during the bulk of final. The actual construction of these notes still happens during final, right at the very beginning of the pass, via the dwarf2out_frame_debug_init hook. * dwarf2cfi.c (cfi_insn): New. (dwarf2out_cfi_label): Don't emit cfi label here. (add_fde_cfi): Create a NOTE_INSN_CFI. (dwarf2out_frame_debug): Setup cfi_insn. (dwarf2out_frame_debug_init): Loop over insns creating CFI notes. (dwarf2out_cfi_begin_epilogue): Make static. (dwarf2out_frame_debug_restore_state): Make static. * dwarf2out.c (output_cfi_directive): Make static. (dwarf2out_emit_cfi): New. * dwarf2out.h: Update. * final.c (final): Remove CFI notes. (final_scan_insn): Don't call dwarf2out_cfi_begin_epilogue, dwarf2out_frame_debug_restore_state, dwarf2out_frame_debug. Handle NOTE_INSN_CFI and NOTE_INSN_CFI_LABEL. * insn-notes.def (NOTE_INSN_CFI): New. (NOTE_INSN_CFI_LABEL): New. * rtl.h (union rtunion_def): Add rt_cfi member. (XCFI, XCCFI, NOTE_CFI, NOTE_LABEL_NUMBER): New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@176016 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/final.c')
-rw-r--r--gcc/final.c54
1 files changed, 20 insertions, 34 deletions
diff --git a/gcc/final.c b/gcc/final.c
index c0c1fc850ec..835bbd502bf 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -1727,7 +1727,7 @@ dump_basic_block_info (FILE *file, rtx insn, basic_block *start_to_bb,
void
final (rtx first, FILE *file, int optimize_p)
{
- rtx insn;
+ rtx insn, next;
int max_uid = 0;
int seen = 0;
@@ -1801,6 +1801,16 @@ final (rtx first, FILE *file, int optimize_p)
free (start_to_bb);
free (end_to_bb);
}
+
+ /* Remove CFI notes, to avoid compare-debug failures. */
+ for (insn = first; insn; insn = next)
+ {
+ next = NEXT_INSN (insn);
+ if (NOTE_P (insn)
+ && (NOTE_KIND (insn) == NOTE_INSN_CFI
+ || NOTE_KIND (insn) == NOTE_INSN_CFI_LABEL))
+ delete_insn (insn);
+ }
}
const char *
@@ -1973,16 +1983,20 @@ final_scan_insn (rtx insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED,
break;
case NOTE_INSN_EPILOGUE_BEG:
-#if defined (HAVE_epilogue)
- if (dwarf2out_do_frame ())
- dwarf2out_cfi_begin_epilogue (insn);
-#endif
(*debug_hooks->begin_epilogue) (last_linenum, last_filename);
targetm.asm_out.function_begin_epilogue (file);
break;
case NOTE_INSN_CFA_RESTORE_STATE:
- dwarf2out_frame_debug_restore_state ();
+ break;
+
+ case NOTE_INSN_CFI:
+ dwarf2out_emit_cfi (NOTE_CFI (insn));
+ break;
+
+ case NOTE_INSN_CFI_LABEL:
+ ASM_OUTPUT_DEBUG_LABEL (asm_out_file, "LCFI",
+ NOTE_LABEL_NUMBER (insn));
break;
case NOTE_INSN_FUNCTION_BEG:
@@ -2092,8 +2106,6 @@ final_scan_insn (rtx insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED,
break;
case BARRIER:
- if (dwarf2out_do_frame ())
- dwarf2out_frame_debug (insn, false);
break;
case CODE_LABEL:
@@ -2314,11 +2326,6 @@ final_scan_insn (rtx insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED,
location_t loc;
expanded_location expanded;
- /* Make sure we flush any queued register saves in case this
- clobbers affected registers. */
- if (dwarf2out_do_frame ())
- dwarf2out_frame_debug (insn, false);
-
/* There's no telling what that did to the condition codes. */
CC_STATUS_INIT;
@@ -2364,12 +2371,6 @@ final_scan_insn (rtx insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED,
final_sequence = body;
- /* Record the delay slots' frame information before the branch.
- This is needed for delayed calls: see execute_cfa_program(). */
- if (dwarf2out_do_frame ())
- for (i = 1; i < XVECLEN (body, 0); i++)
- dwarf2out_frame_debug (XVECEXP (body, 0, i), false);
-
/* The first insn in this SEQUENCE might be a JUMP_INSN that will
force the restoration of a comparison that was previously
thought unnecessary. If that happens, cancel this sequence
@@ -2683,11 +2684,6 @@ final_scan_insn (rtx insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED,
current_output_insn = debug_insn = insn;
- if (dwarf2out_do_frame ()
- && (CALL_P (insn)
- || find_reg_note (insn, REG_CFA_FLUSH_QUEUE, NULL)))
- dwarf2out_frame_debug (insn, false);
-
/* Find the proper template for this insn. */
templ = get_insn_template (insn_code_number, insn);
@@ -2767,16 +2763,6 @@ final_scan_insn (rtx insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED,
targetm.asm_out.final_postscan_insn (file, insn, recog_data.operand,
recog_data.n_operands);
- /* If necessary, report the effect that the instruction has on
- the unwind info. We've already done this for delay slots
- and call instructions. */
- if (final_sequence == 0
-#if !defined (HAVE_prologue)
- && !ACCUMULATE_OUTGOING_ARGS
-#endif
- && dwarf2out_do_frame ())
- dwarf2out_frame_debug (insn, true);
-
if (!targetm.asm_out.unwind_emit_before_insn
&& targetm.asm_out.unwind_emit)
targetm.asm_out.unwind_emit (asm_out_file, insn);