aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2009-06-12 09:01:25 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2009-06-12 09:01:25 +0200
commitfc9f468b5fbc938fb39fd1917918b37fc3448496 (patch)
tree26471718ca071deba2fbcb634efbc189ca5fc700
parent15cb981aa34233d3842213b60d6081b807a4bc98 (diff)
downloadgcc-fc9f468b5fbc938fb39fd1917918b37fc3448496.zip
gcc-fc9f468b5fbc938fb39fd1917918b37fc3448496.tar.gz
gcc-fc9f468b5fbc938fb39fd1917918b37fc3448496.tar.bz2
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
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/dwarf2out.c37
2 files changed, 31 insertions, 14 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index db12670..1f8312f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+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>
* alpha.c (alpha_expand_prologue): Add a REF_CFA_REGISTER
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index c41f008..367bda8 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);
}