Commit b2c0ad40 by Kazu Hirata Committed by Kazu Hirata

cgraph.h (cgraph_edge_p): New.

	* cgraph.h (cgraph_edge_p): New.
	Update the prototype of cgraph_function_versioning.
	* cgraphunit.c (cgraph_copy_node_for_versioning,
	cgraph_function_versioning): Use VEC instead of VARRAY.
	* ipa-cp.c (ipcp_insert_stage): Likewise.

From-SVN: r113006
parent 1a5640b4
...@@ -11,6 +11,12 @@ ...@@ -11,6 +11,12 @@
VEC instead of VARRAY. VEC instead of VARRAY.
(last_alias_set): Remove. (last_alias_set): Remove.
* cgraph.h (cgraph_edge_p): New.
Update the prototype of cgraph_function_versioning.
* cgraphunit.c (cgraph_copy_node_for_versioning,
cgraph_function_versioning): Use VEC instead of VARRAY.
* ipa-cp.c (ipcp_insert_stage): Likewise.
2006-04-16 Roger Sayle <roger@eyesopen.com> 2006-04-16 Roger Sayle <roger@eyesopen.com>
PR target/26961 PR target/26961
......
...@@ -189,6 +189,11 @@ struct cgraph_edge GTY((chain_next ("%h.next_caller"), chain_prev ("%h.prev_call ...@@ -189,6 +189,11 @@ struct cgraph_edge GTY((chain_next ("%h.next_caller"), chain_prev ("%h.prev_call
int loop_nest; int loop_nest;
}; };
typedef struct cgraph_edge *cgraph_edge_p;
DEF_VEC_P(cgraph_edge_p);
DEF_VEC_ALLOC_P(cgraph_edge_p,heap);
/* The cgraph_varpool data structure. /* The cgraph_varpool data structure.
Each static variable decl has assigned cgraph_varpool_node. */ Each static variable decl has assigned cgraph_varpool_node. */
...@@ -307,7 +312,8 @@ void cgraph_build_static_cdtor (char which, tree body, int priority); ...@@ -307,7 +312,8 @@ void cgraph_build_static_cdtor (char which, tree body, int priority);
void cgraph_reset_static_var_maps (void); void cgraph_reset_static_var_maps (void);
void init_cgraph (void); void init_cgraph (void);
struct cgraph_node *cgraph_function_versioning (struct cgraph_node *, struct cgraph_node *cgraph_function_versioning (struct cgraph_node *,
varray_type, varray_type); VEC(cgraph_edge_p,heap)*,
varray_type);
void cgraph_analyze_function (struct cgraph_node *); void cgraph_analyze_function (struct cgraph_node *);
struct cgraph_node *save_inline_function_body (struct cgraph_node *); struct cgraph_node *save_inline_function_body (struct cgraph_node *);
......
...@@ -1575,7 +1575,8 @@ update_call_expr (struct cgraph_node *new_version) ...@@ -1575,7 +1575,8 @@ update_call_expr (struct cgraph_node *new_version)
static struct cgraph_node * static struct cgraph_node *
cgraph_copy_node_for_versioning (struct cgraph_node *old_version, cgraph_copy_node_for_versioning (struct cgraph_node *old_version,
tree new_decl, varray_type redirect_callers) tree new_decl,
VEC(cgraph_edge_p,heap) *redirect_callers)
{ {
struct cgraph_node *new_version; struct cgraph_node *new_version;
struct cgraph_edge *e, *new_e; struct cgraph_edge *e, *new_e;
...@@ -1614,14 +1615,12 @@ cgraph_copy_node_for_versioning (struct cgraph_node *old_version, ...@@ -1614,14 +1615,12 @@ cgraph_copy_node_for_versioning (struct cgraph_node *old_version,
if (!next_callee) if (!next_callee)
break; break;
} }
if (redirect_callers) for (i = 0; VEC_iterate (cgraph_edge_p, redirect_callers, i, e); i++)
for (i = 0; i < VARRAY_ACTIVE_SIZE (redirect_callers); i++) {
{ /* Redirect calls to the old version node to point to its new
e = VARRAY_GENERIC_PTR (redirect_callers, i); version. */
/* Redirect calls to the old version node cgraph_redirect_edge_callee (e, new_version);
to point to it's new version. */ }
cgraph_redirect_edge_callee (e, new_version);
}
return new_version; return new_version;
} }
...@@ -1641,7 +1640,7 @@ cgraph_copy_node_for_versioning (struct cgraph_node *old_version, ...@@ -1641,7 +1640,7 @@ cgraph_copy_node_for_versioning (struct cgraph_node *old_version,
struct cgraph_node * struct cgraph_node *
cgraph_function_versioning (struct cgraph_node *old_version_node, cgraph_function_versioning (struct cgraph_node *old_version_node,
varray_type redirect_callers, VEC(cgraph_edge_p,heap) *redirect_callers,
varray_type tree_map) varray_type tree_map)
{ {
tree old_decl = old_version_node->decl; tree old_decl = old_version_node->decl;
......
...@@ -1005,7 +1005,8 @@ ipcp_insert_stage (void) ...@@ -1005,7 +1005,8 @@ ipcp_insert_stage (void)
struct cgraph_node *node, *node1 = NULL; struct cgraph_node *node, *node1 = NULL;
int i, const_param; int i, const_param;
union parameter_info *cvalue; union parameter_info *cvalue;
varray_type redirect_callers, replace_trees; VEC(cgraph_edge_p,heap) *redirect_callers;
varray_type replace_trees;
struct cgraph_edge *cs; struct cgraph_edge *cs;
int node_callers, count; int node_callers, count;
tree parm_tree; tree parm_tree;
...@@ -1045,15 +1046,14 @@ ipcp_insert_stage (void) ...@@ -1045,15 +1046,14 @@ ipcp_insert_stage (void)
node_callers = 0; node_callers = 0;
for (cs = node->callers; cs != NULL; cs = cs->next_caller) for (cs = node->callers; cs != NULL; cs = cs->next_caller)
node_callers++; node_callers++;
VARRAY_GENERIC_PTR_INIT (redirect_callers, node_callers, redirect_callers = VEC_alloc (cgraph_edge_p, heap, node_callers);
"redirect_callers");
for (cs = node->callers; cs != NULL; cs = cs->next_caller) for (cs = node->callers; cs != NULL; cs = cs->next_caller)
VARRAY_PUSH_GENERIC_PTR (redirect_callers, cs); VEC_quick_push (cgraph_edge_p, redirect_callers, cs);
/* Redirecting all the callers of the node to the /* Redirecting all the callers of the node to the
new versioned node. */ new versioned node. */
node1 = node1 =
cgraph_function_versioning (node, redirect_callers, replace_trees); cgraph_function_versioning (node, redirect_callers, replace_trees);
VARRAY_CLEAR (redirect_callers); VEC_free (cgraph_edge_p, heap, redirect_callers);
VARRAY_CLEAR (replace_trees); VARRAY_CLEAR (replace_trees);
if (node1 == NULL) if (node1 == NULL)
continue; continue;
......
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