Commit 5a309965 by Jakub Jelinek Committed by Jakub Jelinek

re PR debug/43160 (Wrong debug info in guality/vla-1.c (f1))

	PR debug/43160
	* var-tracking.c (dv_onepart_p): Return true for DEBUG_EXPR_DECLs.
	(add_value_chain, add_value_chains, remove_value_chain,
	remove_value_chains): Handle DEBUG_EXPRs.
	(check_changed_vars_1, check_changed_vars_2): Handle DEBUG_EXPR_DECLs.

From-SVN: r157084
parent e7140c8d
2010-02-26 Jakub Jelinek <jakub@redhat.com> 2010-02-26 Jakub Jelinek <jakub@redhat.com>
PR debug/43160
* var-tracking.c (dv_onepart_p): Return true for DEBUG_EXPR_DECLs.
(add_value_chain, add_value_chains, remove_value_chain,
remove_value_chains): Handle DEBUG_EXPRs.
(check_changed_vars_1, check_changed_vars_2): Handle DEBUG_EXPR_DECLs.
PR debug/43161 PR debug/43161
* regcprop.c (struct queued_debug_insn_change): New type. * regcprop.c (struct queued_debug_insn_change): New type.
(struct value_data_entry): Add debug_insn_changes field. (struct value_data_entry): Add debug_insn_changes field.
......
...@@ -784,6 +784,9 @@ dv_onepart_p (decl_or_value dv) ...@@ -784,6 +784,9 @@ dv_onepart_p (decl_or_value dv)
if (!decl) if (!decl)
return true; return true;
if (TREE_CODE (decl) == DEBUG_EXPR_DECL)
return true;
return (target_for_debug_bind (decl) != NULL_TREE); return (target_for_debug_bind (decl) != NULL_TREE);
} }
...@@ -2563,39 +2566,48 @@ loc_cmp (rtx x, rtx y) ...@@ -2563,39 +2566,48 @@ loc_cmp (rtx x, rtx y)
static int static int
add_value_chain (rtx *loc, void *dvp) add_value_chain (rtx *loc, void *dvp)
{ {
if (GET_CODE (*loc) == VALUE && (void *) *loc != dvp) decl_or_value dv, ldv;
value_chain vc, nvc;
void **slot;
if (GET_CODE (*loc) == VALUE)
ldv = dv_from_value (*loc);
else if (GET_CODE (*loc) == DEBUG_EXPR)
ldv = dv_from_decl (DEBUG_EXPR_TREE_DECL (*loc));
else
return 0;
if (dv_as_opaque (ldv) == dvp)
return 0;
dv = (decl_or_value) dvp;
slot = htab_find_slot_with_hash (value_chains, ldv, dv_htab_hash (ldv),
INSERT);
if (!*slot)
{ {
decl_or_value dv = (decl_or_value) dvp; vc = (value_chain) pool_alloc (value_chain_pool);
decl_or_value ldv = dv_from_value (*loc); vc->dv = ldv;
value_chain vc, nvc; vc->next = NULL;
void **slot = htab_find_slot_with_hash (value_chains, ldv, vc->refcount = 0;
dv_htab_hash (ldv), INSERT); *slot = (void *) vc;
if (!*slot) }
{ else
vc = (value_chain) pool_alloc (value_chain_pool); {
vc->dv = ldv; for (vc = ((value_chain) *slot)->next; vc; vc = vc->next)
vc->next = NULL; if (dv_as_opaque (vc->dv) == dv_as_opaque (dv))
vc->refcount = 0; break;
*slot = (void *) vc; if (vc)
}
else
{ {
for (vc = ((value_chain) *slot)->next; vc; vc = vc->next) vc->refcount++;
if (dv_as_opaque (vc->dv) == dv_as_opaque (dv)) return 0;
break;
if (vc)
{
vc->refcount++;
return 0;
}
} }
vc = (value_chain) *slot;
nvc = (value_chain) pool_alloc (value_chain_pool);
nvc->dv = dv;
nvc->next = vc->next;
nvc->refcount = 1;
vc->next = nvc;
} }
vc = (value_chain) *slot;
nvc = (value_chain) pool_alloc (value_chain_pool);
nvc->dv = dv;
nvc->next = vc->next;
nvc->refcount = 1;
vc->next = nvc;
return 0; return 0;
} }
...@@ -2605,7 +2617,7 @@ add_value_chain (rtx *loc, void *dvp) ...@@ -2605,7 +2617,7 @@ add_value_chain (rtx *loc, void *dvp)
static void static void
add_value_chains (decl_or_value dv, rtx loc) add_value_chains (decl_or_value dv, rtx loc)
{ {
if (GET_CODE (loc) == VALUE) if (GET_CODE (loc) == VALUE || GET_CODE (loc) == DEBUG_EXPR)
{ {
add_value_chain (&loc, dv_as_opaque (dv)); add_value_chain (&loc, dv_as_opaque (dv));
return; return;
...@@ -2635,33 +2647,41 @@ add_cselib_value_chains (decl_or_value dv) ...@@ -2635,33 +2647,41 @@ add_cselib_value_chains (decl_or_value dv)
static int static int
remove_value_chain (rtx *loc, void *dvp) remove_value_chain (rtx *loc, void *dvp)
{ {
if (GET_CODE (*loc) == VALUE && (void *) *loc != dvp) decl_or_value dv, ldv;
{ value_chain vc;
decl_or_value dv = (decl_or_value) dvp; void **slot;
decl_or_value ldv = dv_from_value (*loc);
value_chain vc, dvc = NULL; if (GET_CODE (*loc) == VALUE)
void **slot = htab_find_slot_with_hash (value_chains, ldv, ldv = dv_from_value (*loc);
dv_htab_hash (ldv), NO_INSERT); else if (GET_CODE (*loc) == DEBUG_EXPR)
for (vc = (value_chain) *slot; vc->next; vc = vc->next) ldv = dv_from_decl (DEBUG_EXPR_TREE_DECL (*loc));
if (dv_as_opaque (vc->next->dv) == dv_as_opaque (dv)) else
return 0;
if (dv_as_opaque (ldv) == dvp)
return 0;
dv = (decl_or_value) dvp;
slot = htab_find_slot_with_hash (value_chains, ldv, dv_htab_hash (ldv),
NO_INSERT);
for (vc = (value_chain) *slot; vc->next; vc = vc->next)
if (dv_as_opaque (vc->next->dv) == dv_as_opaque (dv))
{
value_chain dvc = vc->next;
gcc_assert (dvc->refcount > 0);
if (--dvc->refcount == 0)
{ {
dvc = vc->next; vc->next = dvc->next;
gcc_assert (dvc->refcount > 0); pool_free (value_chain_pool, dvc);
if (--dvc->refcount == 0) if (vc->next == NULL && vc == (value_chain) *slot)
{ {
vc->next = dvc->next; pool_free (value_chain_pool, vc);
pool_free (value_chain_pool, dvc); htab_clear_slot (value_chains, slot);
if (vc->next == NULL && vc == (value_chain) *slot)
{
pool_free (value_chain_pool, vc);
htab_clear_slot (value_chains, slot);
}
} }
return 0;
} }
gcc_unreachable (); return 0;
} }
return 0; gcc_unreachable ();
} }
/* If decl or value DVP refers to VALUEs from within LOC, remove backlinks /* If decl or value DVP refers to VALUEs from within LOC, remove backlinks
...@@ -2670,7 +2690,7 @@ remove_value_chain (rtx *loc, void *dvp) ...@@ -2670,7 +2690,7 @@ remove_value_chain (rtx *loc, void *dvp)
static void static void
remove_value_chains (decl_or_value dv, rtx loc) remove_value_chains (decl_or_value dv, rtx loc)
{ {
if (GET_CODE (loc) == VALUE) if (GET_CODE (loc) == VALUE || GET_CODE (loc) == DEBUG_EXPR)
{ {
remove_value_chain (&loc, dv_as_opaque (dv)); remove_value_chain (&loc, dv_as_opaque (dv));
return; return;
...@@ -6677,7 +6697,8 @@ check_changed_vars_1 (void **slot, void *data) ...@@ -6677,7 +6697,8 @@ check_changed_vars_1 (void **slot, void *data)
variable var = (variable) *slot; variable var = (variable) *slot;
htab_t htab = (htab_t) data; htab_t htab = (htab_t) data;
if (dv_is_value_p (var->dv)) if (dv_is_value_p (var->dv)
|| TREE_CODE (dv_as_decl (var->dv)) == DEBUG_EXPR_DECL)
{ {
value_chain vc value_chain vc
= (value_chain) htab_find_with_hash (value_chains, var->dv, = (value_chain) htab_find_with_hash (value_chains, var->dv,
...@@ -6707,7 +6728,8 @@ static void ...@@ -6707,7 +6728,8 @@ static void
check_changed_vars_2 (variable var, htab_t htab) check_changed_vars_2 (variable var, htab_t htab)
{ {
variable_was_changed (var, NULL); variable_was_changed (var, NULL);
if (dv_is_value_p (var->dv)) if (dv_is_value_p (var->dv)
|| TREE_CODE (dv_as_decl (var->dv)) == DEBUG_EXPR_DECL)
{ {
value_chain vc value_chain vc
= (value_chain) htab_find_with_hash (value_chains, var->dv, = (value_chain) htab_find_with_hash (value_chains, var->dv,
......
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