]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-nested.c (create_tmp_var_for): Allow ARRAY_TYPE.
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>
Mon, 28 Jun 2004 12:01:30 +0000 (12:01 +0000)
committerRichard Kenner <kenner@gcc.gnu.org>
Mon, 28 Jun 2004 12:01:30 +0000 (08:01 -0400)
* tree-nested.c (create_tmp_var_for): Allow ARRAY_TYPE.
(convert_nonlocal_reference, convert_local_reference): Properly
convert nest of handled component references.

From-SVN: r83781

gcc/ChangeLog
gcc/tree-nested.c

index 8c6719ba2f0ce7df8ceba93e642d0d6bd8234ff5..f011e27b8dd1c6082f0cc60d55582e0859ed5224 100644 (file)
@@ -1,3 +1,9 @@
+2004-06-28  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
+
+       * tree-nested.c (create_tmp_var_for): Allow ARRAY_TYPE.
+       (convert_nonlocal_reference, convert_local_reference): Properly
+       convert nest of handled component references.
+
 2004-06-28  Nathan Sidwell  <nathan@codesourcery.com>
 
        * vec.h, vec.c: New, type safe vector API.
index 10bf1ce091cc8749250478032dbcb0c5022e7eb7..668861c15b963d7d2479ca4f826f3c21254cda30 100644 (file)
@@ -133,13 +133,12 @@ create_tmp_var_for (struct nesting_info *info, tree type, const char *prefix)
   tree tmp_var;
 
 #if defined ENABLE_CHECKING
-  /* If the type is an array or a type which must be created by the
+  /* If the type is of variable size or a type which must be created by the
      frontend, something is wrong.  Note that we explicitly allow
      incomplete types here, since we create them ourselves here.  */
-  if (TREE_CODE (type) == ARRAY_TYPE || TREE_ADDRESSABLE (type))
-    abort ();
-  if (TYPE_SIZE_UNIT (type)
-      && TREE_CODE (TYPE_SIZE_UNIT (type)) != INTEGER_CST)
+  if (TREE_ADDRESSABLE (type)
+      || (TYPE_SIZE_UNIT (type)
+         && TREE_CODE (TYPE_SIZE_UNIT (type)) != INTEGER_CST))
     abort ();
 #endif
 
@@ -797,34 +796,41 @@ convert_nonlocal_reference (tree *tp, int *walk_subtrees, void *data)
 
     case REALPART_EXPR:
     case IMAGPART_EXPR:
-      wi->val_only = false;
-      walk_tree (&TREE_OPERAND (t, 0), convert_nonlocal_reference, wi, NULL);
-      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;
-      walk_tree (&TREE_OPERAND (t, 0), convert_nonlocal_reference, wi, NULL);
-      wi->val_only = true;
-      walk_tree (&TREE_OPERAND (t, 1), convert_nonlocal_reference, wi, NULL);
-      walk_tree (&TREE_OPERAND (t, 2), convert_nonlocal_reference, wi, NULL);
-      walk_tree (&TREE_OPERAND (t, 3), convert_nonlocal_reference, wi, NULL);
-      break;
-
     case BIT_FIELD_REF:
-      wi->val_only = false;
-      walk_tree (&TREE_OPERAND (t, 0), convert_nonlocal_reference, wi, NULL);
+      /* Go down this entire nest and just look at the final prefix and
+        anything that describes the references.  Otherwise, we lose track
+        of whether a NOP_EXPR or VIEW_CONVERT_EXPR needs a simple value.  */
       wi->val_only = true;
