OSDN Git Service

Compute min and max bounds for IVs and infer types.
authorspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 6 Apr 2010 21:01:16 +0000 (21:01 +0000)
committerMasaki Muranaka <monaka@monami-software.com>
Sun, 23 May 2010 05:17:03 +0000 (14:17 +0900)
2010-04-04  Sebastian Pop  <sebastian.pop@amd.com>

PR middle-end/43519
* Makefile.in (graphite-clast-to-gimple.o): Depends on langhooks.h.
* graphite-clast-to-gimple.c: Include langhooks.h.
(max_signed_precision_type): New.
(max_precision_type): Takes two types as arguments.
(precision_for_value): New.
(precision_for_interval): New.
(gcc_type_for_interval): New.
(gcc_type_for_value): New.
(gcc_type_for_clast_term): New.
(gcc_type_for_clast_red): New.
(gcc_type_for_clast_bin): New.
(gcc_type_for_clast_expr): Split up into several functions.
(gcc_type_for_clast_eq): Rewritten.
(compute_bounds_for_level): New.
(compute_type_for_level_1): New.
(compute_type_for_level): New.
(gcc_type_for_cloog_iv): Removed.
(gcc_type_for_iv_of_clast_loop): Rewritten.
(graphite_create_new_loop): Compute the lower and upper bound types
with gcc_type_for_clast_expr.
(graphite_create_new_loop_guard): Same.
(find_cloog_iv_in_expr): Removed.
(compute_cloog_iv_types_1): Removed.
(compute_cloog_iv_types): Removed.
(gloog): Do not call compute_cloog_iv_types.
* graphite-sese-to-poly.c (new_gimple_bb): Do not initialize
GBB_CLOOG_IV_TYPES.
(free_data_refs_aux): Do not free GBB_CLOOG_IV_TYPES.
* sese.h (struct gimple_bb): Removed field cloog_iv_types.
(GBB_CLOOG_IV_TYPES): Removed.

* gcc.dg/graphite/run-id-pr42644.c: Call abort.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158026 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog.graphite
gcc/graphite-clast-to-gimple.c

index 09c9f9d..a24f499 100644 (file)
@@ -1,3 +1,39 @@
+2010-04-04  Sebastian Pop  <sebastian.pop@amd.com>
+
+       PR middle-end/43519
+       * Makefile.in (graphite-clast-to-gimple.o): Depends on langhooks.h.
+       * graphite-clast-to-gimple.c: Include langhooks.h.
+       (max_signed_precision_type): New.
+       (max_precision_type): Takes two types as arguments.
+       (precision_for_value): New.
+       (precision_for_interval): New.
+       (gcc_type_for_interval): New.
+       (gcc_type_for_value): New.
+       (gcc_type_for_clast_term): New.
+       (gcc_type_for_clast_red): New.
+       (gcc_type_for_clast_bin): New.
+       (gcc_type_for_clast_expr): Split up into several functions.
+       (gcc_type_for_clast_eq): Rewritten.
+       (compute_bounds_for_level): New.
+       (compute_type_for_level_1): New.
+       (compute_type_for_level): New.
+       (gcc_type_for_cloog_iv): Removed.
+       (gcc_type_for_iv_of_clast_loop): Rewritten.
+       (graphite_create_new_loop): Compute the lower and upper bound types
+       with gcc_type_for_clast_expr.
+       (graphite_create_new_loop_guard): Same.
+       (find_cloog_iv_in_expr): Removed.
+       (compute_cloog_iv_types_1): Removed.
+       (compute_cloog_iv_types): Removed.
+       (gloog): Do not call compute_cloog_iv_types.
+       * graphite-sese-to-poly.c (new_gimple_bb): Do not initialize
+       GBB_CLOOG_IV_TYPES.
+       (free_data_refs_aux): Do not free GBB_CLOOG_IV_TYPES.
+       * sese.h (struct gimple_bb): Removed field cloog_iv_types.
+       (GBB_CLOOG_IV_TYPES): Removed.
+
+       * gcc.dg/graphite/run-id-pr42644.c: Call abort.
+
 2010-04-02  Sebastian Pop  <sebastian.pop@amd.com>
 
        Reverted this commit: as at this point the loop closed SSA form
