summaryrefslogtreecommitdiff
path: root/gcc/ipa-cp.c
diff options
context:
space:
mode:
authorjamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4>2008-09-11 17:03:23 +0000
committerjamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4>2008-09-11 17:03:23 +0000
commit3f2ff9692c6cce5289450ab88328e4ee3da2aebb (patch)
tree73228742f0647af60cdfe7e96540801e3f8ad3ef /gcc/ipa-cp.c
parent83a99d39680ae22ff4d738742379cf81553a68f4 (diff)
downloadgcc-3f2ff9692c6cce5289450ab88328e4ee3da2aebb.tar.gz
2008-09-11 Martin Jambor <mjambor@suse.cz>
* ipa-prop.h (struct ipa_param_flags): Removed. (struct ipa_param_descriptor): New structure. (struct ipa_node_params): ipcp_lattices, param_decls and param_flags moved to ipa_param_description. (ipa_get_ith_param): Renamed to ipa_get_param, changed to access descriptors. Renamed all users. (ipa_is_ith_param_modified): Renamed to ipa_is_param_modified, changed to access descriptors. Renamed all users. (ipa_is_ith_param_called): Renamed to ipa_is_param_called, changed to access descriptors. Renamed all users. * ipa-cp.c (ipcp_init_cloned_node): Call ipa_initialize_node_params instead of ipa_count_formal_params and ipa_create_param_decls_array. (ipcp_analyze_node): Likewise. (ipcp_get_ith_lattice): Renamed to ipcp_get_lattice, changed to access descriptors. Renamed all users. (ipcp_initialize_node_lattices): Remove allocation. * ipa-inline.c (inline_indirect_intraprocedural_analysis): Call ipa_initialize_node_params instead of ipa_count_formal_params and ipa_create_param_decls_array. * ipa-prop.c (ipa_create_param_decls_array): Renamed to ipa_populate_param_decls, made static, added parameter info, renamed mt to node, removed allocation, changed to use descriptors. (ipa_count_formal_params): Made static, added parameter info, renamed mt to node. (ipa_initialize_node_params): New function. (ipa_check_stmt_modifications): Changed to use descriptors. (ipa_detect_param_modifications): Removed allocation, changed to use descriptors. (ipa_note_param_call): Changed to use descriptors. (ipa_analyze_params_uses): Removed allocation. (ipa_free_node_params_substructures): Changed to use descriptors. (ipa_edge_duplication_hook): Use the unused attribute. (ipa_node_duplication_hook): Use the unused attribute, changed to use descriptors, changed to duplicate descriptors. * ipa-inline.c (cgraph_mark_inline_edge): New parameter new_edges, changed all callers. Call ipa_propagate_indirect_call_infos if doing indirect inlining. Made static. (cgraph_decide_inlining): Freeing ipa-prop structures after inlining functions called only once. (cgraph_decide_recursive_inlining): Don't call ipa_propagate_indirect_call_infos, pass new_edges to cgraph_mark_inline_edge instead. (cgraph_decide_inlining_of_small_functions): Don't call ipa_propagate_indirect_call_infos, pass new_edges to cgraph_mark_inline_edge instead. (cgraph_decide_inlining): Don't call ipa_propagate_indirect_call_infos. * ipa-prop.c: Check that vectors are allocated. * ipa-inline.c (cgraph_mark_inline_edge): Returns boolean, true iff a new cgraph edges have been created. (cgraph_decide_inlining): New variable redo_always_inline. Flattening and always_inlining loop until callgraph stabilizes. * ipa-prop.c (update_call_notes_after_inlining): Returns boolean, true iff new cgraph edges have been created. (propagate_info_to_inlined_callees): Likewise. (ipa_propagate_indirect_call_infos): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@140293 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ipa-cp.c')
-rw-r--r--gcc/ipa-cp.c43
1 files changed, 19 insertions, 24 deletions
diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index 8f1c1614cd8..8dbc9f87f99 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -171,9 +171,8 @@ ipcp_init_cloned_node (struct cgraph_node *orig_node,
struct cgraph_node *new_node)
{
ipa_check_create_node_params ();
+ ipa_initialize_node_params (new_node);
IPA_NODE_REF (new_node)->ipcp_orig_node = orig_node;
- ipa_count_formal_params (new_node);
- ipa_create_param_decls_array (new_node);
}
/* Perform intraprocedrual analysis needed for ipcp. */
@@ -183,8 +182,7 @@ ipcp_analyze_node (struct cgraph_node *node)
/* Unreachable nodes should have been eliminated before ipcp. */
gcc_assert (node->needed || node->reachable);
- ipa_count_formal_params (node);
- ipa_create_param_decls_array (node);
+ ipa_initialize_node_params (node);
ipa_detect_param_modifications (node);
}
@@ -300,9 +298,9 @@ ipa_lattice_meet (struct ipcp_lattice *res, struct ipcp_lattice *lat1,
/* Return the lattice corresponding to the Ith formal parameter of the function
described by INFO. */
static inline struct ipcp_lattice *
-ipcp_get_ith_lattice (struct ipa_node_params *info, int i)
+ipcp_get_lattice (struct ipa_node_params *info, int i)
{
- return &(info->ipcp_lattices[i]);
+ return &(info->params[i].ipcp_lattice);
}
/* Given the jump function JFUNC, compute the lattice LAT that describes the
@@ -321,7 +319,7 @@ ipcp_lattice_from_jfunc (struct ipa_node_params *info, struct ipcp_lattice *lat,
{
struct ipcp_lattice *caller_lat;
- caller_lat = ipcp_get_ith_lattice (info, jfunc->value.formal_id);
+ caller_lat = ipcp_get_lattice (info, jfunc->value.formal_id);
lat->type = caller_lat->type;
lat->constant = caller_lat->constant;
}
@@ -364,7 +362,7 @@ ipcp_print_all_lattices (FILE * f)
count = ipa_get_param_count (info);
for (i = 0; i < count; i++)
{
- struct ipcp_lattice *lat = ipcp_get_ith_lattice (info, i);
+ struct ipcp_lattice *lat = ipcp_get_lattice (info, i);
fprintf (f, " param [%d]: ", i);
if (lat->type == IPA_CONST_VALUE)
@@ -485,9 +483,6 @@ ipcp_initialize_node_lattices (struct cgraph_node *node)
struct ipa_node_params *info = IPA_NODE_REF (node);
enum ipa_lattice_type type;
- info->ipcp_lattices = XCNEWVEC (struct ipcp_lattice,
- ipa_get_param_count (info));
-
if (ipa_is_called_with_var_arguments (info))
type = IPA_BOTTOM;
else if (!node->needed)
@@ -500,7 +495,7 @@ ipcp_initialize_node_lattices (struct cgraph_node *node)
type = IPA_BOTTOM;
for (i = 0; i < ipa_get_param_count (info) ; i++)
- ipcp_get_ith_lattice (info, i)->type = type;
+ ipcp_get_lattice (info, i)->type = type;
}
/* build INTEGER_CST tree with type TREE_TYPE and value according to LAT.
@@ -596,14 +591,14 @@ ipcp_change_tops_to_bottom (void)
count = ipa_get_param_count (info);
for (i = 0; i < count; i++)
{
- struct ipcp_lattice *lat = ipcp_get_ith_lattice (info, i);
+ struct ipcp_lattice *lat = ipcp_get_lattice (info, i);
if (lat->type == IPA_TOP)
{
prop_again = true;
if (dump_file)
{
fprintf (dump_file, "Forcing param ");
- print_generic_expr (dump_file, ipa_get_ith_param (info, i), 0);
+ print_generic_expr (dump_file, ipa_get_param (info, i), 0);
fprintf (dump_file, " of node %s to bottom.\n",
cgraph_node_name (node));
}
@@ -651,7 +646,7 @@ ipcp_propagate_stage (void)
{
jump_func = ipa_get_ith_jump_func (args, i);
ipcp_lattice_from_jfunc (info, &inc_lat, jump_func);
- dest_lat = ipcp_get_ith_lattice (callee_info, i);
+ dest_lat = ipcp_get_lattice (callee_info, i);
ipa_lattice_meet (&new_lat, &inc_lat, dest_lat);
if (ipcp_lattice_changed (&new_lat, dest_lat))
{
@@ -917,7 +912,7 @@ ipcp_need_redirect_p (struct cgraph_edge *cs)
count = ipa_get_param_count (orig_callee_info);
for (i = 0; i < count; i++)
{
- struct ipcp_lattice *lat = ipcp_get_ith_lattice (orig_callee_info, i);
+ struct ipcp_lattice *lat = ipcp_get_lattice (orig_callee_info, i);
if (ipcp_lat_is_const (lat))
{
jump_func = ipa_get_ith_jump_func (IPA_EDGE_REF (cs), i);
@@ -946,8 +941,8 @@ ipcp_update_callgraph (void)
for (i = 0; i < count; i++)
{
- struct ipcp_lattice *lat = ipcp_get_ith_lattice (info, i);
- tree parm_tree = ipa_get_ith_param (info, i);
+ struct ipcp_lattice *lat = ipcp_get_lattice (info, i);
+ tree parm_tree = ipa_get_param (info, i);
/* We can proactively remove obviously unused arguments. */
if (is_gimple_reg (parm_tree)
@@ -1069,8 +1064,8 @@ ipcp_estimate_growth (struct cgraph_node *node)
count = ipa_get_param_count (info);
for (i = 0; i < count; i++)
{
- struct ipcp_lattice *lat = ipcp_get_ith_lattice (info, i);
- tree parm_tree = ipa_get_ith_param (info, i);
+ struct ipcp_lattice *lat = ipcp_get_lattice (info, i);
+ tree parm_tree = ipa_get_param (info, i);
/* We can proactively remove obviously unused arguments. */
if (is_gimple_reg (parm_tree)
@@ -1142,8 +1137,8 @@ ipcp_const_param_count (struct cgraph_node *node)
for (i = 0; i < count; i++)
{
- struct ipcp_lattice *lat = ipcp_get_ith_lattice (info, i);
- tree parm_tree = ipa_get_ith_param (info, i);
+ struct ipcp_lattice *lat = ipcp_get_lattice (info, i);
+ tree parm_tree = ipa_get_param (info, i);
if (ipcp_lat_is_insertable (lat)
/* Do not count obviously unused arguments. */
&& (!is_gimple_reg (parm_tree)
@@ -1242,8 +1237,8 @@ ipcp_insert_stage (void)
args_to_skip = BITMAP_ALLOC (NULL);
for (i = 0; i < count; i++)
{
- struct ipcp_lattice *lat = ipcp_get_ith_lattice (info, i);
- parm_tree = ipa_get_ith_param (info, i);
+ struct ipcp_lattice *lat = ipcp_get_lattice (info, i);
+ parm_tree = ipa_get_param (info, i);
/* We can proactively remove obviously unused arguments. */
if (is_gimple_reg (parm_tree)