diff options
author | Richard Kenner <kenner@vlsi1.ultra.nyu.edu> | 2004-06-28 12:01:30 +0000 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 2004-06-28 08:01:30 -0400 |
commit | 70883f7262c96220e2586ea15024ec545bb3acd7 (patch) | |
tree | b0ba130dd7c31980e7df064ed1c3f8e0c6893853 | |
parent | d7fa922736d73a90e18ca6d71bd0eb9fc73f1cbf (diff) | |
download | gcc-70883f7262c96220e2586ea15024ec545bb3acd7.zip gcc-70883f7262c96220e2586ea15024ec545bb3acd7.tar.gz gcc-70883f7262c96220e2586ea15024ec545bb3acd7.tar.bz2 |
tree-nested.c (create_tmp_var_for): Allow ARRAY_TYPE.
* 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
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/tree-nested.c | 115 |
2 files changed, 70 insertions, 51 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8c6719b..f011e27 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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. diff --git a/gcc/tree-nested.c b/gcc/tree-nested.c index 10bf1ce..668861c 100644 --- a/gcc/tree-nested.c +++ b/gcc/tree-nested.c @@ -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: |