OSDN Git Service

* cppfiles.c (open_file): Correct typo.
[pf3gnuchains/gcc-fork.git] / gcc / tree-data-ref.c
index ce0b3fe..6f3ba84 100644 (file)
@@ -495,25 +495,30 @@ split_constant_offset (tree exp, tree *var, tree *off)
   tree type = TREE_TYPE (exp), otype;
   tree var0, var1;
   tree off0, off1;
+  enum tree_code code;
 
   *var = exp;
   STRIP_NOPS (exp);
   otype = TREE_TYPE (exp);
+  code = TREE_CODE (exp);
 
-  switch (TREE_CODE (exp))
+  switch (code)
     {
     case INTEGER_CST:
       *var = build_int_cst (type, 0);
       *off = fold_convert (ssizetype, exp);
       return;
 
+    case POINTER_PLUS_EXPR:
+      code = PLUS_EXPR;
+      /* FALLTHROUGH */
     case PLUS_EXPR:
     case MINUS_EXPR:
       split_constant_offset (TREE_OPERAND (exp, 0), &var0, &off0);
       split_constant_offset (TREE_OPERAND (exp, 1), &var1, &off1);
       *var = fold_convert (type, fold_build2 (TREE_CODE (exp), otype, 
                                              var0, var1));
-      *off = size_binop (TREE_CODE (exp), off0, off1);
+      *off = size_binop (code, off0, off1);
       return;
 
     case MULT_EXPR:
@@ -660,7 +665,7 @@ dr_analyze_innermost (struct data_reference *dr)
 }
 
 /* Determines the base object and the list of indices of memory reference
-   DR, analysed in loop nest NEST.  */
+   DR, analyzed in loop nest NEST.  */
 
 static void
 dr_analyze_indices (struct data_reference *dr, struct loop *nest)
@@ -729,7 +734,7 @@ dr_analyze_alias (struct data_reference *dr)
     }
 
   DR_SYMBOL_TAG (dr) = smt;
-  if (var_can_have_subvars (smt))
+  if (smt && var_can_have_subvars (smt))
     DR_SUBVARS (dr) = get_subvars_for_var (smt);
 
   vops = BITMAP_ALLOC (NULL);
@@ -769,9 +774,9 @@ free_data_ref (data_reference_p dr)
 /* Analyzes memory reference MEMREF accessed in STMT.  The reference
    is read if IS_READ is true, write otherwise.  Returns the
    data_reference description of MEMREF.  NEST is the outermost loop of the
-   loop nest in that the reference should be analysed.  */
+   loop nest in that the reference should be analyzed.  */
 
-static struct data_reference *
+struct data_reference *
 create_data_ref (struct loop *nest, tree memref, tree stmt, bool is_read)
 {
   struct data_reference *dr;
@@ -1176,8 +1181,9 @@ dr_may_alias_p (struct data_reference *a, struct data_reference *b)
 
   if (TYPE_RESTRICT (type_a) && TYPE_RESTRICT (type_b) 
       && (!DR_IS_READ (a) || !DR_IS_READ (b))
-      && decl_a && TREE_CODE (decl_a) == PARM_DECL
-      && decl_b && TREE_CODE (decl_b) == PARM_DECL
+      && decl_a && DECL_P (decl_a)
+      && decl_b && DECL_P (decl_b)
+      && decl_a != decl_b
       && TREE_CODE (DECL_CONTEXT (decl_a)) == FUNCTION_DECL
       && DECL_CONTEXT (decl_a) == DECL_CONTEXT (decl_b))
     return false;
@@ -1224,8 +1230,8 @@ initialize_data_dependence_relation (struct data_reference *a,
     }
 
   /* If the base of the object is not invariant in the loop nest, we cannot
-     analyse it.  TODO -- in fact, it would suffice to record that there may
-     be arbitrary depencences in the loops where the base object varies.  */
+     analyze it.  TODO -- in fact, it would suffice to record that there may
+     be arbitrary dependences in the loops where the base object varies.  */
   if (!object_address_invariant_in_loop_p (VEC_index (loop_p, loop_nest, 0),
                                           DR_BASE_OBJECT (a)))
     {
@@ -3843,7 +3849,7 @@ compute_self_dependence (struct data_dependence_relation *ddr)
    COMPUTE_SELF_AND_RR is FALSE, don't compute read-read and self
    relations.  */
 
-static void 
+void 
 compute_all_dependences (VEC (data_reference_p, heap) *datarefs,
                         VEC (ddr_p, heap) **dependence_relations,
                         VEC (loop_p, heap) *loop_nest,
@@ -3941,7 +3947,7 @@ get_references_in_stmt (tree stmt, VEC (data_ref_loc, heap) **references)
 
 /* 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 that the references should be analysed.  */
+   loop of the loop nest in that the references should be analyzed.  */
 
 static bool
 find_data_references_in_stmt (struct loop *nest, tree stmt,
@@ -4055,7 +4061,7 @@ find_loop_nest_1 (struct loop *loop, VEC (loop_p, heap) **loop_nest)
    contain the loops from the outermost to the innermost, as they will
    appear in the classic distance vector.  */
 
-static bool
+bool
 find_loop_nest (struct loop *loop, VEC (loop_p, heap) **loop_nest)
 {
   VEC_safe_push (loop_p, heap, *loop_nest, loop);