From b7b5203d98d56d5015a13727dd807412bd1559a2 Mon Sep 17 00:00:00 2001 From: Bin Cheng Date: Thu, 11 May 2017 09:25:30 +0000 Subject: [PATCH] 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 --- gcc/ChangeLog | 7 +++++++ gcc/tree-affine.h | 25 ++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index be20be0c9ab..3bfd958ab95 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2017-05-11 Bin Cheng + + * 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 * tree-ssa-pre.c (eliminate_dom_walker::before_dom_children): diff --git a/gcc/tree-affine.h b/gcc/tree-affine.h index b8eb8ccd0cb..c775ad874d2 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 */ -- 2.30.2