-extern bool has_zero_uses_1 (const ssa_use_operand_t *head);
extern bool single_imm_use_1 (const ssa_use_operand_t *head,
use_operand_p *use_p, gimple *stmt);
static inline bool
has_zero_uses (const_tree var)
{
- const ssa_use_operand_t *const ptr = &(SSA_NAME_IMM_USE_NODE (var));
-
- /* A single use_operand means there is no items in the list. */
- if (ptr == ptr->next)
- return true;
+ const ssa_use_operand_t *const head = &(SSA_NAME_IMM_USE_NODE (var));
+ const ssa_use_operand_t *ptr;
- /* If there are debug stmts, we have to look at each use and see
- whether there are any nondebug uses. */
- if (!MAY_HAVE_DEBUG_STMTS)
- return false;
+ for (ptr = head->next; ptr != head; ptr = ptr->next)
+ if (USE_STMT (ptr) && !is_gimple_debug (USE_STMT (ptr)))
+ return false;
- return has_zero_uses_1 (ptr);
+ return true;
}
/* Return true if VAR has a single nondebug use. */
static inline bool
has_single_use (const_tree var)
{
- const ssa_use_operand_t *const ptr = &(SSA_NAME_IMM_USE_NODE (var));
-
- /* If there aren't any uses whatsoever, we're done. */
- if (ptr == ptr->next)
- return false;
-
- /* If there's a single use, check that it's not a debug stmt. */
- if (ptr == ptr->next->next)
- return !is_gimple_debug (USE_STMT (ptr->next));
-
- /* If there are debug stmts, we have to look at each of them. */
- if (!MAY_HAVE_DEBUG_STMTS)
- return false;
-
- return single_imm_use_1 (ptr, NULL, NULL);
-}
-
-
+ const ssa_use_operand_t *const head = &(SSA_NAME_IMM_USE_NODE (var));
+ const ssa_use_operand_t *ptr;
+ bool single = false;
+
+ for (ptr = head->next; ptr != head; ptr = ptr->next)
+ if (USE_STMT(ptr) && !is_gimple_debug (USE_STMT (ptr)))
+ {
+ if (single)
+ return false;
+ else
+ single = true;
+ }
+
+ return single;
+}
+
/* If VAR has only a single immediate nondebug use, return true, and
set USE_P and STMT to the use pointer and stmt of occurrence. */
static inline bool
/* If there's a single use, check that it's not a debug stmt. */
if (ptr == ptr->next->next)
{
- if (!is_gimple_debug (USE_STMT (ptr->next)))
+ if (USE_STMT (ptr->next) && !is_gimple_debug (USE_STMT (ptr->next)))
{
*use_p = ptr->next;
*stmt = ptr->next->loc.stmt;
goto return_false;
}
- /* If there are debug stmts, we have to look at each of them. */
- if (!MAY_HAVE_DEBUG_STMTS)
- goto return_false;
-
return single_imm_use_1 (ptr, use_p, stmt);
}
if (!MAY_HAVE_DEBUG_STMTS)
for (ptr = start->next; ptr != start; ptr = ptr->next)
- num++;
+ if (USE_STMT (ptr))
+ num++;
else
for (ptr = start->next; ptr != start; ptr = ptr->next)
- if (!is_gimple_debug (USE_STMT (ptr)))
+ if (USE_STMT (ptr) && !is_gimple_debug (USE_STMT (ptr)))
num++;
return num;
SSA_NAME_OCCURS_IN_ABNORMAL_PHI (vuse) = 1;
}
-
-/* Return true if the var whose chain of uses starts at PTR has no
- nondebug uses. */
-bool
-has_zero_uses_1 (const ssa_use_operand_t *head)
-{
- const ssa_use_operand_t *ptr;
-
- for (ptr = head->next; ptr != head; ptr = ptr->next)
- if (!is_gimple_debug (USE_STMT (ptr)))
- return false;
-
- return true;
-}
-
-
/* Return true if the var whose chain of uses starts at PTR has a
single nondebug use. Set USE_P and STMT to that single nondebug
use, if so, or to NULL otherwise. */
ssa_use_operand_t *ptr, *single_use = 0;
for (ptr = head->next; ptr != head; ptr = ptr->next)
- if (!is_gimple_debug (USE_STMT (ptr)))
+ if (USE_STMT(ptr) && !is_gimple_debug (USE_STMT (ptr)))
{
if (single_use)
{
return single_use;
}
+