Commit fc9f468b by Jakub Jelinek Committed by Jakub Jelinek

dwarf2out.c (last_var_location_insn): New variable.

	* dwarf2out.c (last_var_location_insn): New variable.
	(dwarf2out_end_epilogue): Clear last_var_location_insn.
	(dwarf2out_var_location): Don't record anything after last real
	insn.  Only change labels if there were any real instructions
	in between last note and this one, or if changed sections.

From-SVN: r148415
parent 15cb981a
2009-06-12 Jakub Jelinek <jakub@redhat.com>
* dwarf2out.c (last_var_location_insn): New variable.
(dwarf2out_end_epilogue): Clear last_var_location_insn.
(dwarf2out_var_location): Don't record anything after last real
insn. Only change labels if there were any real instructions
in between last note and this one, or if changed sections.
2009-06-11 Richard Henderson <rth@redhat.com> 2009-06-11 Richard Henderson <rth@redhat.com>
* alpha.c (alpha_expand_prologue): Add a REF_CFA_REGISTER * alpha.c (alpha_expand_prologue): Add a REF_CFA_REGISTER
......
...@@ -92,6 +92,8 @@ along with GCC; see the file COPYING3. If not see ...@@ -92,6 +92,8 @@ along with GCC; see the file COPYING3. If not see
#ifdef DWARF2_DEBUGGING_INFO #ifdef DWARF2_DEBUGGING_INFO
static void dwarf2out_source_line (unsigned int, const char *, int); static void dwarf2out_source_line (unsigned int, const char *, int);
static rtx last_var_location_insn;
#endif #endif
#ifndef DWARF2_FRAME_INFO #ifndef DWARF2_FRAME_INFO
...@@ -3693,6 +3695,10 @@ dwarf2out_end_epilogue (unsigned int line ATTRIBUTE_UNUSED, ...@@ -3693,6 +3695,10 @@ dwarf2out_end_epilogue (unsigned int line ATTRIBUTE_UNUSED,
dw_fde_ref fde; dw_fde_ref fde;
char label[MAX_ARTIFICIAL_LABEL_BYTES]; char label[MAX_ARTIFICIAL_LABEL_BYTES];
#ifdef DWARF2_DEBUGGING_INFO
last_var_location_insn = NULL_RTX;
#endif
if (dwarf2out_do_cfi_asm ()) if (dwarf2out_do_cfi_asm ())
fprintf (asm_out_file, "\t.cfi_endproc\n"); fprintf (asm_out_file, "\t.cfi_endproc\n");
...@@ -16202,6 +16208,7 @@ dwarf2out_set_name (tree decl, tree name) ...@@ -16202,6 +16208,7 @@ dwarf2out_set_name (tree decl, tree name)
else else
add_name_attribute (die, dwarf2_name (name, 0)); add_name_attribute (die, dwarf2_name (name, 0));
} }
/* Called by the final INSN scan whenever we see a var location. We /* Called by the final INSN scan whenever we see a var location. We
use it to drop labels in the right places, and throw the location in use it to drop labels in the right places, and throw the location in
our lookup table. */ our lookup table. */
...@@ -16211,26 +16218,27 @@ dwarf2out_var_location (rtx loc_note) ...@@ -16211,26 +16218,27 @@ dwarf2out_var_location (rtx loc_note)
{ {
char loclabel[MAX_ARTIFICIAL_LABEL_BYTES]; char loclabel[MAX_ARTIFICIAL_LABEL_BYTES];
struct var_loc_node *newloc; struct var_loc_node *newloc;
rtx prev_insn; rtx next_real;
static rtx last_insn;
static const char *last_label; static const char *last_label;
static bool last_in_cold_section_p;
tree decl; tree decl;
if (!DECL_P (NOTE_VAR_LOCATION_DECL (loc_note))) if (!DECL_P (NOTE_VAR_LOCATION_DECL (loc_note)))
return; return;
prev_insn = PREV_INSN (loc_note);
next_real = next_real_insn (loc_note);
/* If there are no instructions which would be affected by this note,
don't do anything. */
if (next_real == NULL_RTX)
return;
newloc = GGC_CNEW (struct var_loc_node); newloc = GGC_CNEW (struct var_loc_node);
/* If the insn we processed last time is the previous insn /* If there were no real insns between note we processed last time
and it is also a var location note, use the label we emitted and this note, use the label we emitted last time. */
last time. */ if (last_var_location_insn != NULL_RTX
if (last_insn != NULL_RTX && last_var_location_insn == next_real
&& last_insn == prev_insn && last_in_cold_section_p == in_cold_section_p)
&& NOTE_P (prev_insn) newloc->label = last_label;
&& NOTE_KIND (prev_insn) == NOTE_INSN_VAR_LOCATION)
{
newloc->label = last_label;
}
else else
{ {
ASM_GENERATE_INTERNAL_LABEL (loclabel, "LVL", loclabel_num); ASM_GENERATE_INTERNAL_LABEL (loclabel, "LVL", loclabel_num);
...@@ -16246,8 +16254,9 @@ dwarf2out_var_location (rtx loc_note) ...@@ -16246,8 +16254,9 @@ dwarf2out_var_location (rtx loc_note)
else else
newloc->section_label = text_section_label; newloc->section_label = text_section_label;
last_insn = loc_note; last_var_location_insn = next_real;
last_label = newloc->label; last_label = newloc->label;
last_in_cold_section_p = in_cold_section_p;
decl = NOTE_VAR_LOCATION_DECL (loc_note); decl = NOTE_VAR_LOCATION_DECL (loc_note);
add_var_loc_to_decl (decl, newloc); add_var_loc_to_decl (decl, newloc);
} }
......
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