summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordberlin <dberlin@138bc75d-0d04-0410-961f-82ee72b054a4>2004-12-24 05:23:10 +0000
committerdberlin <dberlin@138bc75d-0d04-0410-961f-82ee72b054a4>2004-12-24 05:23:10 +0000
commitbbc7bce1c47bab845c0b7e35395958f7ec852660 (patch)
treea627db8a80c09e929338b90c21134a1193390049
parente92a2a2e96093e5721ddcba7c1ec3425c5b68d26 (diff)
downloadgcc-bbc7bce1c47bab845c0b7e35395958f7ec852660.tar.gz
2004-12-24 Daniel Berlin <dberlin@dberlin.org>
Fix PR debug/14638 * tree.h (DECL_DEBUG_ALIAS_OF): New macro. * var-tracking.c (track_expr_p): Don't disqualify tracking of variables that are aliases of variables we want to track, unless the original variable is also ignored for debugging purposes. (VARIABLE_HASH_VAL): Use DECL_UID, so that this is deterministic. * tree-outof-ssa.c (create_temp): Note who we are a debug alias of. * dwarf2out.c (dwarf2out_var_location): Add us to the location of the decl we are an alias of. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@92585 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog13
-rw-r--r--gcc/dwarf2out.c7
-rw-r--r--gcc/tree-outof-ssa.c5
-rw-r--r--gcc/tree.h4
-rw-r--r--gcc/var-tracking.c19
5 files changed, 41 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e499e8c7226..0bd56df3496 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,16 @@
+2004-12-24 Daniel Berlin <dberlin@dberlin.org>
+
+ Fix PR debug/14638
+
+ * tree.h (DECL_DEBUG_ALIAS_OF): New macro.
+ * var-tracking.c (track_expr_p): Don't disqualify tracking of variables
+ that are aliases of variables we want to track, unless the
+ original variable is also ignored for debugging purposes.
+ (VARIABLE_HASH_VAL): Use DECL_UID, so that this is deterministic.
+ * tree-outof-ssa.c (create_temp): Note who we are a debug alias of.
+ * dwarf2out.c (dwarf2out_var_location): Add us to the location of
+ the decl we are an alias of.
+
2004-12-24 Alan Modra <amodra@bigpond.net.au>
PR target/19142
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index beed56b4981..26174ec1c51 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -13037,6 +13037,7 @@ dwarf2out_var_location (rtx loc_note)
rtx prev_insn;
static rtx last_insn;
static const char *last_label;
+ tree decl;
if (!DECL_P (NOTE_VAR_LOCATION_DECL (loc_note)))
return;
@@ -13065,8 +13066,10 @@ dwarf2out_var_location (rtx loc_note)
last_insn = loc_note;
last_label = newloc->label;
-
- add_var_loc_to_decl (NOTE_VAR_LOCATION_DECL (loc_note), newloc);
+ decl = NOTE_VAR_LOCATION_DECL (loc_note);
+ if (DECL_DEBUG_ALIAS_OF (decl))
+ decl = DECL_DEBUG_ALIAS_OF (decl);
+ add_var_loc_to_decl (decl, newloc);
}
/* We need to reset the locations at the beginning of each
diff --git a/gcc/tree-outof-ssa.c b/gcc/tree-outof-ssa.c
index d61acbd0b1d..a5fc99309a5 100644
--- a/gcc/tree-outof-ssa.c
+++ b/gcc/tree-outof-ssa.c
@@ -156,6 +156,11 @@ create_temp (tree t)
if (name == NULL)
name = "temp";
tmp = create_tmp_var (type, name);
+
+ if (DECL_DEBUG_ALIAS_OF (t))
+ DECL_DEBUG_ALIAS_OF (tmp) = DECL_DEBUG_ALIAS_OF (t);
+ else if (!DECL_IGNORED_P (t))
+ DECL_DEBUG_ALIAS_OF (tmp) = t;
DECL_ARTIFICIAL (tmp) = DECL_ARTIFICIAL (t);
add_referenced_tmp_var (tmp);
diff --git a/gcc/tree.h b/gcc/tree.h
index 1411d71ad52..0858670609c 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -2014,6 +2014,10 @@ struct tree_binfo GTY (())
writing debugging information about vfield and vbase decls for C++. */
#define DECL_FCONTEXT(NODE) (FIELD_DECL_CHECK (NODE)->decl.vindex)
+/* For VAR_DECL, this is set to the variable we were split from, due to
+ optimization. */
+#define DECL_DEBUG_ALIAS_OF(NODE) (DECL_CHECK (NODE)->decl.vindex)
+
/* Every ..._DECL node gets a unique number. */
#define DECL_UID(NODE) (DECL_CHECK (NODE)->decl.uid)
diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c
index 72cb81d927e..ef9f9dcc5d6 100644
--- a/gcc/var-tracking.c
+++ b/gcc/var-tracking.c
@@ -244,7 +244,7 @@ typedef struct variable_def
} *variable;
/* Hash function for DECL for VARIABLE_HTAB. */
-#define VARIABLE_HASH_VAL(decl) ((size_t) (decl))
+#define VARIABLE_HASH_VAL(decl) (DECL_UID (decl))
/* Pointer to the BB's information specific to variable tracking pass. */
#define VTI(BB) ((variable_tracking_info) (BB)->aux)
@@ -1441,6 +1441,7 @@ static bool
track_expr_p (tree expr)
{
rtx decl_rtl;
+ tree realdecl;
/* If EXPR is not a parameter or a variable do not track it. */
if (TREE_CODE (expr) != VAR_DECL && TREE_CODE (expr) != PARM_DECL)
@@ -1454,14 +1455,22 @@ track_expr_p (tree expr)
decl_rtl = DECL_RTL_IF_SET (expr);
if (!decl_rtl)
return 0;
-
- /* Do not track EXPR if it should be ignored for debugging purposes. */
- if (DECL_IGNORED_P (expr))
+
+ /* If this expression is really a debug alias of some other declaration, we
+ don't need to track this expression if the ultimate declaration is
+ ignored. */
+ realdecl = expr;
+ if (DECL_DEBUG_ALIAS_OF (realdecl))
+ realdecl = DECL_DEBUG_ALIAS_OF (realdecl);
+
+ /* Do not track EXPR if REALDECL it should be ignored for debugging
+ purposes. */
+ if (DECL_IGNORED_P (realdecl))
return 0;
/* Do not track global variables until we are able to emit correct location
list for them. */
- if (TREE_STATIC (expr))
+ if (TREE_STATIC (realdecl))
return 0;
/* When the EXPR is a DECL for alias of some variable (see example)