tree-affine.h (aff_combination_type): New interface.
authorBin Cheng <bin.cheng@arm.com>
Thu, 11 May 2017 09:25:30 +0000 (09:25 +0000)
committerBin Cheng <amker@gcc.gnu.org>
Thu, 11 May 2017 09:25:30 +0000 (09:25 +0000)
* tree-affine.h (aff_combination_type): New interface.
(aff_combination_zero_p): Remove static.
(aff_combination_const_p): New interface.
(aff_combination_singleton_var_p): New interfaces.

From-SVN: r247883

gcc/ChangeLog
gcc/tree-affine.h

index be20be0c9ab11004789e38f8562003b256bec8f8..3bfd958ab958892cb3a26c0127eeb564c5d23a62 100644 (file)
@@ -1,3 +1,10 @@
+2017-05-11  Bin Cheng  <bin.cheng@arm.com>
+
+       * tree-affine.h (aff_combination_type): New interface.
+       (aff_combination_zero_p): Remove static.
+       (aff_combination_const_p): New interface.
+       (aff_combination_singleton_var_p): New interfaces.
+
 2017-05-11  Richard Biener  <rguenther@suse.de>
 
        * tree-ssa-pre.c (eliminate_dom_walker::before_dom_children):
index b8eb8ccd0cb90a5281c82d16ddbd547f3cfe8b2f..c775ad874d22598d728b5cdd87b18040fc9ea1c4 100644 (file)
@@ -88,8 +88,15 @@ bool aff_comb_cannot_overlap_p (aff_tree *, const widest_int &,
 /* Debugging functions.  */
 void debug_aff (aff_tree *);
 
+/* Return AFF's type.  */
+inline tree
+aff_combination_type (aff_tree *aff)
+{
+  return aff->type;
+}
+
 /* Return true if AFF is actually ZERO.  */
-static inline bool
+inline bool
 aff_combination_zero_p (aff_tree *aff)
 {
   if (!aff)
@@ -101,4 +108,20 @@ aff_combination_zero_p (aff_tree *aff)
   return false;
 }
 
+/* Return true if AFF is actually const.  */
+inline bool
+aff_combination_const_p (aff_tree *aff)
+{
+  return (aff == NULL || aff->n == 0);
+}
+
+/* Return true iff AFF contains one (negated) singleton variable.  Users need
+   to make sure AFF points to a valid combination.  */
+inline bool
+aff_combination_singleton_var_p (aff_tree *aff)
+{
+  return (aff->n == 1
+         && aff->offset == 0
+         && (aff->elts[0].coef == 1 || aff->elts[0].coef == -1));
+}
 #endif /* GCC_TREE_AFFINE_H */