summaryrefslogtreecommitdiff
path: root/gcc/dwarf2out.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2009-06-12 07:01:25 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2009-06-12 07:01:25 +0000
commite59b3312e1cf35a12d67cafa87f9635302f8cae9 (patch)
tree26471718ca071deba2fbcb634efbc189ca5fc700 /gcc/dwarf2out.c
parentd30e424603a8fad5e9e876af1c1a7a33d55837a2 (diff)
downloadgcc-e59b3312e1cf35a12d67cafa87f9635302f8cae9.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@148415 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/dwarf2out.c')
-rw-r--r--gcc/dwarf2out.c37
1 files changed, 23 insertions, 14 deletions
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index c41f008863b..367bda86a7e 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -92,6 +92,8 @@ along with GCC; see the file COPYING3. If not see
#ifdef DWARF2_DEBUGGING_INFO
static void dwarf2out_source_line (unsigned int, const char *, int);
+
+static rtx last_var_location_insn;
#endif
#ifndef DWARF2_FRAME_INFO
@@ -3693,6 +3695,10 @@ dwarf2out_end_epilogue (unsigned int line ATTRIBUTE_UNUSED,
dw_fde_ref fde;
char label[MAX_ARTIFICIAL_LABEL_BYTES];
+#ifdef DWARF2_DEBUGGING_INFO
+ last_var_location_insn = NULL_RTX;
+#endif
+
if (dwarf2out_do_cfi_asm ())
fprintf (asm_out_file, "\t.cfi_endproc\n");
@@ -16202,6 +16208,7 @@ dwarf2out_set_name (tree decl, tree name)
else
add_name_attribute (die, dwarf2_name (name, 0));
}
+
/* 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
our lookup table. */
@@ -16211,26 +16218,27 @@ dwarf2out_var_location (rtx loc_note)
{
char loclabel[MAX_ARTIFICIAL_LABEL_BYTES];
struct var_loc_node *newloc;
- rtx prev_insn;
- static rtx last_insn;
+ rtx next_real;
static const char *last_label;
+ static bool last_in_cold_section_p;
tree decl;
if (!DECL_P (NOTE_VAR_LOCATION_DECL (loc_note)))
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);
- /* If the insn we processed last time is the previous insn
- and it is also a var location note, use the label we emitted
- last time. */
- if (last_insn != NULL_RTX
- && last_insn == prev_insn
- && NOTE_P (prev_insn)
- && NOTE_KIND (prev_insn) == NOTE_INSN_VAR_LOCATION)
- {
- newloc->label = last_label;
- }
+ /* If there were no real insns between note we processed last time
+ and this note, use the label we emitted last time. */
+ if (last_var_location_insn != NULL_RTX
+ && last_var_location_insn == next_real
+ && last_in_cold_section_p == in_cold_section_p)
+ newloc->label = last_label;
else
{
ASM_GENERATE_INTERNAL_LABEL (loclabel, "LVL", loclabel_num);
@@ -16246,8 +16254,9 @@ dwarf2out_var_location (rtx loc_note)
else
newloc->section_label = text_section_label;
- last_insn = loc_note;
+ last_var_location_insn = next_real;
last_label = newloc->label;
+ last_in_cold_section_p = in_cold_section_p;
decl = NOTE_VAR_LOCATION_DECL (loc_note);
add_var_loc_to_decl (decl, newloc);
}