diff gcc/tree-chrec.h @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents f6334be47118
children 84e7813d76e9
line wrap: on
line diff
--- a/gcc/tree-chrec.h	Sun Aug 21 07:07:55 2011 +0900
+++ b/gcc/tree-chrec.h	Fri Oct 27 22:46:09 2017 +0900
@@ -1,6 +1,5 @@
 /* Chains of recurrences.
-   Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
-   Free Software Foundation, Inc.
+   Copyright (C) 2003-2017 Free Software Foundation, Inc.
    Contributed by Sebastian Pop <pop@cri.ensmp.fr>
 
 This file is part of GCC.
@@ -53,18 +52,20 @@
 }
 
 
+enum ev_direction {EV_DIR_GROWS, EV_DIR_DECREASES, EV_DIR_UNKNOWN};
+enum ev_direction scev_direction (const_tree);
 
 /* Chrec folding functions.  */
 extern tree chrec_fold_plus (tree, tree, tree);
 extern tree chrec_fold_minus (tree, tree, tree);
 extern tree chrec_fold_multiply (tree, tree, tree);
-extern tree chrec_convert (tree, tree, gimple);
-extern tree chrec_convert_rhs (tree, tree, gimple);
-extern tree chrec_convert_aggressive (tree, tree);
+extern tree chrec_convert (tree, tree, gimple *, bool = true, tree = NULL);
+extern tree chrec_convert_rhs (tree, tree, gimple *);
+extern tree chrec_convert_aggressive (tree, tree, bool *);
 
 /* Operations.  */
 extern tree chrec_apply (unsigned, tree, tree);
-extern tree chrec_apply_map (tree, VEC (tree, heap) *);
+extern tree chrec_apply_map (tree, vec<tree> );
 extern tree chrec_replace_initial_condition (tree, tree);
 extern tree initial_condition (tree);
 extern tree initial_condition_in_loop_num (tree, unsigned);
@@ -73,11 +74,12 @@
 extern tree reset_evolution_in_loop (unsigned, tree, tree);
 extern tree chrec_merge (tree, tree);
 extern void for_each_scev_op (tree *, bool (*) (tree *, void *), void *);
+extern bool convert_affine_scev (struct loop *, tree, tree *, tree *, gimple *,
+				 bool, tree = NULL);
 
 /* Observers.  */
 extern bool eq_evolutions_p (const_tree, const_tree);
 extern bool is_multivariate_chrec (const_tree);
-extern bool chrec_is_positive (tree, bool *);
 extern bool chrec_contains_symbols (const_tree);
 extern bool chrec_contains_symbols_defined_in_loop (const_tree, unsigned);
 extern bool chrec_contains_undetermined (const_tree);
@@ -118,7 +120,7 @@
 
   STRIP_NOPS (chrec);
   scev = hide_evolution_in_other_loops_than_loop (chrec, loop_num);
-  *res = !tree_is_chrec (scev);
+  *res = !tree_contains_chrecs (scev, NULL);
   return true;
 }
 
@@ -139,21 +141,25 @@
       || !val)
     return chrec_dont_know;
 
-  /* Pointer types should occur only on the left hand side, i.e. in
-     the base of the chrec, and not in the step.  */
-  gcc_assert (!POINTER_TYPE_P (TREE_TYPE (right)));
-
-  /* Types of left and right sides of a chrec should be compatible.  */
+  /* Types of left and right sides of a chrec should be compatible, but
+     pointer CHRECs are special in that the evolution is of ptroff type.  */
   if (POINTER_TYPE_P (TREE_TYPE (left)))
-    gcc_assert (sizetype == TREE_TYPE (right));
+    gcc_checking_assert (ptrofftype_p (TREE_TYPE (right)));
   else
-    gcc_assert (TREE_TYPE (left) == TREE_TYPE (right));
+    {
+      /* Pointer types should occur only on the left hand side, i.e. in
+	 the base of the chrec, and not in the step.  */
+      gcc_checking_assert (!POINTER_TYPE_P (TREE_TYPE (right))
+			   && types_compatible_p (TREE_TYPE (left),
+						  TREE_TYPE (right)));
+    }
 
   if (chrec_zerop (right))
     return left;
 
-  return build3 (POLYNOMIAL_CHREC, TREE_TYPE (left),
-		 build_int_cst (NULL_TREE, loop_num), left, right);
+  tree chrec = build2 (POLYNOMIAL_CHREC, TREE_TYPE (left), left, right);
+  CHREC_VARIABLE (chrec) = loop_num;
+  return chrec;
 }
 
 /* Determines whether the expression CHREC is a constant.  */
@@ -164,15 +170,9 @@
   if (chrec == NULL_TREE)
     return false;
 
-  switch (TREE_CODE (chrec))
-    {
-    case INTEGER_CST:
-    case REAL_CST:
-      return true;
-
-    default:
-      return false;
-    }
+  if (CONSTANT_CLASS_P (chrec))
+    return true;
+  return is_gimple_min_invariant (chrec);
 }
 
 /* Determine whether CHREC is an affine evolution function in LOOPNUM.  */
@@ -205,7 +205,9 @@
   return chrec
     && TREE_CODE (chrec) == POLYNOMIAL_CHREC
     && evolution_function_is_invariant_p (CHREC_RIGHT (chrec),
-					  CHREC_VARIABLE (chrec));
+					  CHREC_VARIABLE (chrec))
+    && (TREE_CODE (CHREC_RIGHT (chrec)) != POLYNOMIAL_CHREC
+	|| evolution_function_is_affine_p (CHREC_RIGHT (chrec)));
 }
 
 /* Determines whether EXPR does not contains chrec expressions.  */