aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorAndrew MacLeod <amacleod@redhat.com>2015-07-21 19:15:13 +0000
committerAndrew Macleod <amacleod@gcc.gnu.org>2015-07-21 19:15:13 +0000
commitf9ffade09c3cc13eb1a199a24517b9b1909c6e80 (patch)
tree15769f2b54469137ff69aba07b201d29a7b12110 /gcc
parent324000329be228765b56c2b11d24256a8a30000e (diff)
downloadgcc-f9ffade09c3cc13eb1a199a24517b9b1909c6e80.zip
gcc-f9ffade09c3cc13eb1a199a24517b9b1909c6e80.tar.gz
gcc-f9ffade09c3cc13eb1a199a24517b9b1909c6e80.tar.bz2
ssa-iterators.h (has_zero_uses, [...]): Implement as straight loops.
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. From-SVN: r226051
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/ssa-iterators.h62
-rw-r--r--gcc/tree-ssa-operands.c19
3 files changed, 37 insertions, 53 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5e6915a..240cbef 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+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.
+
2015-07-21 Mike Frysinger <vapier@gentoo.org>
Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
diff --git a/gcc/ssa-iterators.h b/gcc/ssa-iterators.h
index 4f0057f..a9bf699 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;
diff --git a/gcc/tree-ssa-operands.c b/gcc/tree-ssa-operands.c
index a132679..b1e3f99 100644
--- a/gcc/tree-ssa-operands.c
+++ b/gcc/tree-ssa-operands.c
@@ -1304,22 +1304,6 @@ unlink_stmt_vdef (gimple stmt)
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. */
@@ -1330,7 +1314,7 @@ single_imm_use_1 (const ssa_use_operand_t *head,
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)
{
@@ -1348,3 +1332,4 @@ single_imm_use_1 (const ssa_use_operand_t *head,
return single_use;
}
+