tree-ssa-operands.c (correct_use_link): Remove linear scan.

2005-04-08  Andrew MacLeod  <amacleod@redhat.com>

	* tree-ssa-operands.c (correct_use_link): Remove linear scan.

From-SVN: r97827
This commit is contained in:
Andrew MacLeod 2005-04-08 13:09:26 +00:00 committed by Andrew Macleod
parent 627aa08ae9
commit 3623aa7017
2 changed files with 28 additions and 5 deletions

View File

@ -1,3 +1,7 @@
2005-04-08 Andrew MacLeod <amacleod@redhat.com>
* tree-ssa-operands.c (correct_use_link): Remove linear scan.
2005-04-08 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 2005-04-08 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* system.h: Revert last change. * system.h: Revert last change.

View File

@ -456,7 +456,8 @@ finalize_ssa_defs (def_optype *old_ops_p, tree stmt)
changed what this pointer points to via TREE_OPERANDS (exp, 0) = <...>. changed what this pointer points to via TREE_OPERANDS (exp, 0) = <...>.
THe contents are different, but the the pointer is still the same. This THe contents are different, but the the pointer is still the same. This
routine will check to make sure PTR is in the correct list, and if it isn't routine will check to make sure PTR is in the correct list, and if it isn't
put it in the correct list. */ put it in the correct list. We cannot simply check the previous node
because all nodes in the same stmt might have be changed. */
static inline void static inline void
correct_use_link (ssa_imm_use_t *ptr, tree stmt) correct_use_link (ssa_imm_use_t *ptr, tree stmt)
@ -471,10 +472,28 @@ correct_use_link (ssa_imm_use_t *ptr, tree stmt)
prev = ptr->prev; prev = ptr->prev;
if (prev) if (prev)
{ {
/* find the root, which has a non-NULL stmt, and a NULL use. */ bool stmt_mod = true;
while (prev->stmt == NULL || prev->use != NULL) /* Find the first element which isn't a SAFE iterator, is in a sifferent
prev = prev->prev; stmt, and is not a a modified stmt, That node is in the correct list,
root = prev->stmt; see if we are too. */
while (stmt_mod)
{
while (prev->stmt == stmt || prev->stmt == NULL)
prev = prev->prev;
if (prev->use == NULL)
stmt_mod = false;
else
if ((stmt_mod = stmt_modified_p (prev->stmt)))
prev = prev->prev;
}
/* Get the ssa_name of the list the node is in. */
if (prev->use == NULL)
root = prev->stmt;
else
root = *(prev->use);
/* If its the right list, simply return. */
if (root == *(ptr->use)) if (root == *(ptr->use))
return; return;
} }