index 09c703b..709661d 100644 (file)
@@ -231,15 +231,8 @@ max_signed_precision_type (tree type1, tree type2)
 {
   int p1 = TYPE_PRECISION (type1);
   int p2 = TYPE_PRECISION (type2);
-  int precision;
-  tree type;
-
-  if (p1 > p2)
-    precision = TYPE_UNSIGNED (type1) ? p1 * 2 : p1;
-  else
-    precision = TYPE_UNSIGNED (type2) ? p2 * 2 : p2;
-
-  type = lang_hooks.types.type_for_size (precision, false);
+  int precision = p1 > p2 ? p1 : p2;
+  tree type = lang_hooks.types.type_for_size (precision, false);
 
   if (!type)
     {
@@ -254,6 +247,7 @@ max_signed_precision_type (tree type1, tree type2)
 static tree
 max_precision_type (tree type1, tree type2)
 {
+
   if (POINTER_TYPE_P (type1))
     return type1;
 
@@ -421,9 +415,9 @@ clast_to_gcc_expression (tree type, struct clast_expr *e,
 /* Return the precision needed to represent the value VAL.  */
 
 static int
-precision_for_value (mpz_t val)
+precision_for_value (Value val)
 {
-  mpz_t x, y, two;
+  Value x, y, two;
   int precision;
 
   value_init (x);
@@ -454,9 +448,9 @@ precision_for_value (mpz_t val)
    UP.  */
 
 static int
-precision_for_interval (mpz_t low, mpz_t up)
+precision_for_interval (Value low, Value up)
 {
-  mpz_t diff;
+  Value diff;
   int precision;
 
   gcc_assert (value_le (low, up));
@@ -473,7 +467,7 @@ precision_for_interval (mpz_t low, mpz_t up)
    otherwise return NULL_TREE.  */
 
 static tree
-gcc_type_for_interval (mpz_t low, mpz_t up, tree old_type)
+gcc_type_for_interval (Value low, Value up, tree old_type)
 {
   bool unsigned_p = true;
   int precision, prec_up, prec_int;
@@ -504,7 +498,7 @@ gcc_type_for_interval (mpz_t low, mpz_t up, tree old_type)
    otherwise return NULL_TREE.  */
 
 static tree
-gcc_type_for_value (mpz_t val)
+gcc_type_for_value (Value val)
 {
   return gcc_type_for_interval (val, val, NULL_TREE);
 }
@@ -694,7 +688,7 @@ graphite_create_new_guard (sese region, edge entry_edge,
    the iteration domain, and G the context parameters.  */
 
 static void
-compute_bounds_for_level (poly_bb_p pbb, int level, mpz_t low, mpz_t up)
+compute_bounds_for_level (poly_bb_p pbb, int level, Value low, Value up)
 {
   ppl_Pointset_Powerset_C_Polyhedron_t ps;
   ppl_Linear_Expression_t le;
@@ -718,18 +712,11 @@ compute_bounds_for_level (poly_bb_p pbb, int level, mpz_t low, mpz_t up)
 /* Compute the type for the induction variable at LEVEL for the
    statement PBB, based on the transformed schedule of PBB.  OLD_TYPE
    is the type of the old induction variable for that loop.  */
-/* Java does not initialize long_long_integer_type_node.  */
-#define my_long_long (long_long_integer_type_node ? long_long_integer_type_node : ssizetype)
-
-/* Given a CLOOG_IV, return the type that CLOOG_IV should have in GCC
-   land.  The selected type is big enough to include the original loop
-   iteration variable, but signed to work with the subtractions CLooG
-   may have introduced.  If such a type is not available, we fail.
 
 static tree
 compute_type_for_level_1 (poly_bb_p pbb, int level, tree old_type)
 {
-  mpz_t low, up;
+  Value low, up;
   tree type;
 
   value_init (low);
@@ -782,19 +769,17 @@ clast_get_body_of_loop (struct clast_stmt *stmt)
   if (CLAST_STMT_IS_A (stmt, stmt_for))
     return clast_get_body_of_loop (((struct clast_for *) stmt)->body);
 
-      if (type_precision < TYPE_PRECISION (my_long_long))
-       return my_long_long;
+  if (CLAST_STMT_IS_A (stmt, stmt_guard))
+    return clast_get_body_of_loop (((struct clast_guard *) stmt)->then);
 
   if (CLAST_STMT_IS_A (stmt, stmt_block))
     return clast_get_body_of_loop (((struct clast_block *) stmt)->body);
 
-  return my_long_long;
+  gcc_unreachable ();
 }
 
-#undef my_long_long
-
-/* Returns the induction variable for the loop that gets translated to
-   STMT.  */
+/* Returns the type for the induction variable for the loop translated
+   from STMT_FOR.  */
 
 static tree
 gcc_type_for_iv_of_clast_loop (struct clast_for *stmt_for, int level,
@@ -805,9 +790,9 @@ gcc_type_for_iv_of_clast_loop (struct clast_for *stmt_for, int level,
   CloogStatement *cs = body->statement;
   poly_bb_p pbb = (poly_bb_p) cloog_statement_usr (cs);
 
-  return max_signed_precision_type (lb_type, max_precision_type
-                                   (ub_type, compute_type_for_level
-                                    (pbb, level - 1)));
+  return max_precision_type (lb_type, max_precision_type
+                            (ub_type, compute_type_for_level (pbb,
+                                                              level - 1)));
 }
 
 /* Creates a new LOOP corresponding to Cloog's STMT.  Inserts an