+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
rtx prev_insn;
static rtx last_insn;
static const char *last_label;
+ tree decl;
if (!DECL_P (NOTE_VAR_LOCATION_DECL (loc_note)))
return;
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
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);
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)
} *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)
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)
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)