Hi,
This patch adds three simple interfaces for tree affine which will be used in
cost computation later.
Is it OK?
Thanks,
bin
2017-04-11 Bin Cheng <bin.ch...@arm.com>
* tree-affine.h (aff_combination_type): New interface.
(aff_combination_const_p, aff_combination_simple_p): New interfaces.
From 1646cba4cc5576919d6bbaf8bcc99b5ca9b4210a Mon Sep 17 00:00:00 2001
From: Bin Cheng <binch...@e108451-lin.cambridge.arm.com>
Date: Wed, 1 Mar 2017 11:55:17 +0000
Subject: [PATCH 11/33] add-tree-affine-interfaces-20170221.txt
---
gcc/tree-affine.h | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/gcc/tree-affine.h b/gcc/tree-affine.h
index b8eb8cc..557e363 100644
--- a/gcc/tree-affine.h
+++ b/gcc/tree-affine.h
@@ -88,6 +88,12 @@ bool aff_comb_cannot_overlap_p (aff_tree *, const widest_int
&,
/* Debugging functions. */
void debug_aff (aff_tree *);
+static inline tree
+aff_combination_type (aff_tree *aff)
+{
+ return aff->type;
+}
+
/* Return true if AFF is actually ZERO. */
static inline bool
aff_combination_zero_p (aff_tree *aff)
@@ -101,4 +107,35 @@ aff_combination_zero_p (aff_tree *aff)
return false;
}
+/* Return true if AFF is actually const. */
+static inline bool
+aff_combination_const_p (aff_tree *aff)
+{
+ if (!aff)
+ return true;
+
+ if (aff->n == 0)
+ return true;
+
+ return false;
+}
+
+/* Return true if AFF is simple enough. */
+static inline bool
+aff_combination_simple_p (aff_tree *aff)
+{
+ if (!aff || aff->n == 0)
+ return true;
+
+ if (aff->n > 1)
+ return false;
+
+ if (aff->offset != 0)
+ return false;
+
+ if (aff->elts[0].coef != 1 && aff->elts[0].coef != -1)
+ return false;
+
+ return true;
+}
#endif /* GCC_TREE_AFFINE_H */
--
1.9.1