aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBin Cheng <bin.cheng@arm.com>2017-05-11 09:25:30 +0000
committerBin Cheng <amker@gcc.gnu.org>2017-05-11 09:25:30 +0000
commitb7b5203d98d56d5015a13727dd807412bd1559a2 (patch)
tree96f95cca74e8bee61c794b7412cb64037c9af7d1
parent7581ce9a1ad6df9c8998a3c74256837a1ff6f7cc (diff)
downloadgcc-b7b5203d98d56d5015a13727dd807412bd1559a2.zip
gcc-b7b5203d98d56d5015a13727dd807412bd1559a2.tar.gz
gcc-b7b5203d98d56d5015a13727dd807412bd1559a2.tar.bz2
tree-affine.h (aff_combination_type): New interface.
* 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
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/tree-affine.h25
2 files changed, 31 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index be20be0..3bfd958 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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):
diff --git a/gcc/tree-affine.h b/gcc/tree-affine.h
index b8eb8cc..c775ad8 100644
--- a/gcc/tree-affine.h
+++ b/gcc/tree-affine.h
@@ -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 */