summaryrefslogtreecommitdiff
path: root/gcc/ssa-iterators.h
diff options
context:
space:
mode:
authoramacleod <amacleod@138bc75d-0d04-0410-961f-82ee72b054a4>2015-07-21 19:15:13 +0000
committeramacleod <amacleod@138bc75d-0d04-0410-961f-82ee72b054a4>2015-07-21 19:15:13 +0000
commit44a5770181e3b4b4b5b13fd5b7292a69202c6dd2 (patch)
tree15769f2b54469137ff69aba07b201d29a7b12110 /gcc/ssa-iterators.h
parenta26dad6a5955ed8574efc8d149faca3963a48d46 (diff)
downloadgcc-44a5770181e3b4b4b5b13fd5b7292a69202c6dd2.tar.gz
2015-07-21 Andrew MacLeod <amacleod@redhat.com>
* ssa-iterators.h (has_zero_uses, has_single_use): Implement as straight loops. (single_imm_use): Check for iterator node. (num_imm_uses): Likewise. * tree-ssa-operands.c (has_zero_uses_1): Delete. (single_imm_use_1): Check for iterator node. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226051 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ssa-iterators.h')
-rw-r--r--gcc/ssa-iterators.h62
1 files changed, 26 insertions, 36 deletions
diff --git a/gcc/ssa-iterators.h b/gcc/ssa-iterators.h
index 4f0057f1408..a9bf6990fa3 100644
--- a/gcc/ssa-iterators.h
+++ b/gcc/ssa-iterators.h
@@ -114,7 +114,6 @@ struct imm_use_iterator
-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);
@@ -379,42 +378,36 @@ next_readonly_imm_use (imm_use_iterator *imm)
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
@@ -434,7 +427,7 @@ single_imm_use (const_tree var, use_operand_p *use_p, gimple *stmt)
/* 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;
@@ -444,10 +437,6 @@ single_imm_use (const_tree var, use_operand_p *use_p, gimple *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);
}
@@ -461,10 +450,11 @@ num_imm_uses (const_tree var)
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;