summaryrefslogtreecommitdiff
path: root/gcc/var-tracking.c
diff options
context:
space:
mode:
authorJosef Zlomek <zlomekj@suse.cz>2004-03-11 07:45:11 +0100
committerJosef Zlomek <zlomek@gcc.gnu.org>2004-03-11 06:45:11 +0000
commit11599d1450065fb36c91950f99559af819030a9c (patch)
treeca0943c02e17d185b833d5021e693c5b0056921b /gcc/var-tracking.c
parent71cc389ba10ab60c77f39fecc73be3179b6e679a (diff)
downloadgcc-11599d1450065fb36c91950f99559af819030a9c.tar.gz
var-tracking.c (vars_copy_1): Cleanup and speedup chain operations.
* var-tracking.c (vars_copy_1): Cleanup and speedup chain operations. (vars_copy): Likewise. (variable_union): Likewise. (set_variable_part): Likewise. (delete_variable_part): Likewise. From-SVN: r79304
Diffstat (limited to 'gcc/var-tracking.c')
-rw-r--r--gcc/var-tracking.c68
1 files changed, 28 insertions, 40 deletions
diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c
index 2d242627226..5b586bc55aa 100644
--- a/gcc/var-tracking.c
+++ b/gcc/var-tracking.c
@@ -752,10 +752,11 @@ vars_copy_1 (void **slot, void *data)
for (i = 0; i < var->n_var_parts; i++)
{
- location_chain last, node;
+ location_chain node;
+ location_chain *nextp;
var->var_part[i].offset = src->var_part[i].offset;
- last = NULL;
+ nextp = &var->var_part[i].loc_chain;
for (node = src->var_part[i].loc_chain; node; node = node->next)
{
location_chain new_lc;
@@ -764,11 +765,8 @@ vars_copy_1 (void **slot, void *data)
new_lc->next = NULL;
new_lc->loc = node->loc;
- if (last)
- last->next = new_lc;
- else
- var->var_part[i].loc_chain = new_lc;
- last = new_lc;
+ *nextp = new_lc;
+ nextp = &new_lc->next;
}
/* We are at the basic block boundary when copying variable description
@@ -798,33 +796,29 @@ vars_copy (htab_t dst, htab_t src)
static void
var_reg_delete_and_set (dataflow_set *set, rtx loc)
{
- attrs *reg = &set->regs[REGNO (loc)];
tree decl = REG_EXPR (loc);
HOST_WIDE_INT offset = REG_OFFSET (loc);
- attrs node, prev, next;
+ attrs node, next;
+ attrs *nextp;
- prev = NULL;
- for (node = *reg; node; node = next)
+ nextp = &set->regs[REGNO (loc)];
+ for (node = *nextp; node; node = next)
{
next = node->next;
if (node->decl != decl || node->offset != offset)
{
delete_variable_part (set, node->loc, node->decl, node->offset);
-
- if (prev)
- prev->next = next;
- else
- *reg = next;
pool_free (attrs_pool, node);
+ *nextp = next;
}
else
{
node->loc = loc;
- prev = node;
+ nextp = &node->next;
}
}
- if (*reg == NULL)
- attrs_list_insert (reg, decl, offset, loc);
+ if (set->regs[REGNO (loc)] == NULL)
+ attrs_list_insert (&set->regs[REGNO (loc)], decl, offset, loc);
set_variable_part (set, loc, decl, offset);
}
@@ -1112,9 +1106,10 @@ variable_union (void **slot, void *data)
&& src->var_part[i].offset > dst->var_part[j].offset)
|| j < 0)
{
- location_chain last = NULL;
+ location_chain *nextp;
/* Copy the chain from SRC. */
+ nextp = &dst->var_part[k].loc_chain;
for (node = src->var_part[i].loc_chain; node; node = node->next)
{
location_chain new_lc;
@@ -1123,11 +1118,8 @@ variable_union (void **slot, void *data)
new_lc->next = NULL;
new_lc->loc = node->loc;
- if (last)
- last->next = new_lc;
- else
- dst->var_part[k].loc_chain = new_lc;
- last = new_lc;
+ *nextp = new_lc;
+ nextp = &new_lc->next;
}
dst->var_part[k].offset = src->var_part[i].offset;
@@ -1863,7 +1855,8 @@ static void
set_variable_part (dataflow_set *set, rtx loc, tree decl, HOST_WIDE_INT offset)
{
int pos, low, high;
- location_chain node, prev, next;
+ location_chain node, next;
+ location_chain *nextp;
variable var;
void **slot;
@@ -1922,7 +1915,7 @@ set_variable_part (dataflow_set *set, rtx loc, tree decl, HOST_WIDE_INT offset)
}
/* Delete the location from list. */
- prev = NULL;
+ nextp = &var->var_part[pos].loc_chain;
for (node = var->var_part[pos].loc_chain; node; node = next)
{
next = node->next;
@@ -1930,15 +1923,12 @@ set_variable_part (dataflow_set *set, rtx loc, tree decl, HOST_WIDE_INT offset)
&& REGNO (node->loc) == REGNO (loc))
|| rtx_equal_p (node->loc, loc))
{
- if (prev)
- prev->next = next;
- else
- var->var_part[pos].loc_chain = next;
pool_free (loc_chain_pool, node);
+ *nextp = next;
break;
}
else
- prev = node;
+ nextp = &node->next;
}
/* Add the location to the beginning. */
@@ -1987,27 +1977,25 @@ delete_variable_part (dataflow_set *set, rtx loc, tree decl,
if (pos < var->n_var_parts && var->var_part[pos].offset == offset)
{
- location_chain node, prev, next;
+ location_chain node, next;
+ location_chain *nextp;
bool changed;
/* Delete the location part. */
- prev = NULL;
- for (node = var->var_part[pos].loc_chain; node; node = next)
+ nextp = &var->var_part[pos].loc_chain;
+ for (node = *nextp; node; node = next)
{
next = node->next;
if ((GET_CODE (node->loc) == REG && GET_CODE (loc) == REG
&& REGNO (node->loc) == REGNO (loc))
|| rtx_equal_p (node->loc, loc))
{
- if (prev)
- prev->next = next;
- else
- var->var_part[pos].loc_chain = next;
pool_free (loc_chain_pool, node);
+ *nextp = next;
break;
}
else
- prev = node;
+ nextp = &node->next;
}
/* If we have deleted the location which was last emitted