-      walk_tree (&TREE_OPERAND (t, 1), convert_nonlocal_reference, wi, NULL);
-      walk_tree (&TREE_OPERAND (t, 2), convert_nonlocal_reference, wi, NULL);
+      for (; handled_component_p (t)
+          || TREE_CODE (t) == REALPART_EXPR || TREE_CODE (t) == IMAGPART_EXPR;
+          tp = &TREE_OPERAND (t, 0), t = *tp)
+       {
+         if (TREE_CODE (t) == COMPONENT_REF)
+           walk_tree (&TREE_OPERAND (t, 2), convert_nonlocal_reference, wi,
+                      NULL);
+         else if (TREE_CODE (t) == ARRAY_REF
+                  || TREE_CODE (t) == ARRAY_RANGE_REF)
+           {
+             walk_tree (&TREE_OPERAND (t, 1), convert_nonlocal_reference, wi,
+                        NULL);
+             walk_tree (&TREE_OPERAND (t, 2), convert_nonlocal_reference, wi,
+                        NULL);
+             walk_tree (&TREE_OPERAND (t, 3), convert_nonlocal_reference, wi,
+                        NULL);
+           }
+         else if (TREE_CODE (t) == BIT_FIELD_REF)
+           {
+             walk_tree (&TREE_OPERAND (t, 1), convert_nonlocal_reference, wi,
+                        NULL);
+             walk_tree (&TREE_OPERAND (t, 2), convert_nonlocal_reference, wi,
+                        NULL);
+           }
+       }
+      wi->val_only = false;
+      walk_tree (tp, convert_nonlocal_reference, wi, NULL);
       break;
 
     default:
@@ -938,34 +944,41 @@ convert_local_reference (tree *tp, int *walk_subtrees, void *data)
 
     case REALPART_EXPR:
     case IMAGPART_EXPR:
-      wi->val_only = false;
-      walk_tree (&TREE_OPERAND (t, 0), convert_local_reference, wi, NULL);
-      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;
-      walk_tree (&TREE_OPERAND (t, 0), convert_local_reference, wi, NULL);
-      wi->val_only = true;
-      walk_tree (&TREE_OPERAND (t, 1), convert_local_reference, wi, NULL);
-      walk_tree (&TREE_OPERAND (t, 2), convert_local_reference, wi, NULL);
-      walk_tree (&TREE_OPERAND (t, 3), convert_local_reference, wi, NULL);
-      break;
-
     case BIT_FIELD_REF:
-      wi->val_only = false;
-      walk_tree (&TREE_OPERAND (t, 0), convert_local_reference, wi, NULL);
+      /* Go down this entire nest and just look at the final prefix and
+        anything that describes the references.  Otherwise, we lose track
+        of whether a NOP_EXPR or VIEW_CONVERT_EXPR needs a simple value.  */
       wi->val_only = true;
-      walk_tree (&TREE_OPERAND (t, 1), convert_local_reference, wi, NULL);
-      walk_tree (&TREE_OPERAND (t, 2), convert_local_reference, wi, NULL);
+      for (; handled_component_p (t)
+          || TREE_CODE (t) == REALPART_EXPR || TREE_CODE (t) == IMAGPART_EXPR;
+          tp = &TREE_OPERAND (t, 0), t = *tp)
+       {
+         if (TREE_CODE (t) == COMPONENT_REF)
+           walk_tree (&TREE_OPERAND (t, 2), convert_local_reference, wi,
+                      NULL);
+         else if (TREE_CODE (t) == ARRAY_REF
+                  || TREE_CODE (t) == ARRAY_RANGE_REF)
+           {
+             walk_tree (&TREE_OPERAND (t, 1), convert_local_reference, wi,
+                        NULL);
+             walk_tree (&TREE_OPERAND (t, 2), convert_local_reference, wi,
+                        NULL);
+             walk_tree (&TREE_OPERAND (t, 3), convert_local_reference, wi,
+                        NULL);
+           }
+         else if (TREE_CODE (t) == BIT_FIELD_REF)
+           {
+             walk_tree (&TREE_OPERAND (t, 1), convert_local_reference, wi,
+                        NULL);
+             walk_tree (&TREE_OPERAND (t, 2), convert_local_reference, wi,
+                        NULL);
+           }
+       }
+      wi->val_only = false;
+      walk_tree (tp, convert_local_reference, wi, NULL);
       break;
 
     default: