tree-nested.c (build_addr): Merge real/imagpart with handled_component_p.
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>
Fri, 25 Jun 2004 20:33:09 +0000 (20:33 +0000)
committerRichard Kenner <kenner@gcc.gnu.org>
Fri, 25 Jun 2004 20:33:09 +0000 (16:33 -0400)
* tree-nested.c (build_addr): Merge real/imagpart with
handled_component_p.
(convert_nonlocal_reference, convert_local_reference): Process extra
args to COMPONENT_REF and ARRAY_REF.
* tree-outof-ssa.c (discover_nonconstant_array_refs_r): Check for
lower bound and field offset being constant.

From-SVN: r83677

gcc/ChangeLog
gcc/tree-nested.c
gcc/tree-outof-ssa.c

index 4de541bbb6c9a83bbac9f63c8d85990b2dd03199..f38a5e0ad507680696b1b36421f24e77e5772ce0 100644 (file)
@@ -1,3 +1,12 @@
+2004-06-25  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
+
+       * tree-nested.c (build_addr): Merge real/imagpart with
+       handled_component_p.
+       (convert_nonlocal_reference, convert_local_reference): Process extra
+       args to COMPONENT_REF and ARRAY_REF.
+       * tree-outof-ssa.c (discover_nonconstant_array_refs_r): Check for
+       lower bound and field offset being constant.
+
 2004-06-25  Mark Mitchell  <mark@codesourcery.com>
 
        PR wrong-code/16129
index 1f32e1f60f9520564d678c3d0b51bb696532681c..10bf1ce091cc8749250478032dbcb0c5022e7eb7 100644 (file)
@@ -158,11 +158,9 @@ build_addr (tree exp)
 {
   tree base = exp;
 
-  if (TREE_CODE (base) == REALPART_EXPR || TREE_CODE (base) == IMAGPART_EXPR)
+  while (TREE_CODE (base) == REALPART_EXPR || TREE_CODE (base) == IMAGPART_EXPR
+        || handled_component_p (base))
     base = TREE_OPERAND (base, 0);
-  else
-    while (handled_component_p (base))
-      base = TREE_OPERAND (base, 0);
 
   if (DECL_P (base))
     TREE_ADDRESSABLE (base) = 1;
@@ -797,7 +795,6 @@ convert_nonlocal_reference (tree *tp, int *walk_subtrees, void *data)
       }
       break;
 
-    case COMPONENT_REF:
     case REALPART_EXPR:
     case IMAGPART_EXPR:
       wi->val_only = false;
@@ -805,6 +802,13 @@ convert_nonlocal_reference (tree *tp, int *walk_subtrees, void *data)
       wi->val_only = true;
       break;
 
+    case COMPONENT_REF:
+      wi->val_only = false;
+      walk_tree (&TREE_OPERAND (t, 0), convert_nonlocal_reference, wi, NULL);
+      wi->val_only = true;
+      walk_tree (&TREE_OPERAND (t, 2), convert_nonlocal_reference, wi, NULL);
+      break;
+
     case ARRAY_REF:
     case ARRAY_RANGE_REF:
       wi->val_only = false;
@@ -932,7 +936,6 @@ convert_local_reference (tree *tp, int *walk_subtrees, void *data)
       tsi_link_after (&wi->tsi, x, TSI_SAME_STMT);
       break;
 
-    case COMPONENT_REF:
     case REALPART_EXPR:
     case IMAGPART_EXPR:
       wi->val_only = false;
@@ -940,6 +943,13 @@ convert_local_reference (tree *tp, int *walk_subtrees, void *data)
       wi->val_only = true;
       break;
 
+    case COMPONENT_REF:
+      wi->val_only = false;
+      walk_tree (&TREE_OPERAND (t, 0), convert_local_reference, wi, NULL);
+      wi->val_only = true;
+      walk_tree (&TREE_OPERAND (t, 2), convert_local_reference, wi, NULL);
+      break;
+
     case ARRAY_REF:
     case ARRAY_RANGE_REF:
       wi->val_only = false;
index f19afdde6a1a6ce1a982f0b996bc310bea4a4d65..517e2b8df5327cb91d80162fc2a8dab71bb7adc1 100644 (file)
@@ -1763,17 +1763,21 @@ discover_nonconstant_array_refs_r (tree * tp, int *walk_subtrees,
 
   if (TYPE_P (t) || DECL_P (t))
     *walk_subtrees = 0;
-  else if (TREE_CODE (t) == ARRAY_REF || TREE_CODE (t) == ARRAY_RANGE_REF)
+  if (TREE_CODE (t) == ARRAY_REF || TREE_CODE (t) == ARRAY_RANGE_REF)
     {
       while (((TREE_CODE (t) == ARRAY_REF || TREE_CODE (t) == ARRAY_RANGE_REF)
-             && is_gimple_min_invariant (TREE_OPERAND (t, 1)))
+             && is_gimple_min_invariant (TREE_OPERAND (t, 1))
+             && (!TREE_OPERAND (t, 2)
+                 || is_gimple_min_invariant (TREE_OPERAND (t, 2))))
             || (TREE_CODE (t) == COMPONENT_REF
-                || TREE_CODE (t) == BIT_FIELD_REF
-                || TREE_CODE (t) == REALPART_EXPR
-                || TREE_CODE (t) == IMAGPART_EXPR
-                || TREE_CODE (t) == VIEW_CONVERT_EXPR
-                || TREE_CODE (t) == NOP_EXPR
-                || TREE_CODE (t) == CONVERT_EXPR))
+                && (!TREE_OPERAND (t,2)
+                    || is_gimple_min_invariant (TREE_OPERAND (t, 2))))
+            || TREE_CODE (t) == BIT_FIELD_REF
+            || TREE_CODE (t) == REALPART_EXPR
+            || TREE_CODE (t) == IMAGPART_EXPR
+            || TREE_CODE (t) == VIEW_CONVERT_EXPR
+            || TREE_CODE (t) == NOP_EXPR
+            || TREE_CODE (t) == CONVERT_EXPR)
        t = TREE_OPERAND (t, 0);
 
       if (TREE_CODE (t) == ARRAY_REF || TREE_CODE (t) == ARRAY_RANGE_REF)