Commit 70883f72 by Richard Kenner Committed by Richard Kenner

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
parent d7fa9227
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> 2004-06-28 Nathan Sidwell <nathan@codesourcery.com>
* vec.h, vec.c: New, type safe vector API. * vec.h, vec.c: New, type safe vector API.
......
...@@ -133,13 +133,12 @@ create_tmp_var_for (struct nesting_info *info, tree type, const char *prefix) ...@@ -133,13 +133,12 @@ create_tmp_var_for (struct nesting_info *info, tree type, const char *prefix)
tree tmp_var; tree tmp_var;
#if defined ENABLE_CHECKING #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 frontend, something is wrong. Note that we explicitly allow
incomplete types here, since we create them ourselves here. */ incomplete types here, since we create them ourselves here. */
if (TREE_CODE (type) == ARRAY_TYPE || TREE_ADDRESSABLE (type)) if (TREE_ADDRESSABLE (type)
abort (); || (TYPE_SIZE_UNIT (type)
if (TYPE_SIZE_UNIT (type) && TREE_CODE (TYPE_SIZE_UNIT (type)) != INTEGER_CST))
&& TREE_CODE (TYPE_SIZE_UNIT (type)) != INTEGER_CST)
abort (); abort ();
#endif #endif
...@@ -797,34 +796,41 @@ convert_nonlocal_reference (tree *tp, int *walk_subtrees, void *data) ...@@ -797,34 +796,41 @@ convert_nonlocal_reference (tree *tp, int *walk_subtrees, void *data)
case REALPART_EXPR: case REALPART_EXPR:
case IMAGPART_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: 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_REF:
case ARRAY_RANGE_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: case BIT_FIELD_REF:
wi->val_only = false; /* Go down this entire nest and just look at the final prefix and
walk_tree (&TREE_OPERAND (t, 0), convert_nonlocal_reference, wi, NULL); 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; wi->val_only = true;
walk_tree (&TREE_OPERAND (t, 1), convert_nonlocal_reference, wi, NULL); for (; handled_component_p (t)
walk_tree (&TREE_OPERAND (t, 2), convert_nonlocal_reference, wi, NULL); || 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; break;
default: default:
...@@ -938,34 +944,41 @@ convert_local_reference (tree *tp, int *walk_subtrees, void *data) ...@@ -938,34 +944,41 @@ convert_local_reference (tree *tp, int *walk_subtrees, void *data)
case REALPART_EXPR: case REALPART_EXPR:
case IMAGPART_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: 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_REF:
case ARRAY_RANGE_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: case BIT_FIELD_REF:
wi->val_only = false; /* Go down this entire nest and just look at the final prefix and
walk_tree (&TREE_OPERAND (t, 0), convert_local_reference, wi, NULL); 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; wi->val_only = true;
walk_tree (&TREE_OPERAND (t, 1), convert_local_reference, wi, NULL); for (; handled_component_p (t)
walk_tree (&TREE_OPERAND (t, 2), convert_local_reference, wi, NULL); || 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; break;
default: default:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment