OSDN Git Service

2009-09-14 Sebastian Pop <sebastian.pop@amd.com>
[pf3gnuchains/gcc-fork.git] / gcc / tree-data-ref.c
index dc79e8a..ae0a068 100644 (file)
@@ -157,6 +157,14 @@ dump_data_references (FILE *file, VEC (data_reference_p, heap) *datarefs)
     dump_data_reference (file, dr);
 }
 
+/* Dump into STDERR all the data references from DATAREFS.  */ 
+
+void 
+debug_data_references (VEC (data_reference_p, heap) *datarefs)
+{
+  dump_data_references (stderr, datarefs);
+}
+
 /* Dump to STDERR all the dependence relations from DDRS.  */ 
 
 void 
@@ -178,6 +186,14 @@ dump_data_dependence_relations (FILE *file,
     dump_data_dependence_relation (file, ddr);
 }
 
+/* Print to STDERR the data_reference DR.  */
+
+void 
+debug_data_reference (struct data_reference *dr)
+{
+  dump_data_reference (stderr, dr);
+}
+
 /* Dump function for a DATA_REFERENCE structure.  */
 
 void 
@@ -718,17 +734,26 @@ dr_analyze_innermost (struct data_reference *dr)
       base_iv.no_overflow = true;
     }
 
-  if (!poffset || !in_loop)
+  if (!poffset)
     {
       offset_iv.base = ssize_int (0);
       offset_iv.step = ssize_int (0);
     }
-  else if (!simple_iv (loop, loop_containing_stmt (stmt),
-                      poffset, &offset_iv, false))
+  else
     {
-      if (dump_file && (dump_flags & TDF_DETAILS))
-       fprintf (dump_file, "failed: evolution of offset is not affine.\n");
-      return false;
+      if (!in_loop)
+        {
+          offset_iv.base = poffset;
+          offset_iv.step = ssize_int (0);
+        }
+      else if (!simple_iv (loop, loop_containing_stmt (stmt),
+                           poffset, &offset_iv, false))
+        {
+          if (dump_file && (dump_flags & TDF_DETAILS))
+            fprintf (dump_file, "failed: evolution of offset is not"
+                                " affine.\n");
+          return false;
+        }
     }
 
   init = ssize_int (pbitpos / BITS_PER_UNIT);
@@ -3325,22 +3350,6 @@ access_functions_are_affine_or_constant_p (const struct data_reference *a,
   return true;
 }
 
-/* Return true if we can create an affine data-ref for OP in STMT.  */
-
-bool
-stmt_simple_memref_p (struct loop *loop, gimple stmt, tree op)
-{
-  data_reference_p dr;
-  bool res = true;
-
-  dr = create_data_ref (loop, op, stmt, true);
-  if (!access_functions_are_affine_or_constant_p (dr, loop))
-    res = false;
-
-  free_data_ref (dr);
-  return res;
-}
-
 /* Initializes an equation for an OMEGA problem using the information
    contained in the ACCESS_FUN.  Returns true when the operation
    succeeded.
@@ -4149,6 +4158,37 @@ find_data_references_in_stmt (struct loop *nest, gimple stmt,
   return ret;
 }
 
+/* Stores the data references in STMT to DATAREFS.  If there is an unanalyzable
+   reference, returns false, otherwise returns true.  NEST is the outermost
+   loop of the loop nest in which the references should be analyzed.  */
+
+bool
+graphite_find_data_references_in_stmt (struct loop *nest, gimple stmt,
+                                      VEC (data_reference_p, heap) **datarefs)
+{
+  unsigned i;
+  VEC (data_ref_loc, heap) *references;
+  data_ref_loc *ref;
+  bool ret = true;
+  data_reference_p dr;
+
+  if (get_references_in_stmt (stmt, &references))
+    {
+      VEC_free (data_ref_loc, heap, references);
+      return false;
+    }
+
+  for (i = 0; VEC_iterate (data_ref_loc, references, i, ref); i++)
+    {
+      dr = create_data_ref (nest, *ref->pos, stmt, ref->is_read);
+      gcc_assert (dr != NULL);
+      VEC_safe_push (data_reference_p, heap, *datarefs, dr);
+    }
+
+  VEC_free (data_ref_loc, heap, references);
+  return ret;
+}
+
 /* Search the data references in LOOP, and record the information into
    DATAREFS.  Returns chrec_dont_know when failing to analyze a
    difficult case, returns NULL_TREE otherwise.  */