Mercurial > hg > CbC > CbC_gcc
diff gcc/tree-affine.h @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | 77e2b8dfacca |
children | 84e7813d76e9 |
line wrap: on
line diff
--- a/gcc/tree-affine.h Sun Aug 21 07:07:55 2011 +0900 +++ b/gcc/tree-affine.h Fri Oct 27 22:46:09 2017 +0900 @@ -1,5 +1,5 @@ /* Operations with affine combinations of trees. - Copyright (C) 2005, 2007, 2008 Free Software Foundation, Inc. + Copyright (C) 2005-2017 Free Software Foundation, Inc. This file is part of GCC. @@ -20,6 +20,10 @@ /* Affine combination of trees. We keep track of at most MAX_AFF_ELTS elements to make things simpler; this is sufficient in most cases. */ +#ifndef GCC_TREE_AFFINE_H +#define GCC_TREE_AFFINE_H + + #define MAX_AFF_ELTS 8 /* Element of an affine combination. */ @@ -30,16 +34,16 @@ tree val; /* Its coefficient in the combination. */ - double_int coef; + widest_int coef; }; -typedef struct affine_tree_combination +struct aff_tree { /* Type of the result of the combination. */ tree type; /* Constant offset. */ - double_int offset; + widest_int offset; /* Number of elements of the combination. */ unsigned n; @@ -56,27 +60,68 @@ than MAX_AFF_ELTS elements. Type of REST will be either sizetype for TYPE of POINTER_TYPEs or TYPE. */ tree rest; -} aff_tree; +}; + +struct name_expansion; -double_int double_int_ext_for_comb (double_int, aff_tree *); -void aff_combination_const (aff_tree *, tree, double_int); +widest_int wide_int_ext_for_comb (const widest_int &, aff_tree *); +void aff_combination_const (aff_tree *, tree, const widest_int &); void aff_combination_elt (aff_tree *, tree, tree); -void aff_combination_scale (aff_tree *, double_int); +void aff_combination_scale (aff_tree *, const widest_int &); void aff_combination_mult (aff_tree *, aff_tree *, aff_tree *); void aff_combination_add (aff_tree *, aff_tree *); -void aff_combination_add_elt (aff_tree *, tree, double_int); +void aff_combination_add_elt (aff_tree *, tree, const widest_int &); void aff_combination_remove_elt (aff_tree *, unsigned); void aff_combination_convert (aff_tree *, tree); void tree_to_aff_combination (tree, tree, aff_tree *); tree aff_combination_to_tree (aff_tree *); void unshare_aff_combination (aff_tree *); -bool aff_combination_constant_multiple_p (aff_tree *, aff_tree *, double_int *); -void aff_combination_expand (aff_tree *, struct pointer_map_t **); +bool aff_combination_constant_multiple_p (aff_tree *, aff_tree *, widest_int *); +void aff_combination_expand (aff_tree *, hash_map<tree, name_expansion *> **); void tree_to_aff_combination_expand (tree, tree, aff_tree *, - struct pointer_map_t **); -void get_inner_reference_aff (tree, aff_tree *, double_int *); -void free_affine_expand_cache (struct pointer_map_t **); + hash_map<tree, name_expansion *> **); +tree get_inner_reference_aff (tree, aff_tree *, widest_int *); +void free_affine_expand_cache (hash_map<tree, name_expansion *> **); +bool aff_comb_cannot_overlap_p (aff_tree *, const widest_int &, + const widest_int &); /* Debugging functions. */ -void print_aff (FILE *, aff_tree *); 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. */ +inline bool +aff_combination_zero_p (aff_tree *aff) +{ + if (!aff) + return true; + + if (aff->n == 0 && aff->offset == 0) + return true; + + 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 */