Commit ed397c43 by Richard Kenner Committed by Richard Kenner

tree-inline.c (remap_type): Arrange to have just one pointer type for each type,…

tree-inline.c (remap_type): Arrange to have just one pointer type for each type, mode, and 'can alias' value.

	* tree-inline.c (remap_type): Arrange to have just one pointer type
	for each type, mode, and 'can alias' value.
	(setup_one_parameter): Remap type when making VAR_DECL for PARM_DECL.
	(estimate_num_insns_1): Minor code reformatting.
	(inline_forbidden_p_1): Likewise; add; missing return statement.

From-SVN: r83672
parent 0fe0c614
2004-06-24 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* tree-inline.c (remap_type): Arrange to have just one pointer type
for each type, mode, and 'can alias' value.
(setup_one_parameter): Remap type when making VAR_DECL for PARM_DECL.
(estimate_num_insns_1): Minor code reformatting.
(inline_forbidden_p_1): Likewise; add; missing return statement.
2004-06-25 Roger Sayle <roger@eyesopen.com> 2004-06-25 Roger Sayle <roger@eyesopen.com>
PR middle-end/15825 PR middle-end/15825
......
...@@ -250,8 +250,28 @@ remap_type (tree type, inline_data *id) ...@@ -250,8 +250,28 @@ remap_type (tree type, inline_data *id)
return type; return type;
} }
/* We do need a copy. build and register it now. */ /* We do need a copy. build and register it now. If this is a pointer or
new = copy_node (type); reference type, remap the designated type and make a new pointer or
reference type. */
if (TREE_CODE (type) == POINTER_TYPE)
{
new = build_pointer_type_for_mode (remap_type (TREE_TYPE (type), id),
TYPE_MODE (type),
TYPE_REF_CAN_ALIAS_ALL (type));
insert_decl_map (id, type, new);
return new;
}
else if (TREE_CODE (type) == REFERENCE_TYPE)
{
new = build_reference_type_for_mode (remap_type (TREE_TYPE (type), id),
TYPE_MODE (type),
TYPE_REF_CAN_ALIAS_ALL (type));
insert_decl_map (id, type, new);
return new;
}
else
new = copy_node (type);
insert_decl_map (id, type, new); insert_decl_map (id, type, new);
/* This is a new type, not a copy of an old type. Need to reassociate /* This is a new type, not a copy of an old type. Need to reassociate
...@@ -290,19 +310,6 @@ remap_type (tree type, inline_data *id) ...@@ -290,19 +310,6 @@ remap_type (tree type, inline_data *id)
walk_tree (&TYPE_MAX_VALUE (new), copy_body_r, id, NULL); walk_tree (&TYPE_MAX_VALUE (new), copy_body_r, id, NULL);
return new; return new;
case POINTER_TYPE:
TREE_TYPE (new) = t = remap_type (TREE_TYPE (new), id);
TYPE_NEXT_PTR_TO (new) = TYPE_POINTER_TO (t);
TYPE_POINTER_TO (t) = new;
return new;
case REFERENCE_TYPE:
TREE_TYPE (new) = t = remap_type (TREE_TYPE (new), id);
TYPE_NEXT_REF_TO (new) = TYPE_REFERENCE_TO (t);
TYPE_REFERENCE_TO (t) = new;
return new;
case METHOD_TYPE:
case FUNCTION_TYPE: case FUNCTION_TYPE:
TREE_TYPE (new) = remap_type (TREE_TYPE (new), id); TREE_TYPE (new) = remap_type (TREE_TYPE (new), id);
walk_tree (&TYPE_ARG_TYPES (new), copy_body_r, id, NULL); walk_tree (&TYPE_ARG_TYPES (new), copy_body_r, id, NULL);
...@@ -733,8 +740,9 @@ setup_one_parameter (inline_data *id, tree p, tree value, tree fn, ...@@ -733,8 +740,9 @@ setup_one_parameter (inline_data *id, tree p, tree value, tree fn,
} }
} }
/* Make an equivalent VAR_DECL. */ /* Make an equivalent VAR_DECL with the remapped type. */
var = copy_decl_for_inlining (p, fn, VARRAY_TREE (id->fns, 0)); var = copy_decl_for_inlining (p, fn, VARRAY_TREE (id->fns, 0));
TREE_TYPE (var) = remap_type (TREE_TYPE (var), id);
/* See if the frontend wants to pass this by invisible reference. If /* See if the frontend wants to pass this by invisible reference. If
so, our new VAR_DECL will have REFERENCE_TYPE, and we need to so, our new VAR_DECL will have REFERENCE_TYPE, and we need to
...@@ -1048,6 +1056,7 @@ inline_forbidden_p_1 (tree *nodep, int *walk_subtrees ATTRIBUTE_UNUSED, ...@@ -1048,6 +1056,7 @@ inline_forbidden_p_1 (tree *nodep, int *walk_subtrees ATTRIBUTE_UNUSED,
inline_forbidden_reason inline_forbidden_reason
= N_("%Jfunction '%F' can never be inlined " = N_("%Jfunction '%F' can never be inlined "
"because it receives a non-local goto"); "because it receives a non-local goto");
return node;
} }
break; break;
...@@ -1084,8 +1093,9 @@ static tree ...@@ -1084,8 +1093,9 @@ static tree
inline_forbidden_p (tree fndecl) inline_forbidden_p (tree fndecl)
{ {
location_t saved_loc = input_location; location_t saved_loc = input_location;
tree ret = walk_tree_without_duplicates tree ret = walk_tree_without_duplicates (&DECL_SAVED_TREE (fndecl),
(&DECL_SAVED_TREE (fndecl), inline_forbidden_p_1, fndecl); inline_forbidden_p_1, fndecl);
input_location = saved_loc; input_location = saved_loc;
return ret; return ret;
} }
...@@ -1180,9 +1190,10 @@ estimate_num_insns_1 (tree *tp, int *walk_subtrees, void *data) ...@@ -1180,9 +1190,10 @@ estimate_num_insns_1 (tree *tp, int *walk_subtrees, void *data)
/* Assume that constants and references counts nothing. These should /* Assume that constants and references counts nothing. These should
be majorized by amount of operations among them we count later be majorized by amount of operations among them we count later
and are common target of CSE and similar optimizations. */ and are common target of CSE and similar optimizations. */
if (TREE_CODE_CLASS (TREE_CODE (x)) == 'c' else if (TREE_CODE_CLASS (TREE_CODE (x)) == 'c'
|| TREE_CODE_CLASS (TREE_CODE (x)) == 'r') || TREE_CODE_CLASS (TREE_CODE (x)) == 'r')
return NULL; return NULL;
switch (TREE_CODE (x)) switch (TREE_CODE (x))
{ {
/* Containers have no cost. */ /* Containers have no cost. */
......
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