aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Oliva <aoliva@redhat.com>2009-08-21 18:32:06 +0000
committerAlexandre Oliva <aoliva@redhat.com>2009-08-21 18:32:06 +0000
commitd7dd65f5a2f1eed12993521597b50579b3502548 (patch)
tree6b1c49298c82286e467918ef173d74dcc77f1f8f
parent65c0203db1f12dcb1989e5f8032e885c0c7d9ecd (diff)
* var-tracking.c (unshare_variable, set_slot_part,
clobber_slot_part, delete_slot_part): Return the current slot. Adjust all callers to use it. (vt_emit_notes): Check value_chains if MAY_HAVE_DEBUG_INSNS. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/var-tracking-assignments-4_4-branch@150997 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog.vta7
-rw-r--r--gcc/var-tracking.c133
2 files changed, 89 insertions, 51 deletions
diff --git a/gcc/ChangeLog.vta b/gcc/ChangeLog.vta
index 9564f56842f..2b645a10acc 100644
--- a/gcc/ChangeLog.vta
+++ b/gcc/ChangeLog.vta
@@ -1,3 +1,10 @@
+2009-08-21 Alexandre Oliva <aoliva@redhat.com>
+
+ * var-tracking.c (unshare_variable, set_slot_part,
+ clobber_slot_part, delete_slot_part): Return the current slot.
+ Adjust all callers to use it.
+ (vt_emit_notes): Check value_chains if MAY_HAVE_DEBUG_INSNS.
+
2009-08-20 Alexandre Oliva <aoliva@redhat.com>
* cfgexpand.c (gimple_assign_rhs_to_tree): Do not overwrite
diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c
index ddc890e399d..09904a10c91 100644
--- a/gcc/var-tracking.c
+++ b/gcc/var-tracking.c
@@ -401,8 +401,8 @@ static void attrs_list_insert (attrs *, decl_or_value, HOST_WIDE_INT, rtx);
static void attrs_list_copy (attrs *, attrs);
static void attrs_list_union (attrs *, attrs);
-static variable unshare_variable (dataflow_set *set, void **slot, variable var,
- enum var_init_status);
+static void **unshare_variable (dataflow_set *set, void **slot, variable var,
+ enum var_init_status);
static int vars_copy_1 (void **, void *);
static void vars_copy (htab_t, htab_t);
static tree var_debug_decl (tree);
@@ -453,17 +453,17 @@ static void dump_dataflow_set (dataflow_set *);
static void dump_dataflow_sets (void);
static void variable_was_changed (variable, dataflow_set *);
-static void set_slot_part (dataflow_set *, rtx, void **,
- decl_or_value, HOST_WIDE_INT,
- enum var_init_status, rtx);
+static void **set_slot_part (dataflow_set *, rtx, void **,
+ decl_or_value, HOST_WIDE_INT,
+ enum var_init_status, rtx);
static void set_variable_part (dataflow_set *, rtx,
decl_or_value, HOST_WIDE_INT,
enum var_init_status, rtx, enum insert_option);
-static void clobber_slot_part (dataflow_set *, rtx,
- void **, HOST_WIDE_INT, rtx);
+static void **clobber_slot_part (dataflow_set *, rtx,
+ void **, HOST_WIDE_INT, rtx);
static void clobber_variable_part (dataflow_set *, rtx,
decl_or_value, HOST_WIDE_INT, rtx);
-static void delete_slot_part (dataflow_set *, rtx, void **, HOST_WIDE_INT);
+static void **delete_slot_part (dataflow_set *, rtx, void **, HOST_WIDE_INT);
static void delete_variable_part (dataflow_set *, rtx,
decl_or_value, HOST_WIDE_INT);
static int emit_note_insn_var_location (void **, void *);
@@ -1188,7 +1188,7 @@ static bool dst_can_be_shared;
/* Return a copy of a variable VAR and insert it to dataflow set SET. */
-static variable
+static void **
unshare_variable (dataflow_set *set, void **slot, variable var,
enum var_init_status initialized)
{
@@ -1245,7 +1245,7 @@ unshare_variable (dataflow_set *set, void **slot, variable var,
else if (set->traversed_vars && set->vars != set->traversed_vars)
slot = shared_hash_find_slot_noinsert (set->vars, var->dv);
*slot = new_var;
- return new_var;
+ return slot;
}
/* Add a variable from *SLOT to hash table DATA and increase its reference
@@ -1802,7 +1802,7 @@ variable_union (void **slot, void *data)
}
}
if (k < src->n_var_parts)
- unshare_variable (set, dstp, src, VAR_INIT_STATUS_UNKNOWN);
+ dstp = unshare_variable (set, dstp, src, VAR_INIT_STATUS_UNKNOWN);
/* Continue traversing the hash table. */
return 1;
@@ -1839,8 +1839,9 @@ variable_union (void **slot, void *data)
if (dst->refcount != 1 || shared_hash_shared (set->vars))
{
- dst = unshare_variable (set, dstp, dst,
- VAR_INIT_STATUS_INITIALIZED);
+ dstp = unshare_variable (set, dstp, dst,
+ VAR_INIT_STATUS_INITIALIZED);
+ dst = (variable)*dstp;
goto restart_onepart_unshared;
}
@@ -1894,7 +1895,10 @@ variable_union (void **slot, void *data)
if ((dst->refcount > 1 || shared_hash_shared (set->vars))
&& dst->n_var_parts != k)
- dst = unshare_variable (set, dstp, dst, VAR_INIT_STATUS_UNKNOWN);
+ {
+ dstp = unshare_variable (set, dstp, dst, VAR_INIT_STATUS_UNKNOWN);
+ dst = (variable)*dstp;
+ }
i = src->n_var_parts - 1;
j = dst->n_var_parts - 1;
@@ -1934,8 +1938,11 @@ variable_union (void **slot, void *data)
}
}
if (node || node2)
- dst = unshare_variable (set, dstp, dst,
- VAR_INIT_STATUS_UNKNOWN);
+ {
+ dstp = unshare_variable (set, dstp, dst,
+ VAR_INIT_STATUS_UNKNOWN);
+ dst = (variable)*dstp;
+ }
}
src_l = 0;
@@ -2183,7 +2190,7 @@ variable_canonicalize (void **slot, void *data)
}
}
if (k < src->n_var_parts)
- unshare_variable (set, slot, src, VAR_INIT_STATUS_UNKNOWN);
+ slot = unshare_variable (set, slot, src, VAR_INIT_STATUS_UNKNOWN);
return 1;
}
@@ -2752,7 +2759,8 @@ canonicalize_values_mark (void **slot, void *data)
/* ??? Remove this in case the assertion above never fails. */
if (!onode)
#endif
- set_slot_part (set, val, oslot, odv, 0, node->init, NULL_RTX);
+ oslot = set_slot_part (set, val, oslot, odv, 0,
+ node->init, NULL_RTX);
VALUE_RECURSED_INTO (node->loc) = true;
}
@@ -2859,8 +2867,8 @@ canonicalize_values_star (void **slot, void *data)
for (node = var->var_part[0].loc_chain; node; node = node->next)
if (node->loc != cval)
{
- set_slot_part (set, node->loc, cslot, cdv, 0,
- node->init, NULL_RTX);
+ cslot = set_slot_part (set, node->loc, cslot, cdv, 0,
+ node->init, NULL_RTX);
if (GET_CODE (node->loc) == VALUE)
{
decl_or_value ndv = dv_from_value (node->loc);
@@ -2977,11 +2985,11 @@ canonicalize_values_star (void **slot, void *data)
/* ??? Remove this in case the assertion above never fails. */
if (!node)
#endif
- set_slot_part (set, val, cslot, cdv, 0,
- VAR_INIT_STATUS_INITIALIZED, NULL_RTX);
+ cslot = set_slot_part (set, val, cslot, cdv, 0,
+ VAR_INIT_STATUS_INITIALIZED, NULL_RTX);
}
- clobber_slot_part (set, cval, slot, 0, NULL);
+ slot = clobber_slot_part (set, cval, slot, 0, NULL);
/* Variable may have been unshared. */
var = (variable)*slot;
@@ -3116,9 +3124,10 @@ variable_merge_over_cur (void **s1slot, void *data)
this register, we want to leave it alone. */
else if (dv_as_value (list->dv) != val)
{
- set_slot_part (dst, dv_as_value (list->dv), dstslot, dv, 0,
- node->init, NULL_RTX);
- delete_slot_part (dst, node->loc, dstslot, 0);
+ dstslot = set_slot_part (dst, dv_as_value (list->dv),
+ dstslot, dv, 0,
+ node->init, NULL_RTX);
+ dstslot = delete_slot_part (dst, node->loc, dstslot, 0);
/* Since nextp points into the removed node, we can't
use it. The pointer to the next node moved to nodep.
@@ -3478,8 +3487,9 @@ variable_post_merge_new_vals (void **slot, void *info)
if (var->refcount != 1)
{
- var = unshare_variable (set, slot, var,
- VAR_INIT_STATUS_INITIALIZED);
+ slot = unshare_variable (set, slot, var,
+ VAR_INIT_STATUS_INITIALIZED);
+ var = (variable)*slot;
goto restart;
}
@@ -3587,8 +3597,9 @@ variable_post_merge_new_vals (void **slot, void *info)
if (var->refcount != 1)
{
- var = unshare_variable (set, slot, var,
- VAR_INIT_STATUS_INITIALIZED);
+ slot = unshare_variable (set, slot, var,
+ VAR_INIT_STATUS_INITIALIZED);
+ var = (variable)*slot;
goto restart;
}
@@ -3611,8 +3622,9 @@ variable_post_merge_new_vals (void **slot, void *info)
oslot = shared_hash_find_slot_noinsert (set->vars, cdv);
if (oslot)
- set_slot_part (set, node->loc, oslot, cdv, 0,
- VAR_INIT_STATUS_INITIALIZED, NULL_RTX);
+ oslot = set_slot_part (set, node->loc, oslot, cdv, 0,
+ VAR_INIT_STATUS_INITIALIZED,
+ NULL_RTX);
else
{
if (!*dfpm->permp)
@@ -3806,7 +3818,8 @@ dataflow_set_preserve_mem_locs (void **slot, void *data)
if (!loc)
return 1;
- var = unshare_variable (set, slot, var, VAR_INIT_STATUS_UNKNOWN);
+ slot = unshare_variable (set, slot, var, VAR_INIT_STATUS_UNKNOWN);
+ var = (variable)*slot;
gcc_assert (var->n_var_parts == 1);
}
@@ -3890,7 +3903,8 @@ dataflow_set_remove_mem_locs (void **slot, void *data)
if (!loc)
return 1;
- var = unshare_variable (set, slot, var, VAR_INIT_STATUS_UNKNOWN);
+ slot = unshare_variable (set, slot, var, VAR_INIT_STATUS_UNKNOWN);
+ var = (variable)*slot;
gcc_assert (var->n_var_parts == 1);
}
@@ -5843,7 +5857,7 @@ find_variable_location_part (variable var, HOST_WIDE_INT offset,
return -1;
}
-static void
+static void **
set_slot_part (dataflow_set *set, rtx loc, void **slot,
decl_or_value dv, HOST_WIDE_INT offset,
enum var_init_status initialized, rtx set_src)
@@ -5964,11 +5978,12 @@ set_slot_part (dataflow_set *set, rtx loc, void **slot,
c++;
if (r == 0)
- return;
+ return slot;
if (var->refcount > 1 || shared_hash_shared (set->vars))
{
- var = unshare_variable (set, slot, var, initialized);
+ slot = unshare_variable (set, slot, var, initialized);
+ var = (variable)*slot;
for (nextp = &var->var_part[0].loc_chain; c;
nextp = &(*nextp)->next)
c--;
@@ -5999,13 +6014,16 @@ set_slot_part (dataflow_set *set, rtx loc, void **slot,
if (set_src != NULL)
node->set_src = set_src;
- return;
+ return slot;
}
else
{
/* We have to make a copy of a shared variable. */
if (var->refcount > 1 || shared_hash_shared (set->vars))
- var = unshare_variable (set, slot, var, initialized);
+ {
+ slot = unshare_variable (set, slot, var, initialized);
+ var = (variable)*slot;
+ }
}
}
else
@@ -6014,7 +6032,10 @@ set_slot_part (dataflow_set *set, rtx loc, void **slot,
/* We have to make a copy of the shared variable. */
if (var->refcount > 1 || shared_hash_shared (set->vars))
- var = unshare_variable (set, slot, var, initialized);
+ {
+ slot = unshare_variable (set, slot, var, initialized);
+ var = (variable)*slot;
+ }
/* We track only variables whose size is <= MAX_VAR_PARTS bytes
thus there are at most MAX_VAR_PARTS different offsets. */
@@ -6075,6 +6096,8 @@ set_slot_part (dataflow_set *set, rtx loc, void **slot,
var->var_part[pos].cur_loc = loc;
variable_was_changed (var, set);
}
+
+ return slot;
}
/* Set the part of variable's location in the dataflow set SET. The
@@ -6099,7 +6122,7 @@ set_variable_part (dataflow_set *set, rtx loc,
if (!slot)
slot = shared_hash_find_slot_unshare (&set->vars, dv, iopt);
}
- set_slot_part (set, loc, slot, dv, offset, initialized, set_src);
+ slot = set_slot_part (set, loc, slot, dv, offset, initialized, set_src);
}
/* Remove all recorded register locations for the given variable part
@@ -6107,7 +6130,7 @@ set_variable_part (dataflow_set *set, rtx loc,
The variable part is specified by variable's declaration or value
DV and offset OFFSET. */
-static void
+static void **
clobber_slot_part (dataflow_set *set, rtx loc, void **slot,
HOST_WIDE_INT offset, rtx set_src)
{
@@ -6153,10 +6176,12 @@ clobber_slot_part (dataflow_set *set, rtx loc, void **slot,
}
}
- delete_slot_part (set, node->loc, slot, offset);
+ slot = delete_slot_part (set, node->loc, slot, offset);
}
}
}
+
+ return slot;
}
/* Remove all recorded register locations for the given variable part
@@ -6178,15 +6203,16 @@ clobber_variable_part (dataflow_set *set, rtx loc, decl_or_value dv,
if (!slot)
return;
- clobber_slot_part (set, loc, slot, offset, set_src);
+ slot = clobber_slot_part (set, loc, slot, offset, set_src);
}
/* Delete the part of variable's location from dataflow set SET. The
variable part is specified by its SET->vars slot SLOT and offset
OFFSET and the part's location by LOC. */
-static void
-delete_slot_part (dataflow_set *set, rtx loc, void **slot, HOST_WIDE_INT offset)
+static void **
+delete_slot_part (dataflow_set *set, rtx loc, void **slot,
+ HOST_WIDE_INT offset)
{
variable var = (variable) *slot;
int pos = find_variable_location_part (var, offset, NULL);
@@ -6208,8 +6234,9 @@ delete_slot_part (dataflow_set *set, rtx loc, void **slot, HOST_WIDE_INT offset)
&& REGNO (node->loc) == REGNO (loc))
|| rtx_equal_p (node->loc, loc))
{
- var = unshare_variable (set, slot, var,
- VAR_INIT_STATUS_UNKNOWN);
+ slot = unshare_variable (set, slot, var,
+ VAR_INIT_STATUS_UNKNOWN);
+ var = (variable)*slot;
break;
}
}
@@ -6265,6 +6292,8 @@ delete_slot_part (dataflow_set *set, rtx loc, void **slot, HOST_WIDE_INT offset)
if (changed)
variable_was_changed (var, set);
}
+
+ return slot;
}
/* Delete the part of variable's location from dataflow set SET. The
@@ -6279,7 +6308,7 @@ delete_variable_part (dataflow_set *set, rtx loc, decl_or_value dv,
if (!slot)
return;
- delete_slot_part (set, loc, slot, offset);
+ slot = delete_slot_part (set, loc, slot, offset);
}
/* Wrap result in CONST:MODE if needed to preserve the mode. */
@@ -7051,12 +7080,14 @@ vt_emit_notes (void)
htab_traverse (shared_hash_htab (cur.vars),
emit_notes_for_differences_1,
shared_hash_htab (empty_shared_hash));
- gcc_assert (htab_elements (value_chains) == 0);
#endif
dataflow_set_destroy (&cur);
if (MAY_HAVE_DEBUG_INSNS)
- VEC_free (variable, heap, changed_variables_stack);
+ {
+ gcc_assert (htab_elements (value_chains) == 0);
+ VEC_free (variable, heap, changed_variables_stack);
+ }
emit_notes = false;
}