Commit d044dd17 by Martin Jambor Committed by Martin Jambor

ipa-prop.c (ipa_get_param_decl_index_1): New function.

2012-11-06  Martin Jambor  <mjambor@suse.cz>

	* ipa-prop.c (ipa_get_param_decl_index_1): New function.
	(ipa_get_param_decl_index): Just call ipa_get_param_decl_index_1.
	(ipa_populate_param_decls): Accept descriptors parameter rather
	than the whole info.
	(load_from_unmodified_param): Likewise.
	(ipa_load_from_parm_agg_1): Likewise.
	(ipa_load_from_parm_agg): Extract descriptors from info.
	(compute_complex_assign_jump_func): Likewise.
	(ipa_analyze_indirect_call_uses): Likewise.

From-SVN: r193250
parent d3669566
2012-11-06 Martin Jambor <mjambor@suse.cz>
* ipa-prop.c (ipa_get_param_decl_index_1): New function.
(ipa_get_param_decl_index): Just call ipa_get_param_decl_index_1.
(ipa_populate_param_decls): Accept descriptors parameter rather
than the whole info.
(load_from_unmodified_param): Likewise.
(ipa_load_from_parm_agg_1): Likewise.
(ipa_load_from_parm_agg): Extract descriptors from info.
(compute_complex_assign_jump_func): Likewise.
(ipa_analyze_indirect_call_uses): Likewise.
2012-11-06 Jan Hubicka <jh@suse.cz> 2012-11-06 Jan Hubicka <jh@suse.cz>
* ipa-inline.c (compute_uninlined_call_time): Return gcov_type. * ipa-inline.c (compute_uninlined_call_time): Return gcov_type.
...@@ -65,25 +65,35 @@ static struct cgraph_node_hook_list *function_insertion_hook_holder; ...@@ -65,25 +65,35 @@ static struct cgraph_node_hook_list *function_insertion_hook_holder;
/* Return index of the formal whose tree is PTREE in function which corresponds /* Return index of the formal whose tree is PTREE in function which corresponds
to INFO. */ to INFO. */
int static int
ipa_get_param_decl_index (struct ipa_node_params *info, tree ptree) ipa_get_param_decl_index_1 (VEC (ipa_param_descriptor_t, heap) *descriptors,
tree ptree)
{ {
int i, count; int i, count;
count = ipa_get_param_count (info); count = VEC_length (ipa_param_descriptor_t, descriptors);
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
if (ipa_get_param (info, i) == ptree) if (VEC_index (ipa_param_descriptor_t, descriptors, i).decl == ptree)
return i; return i;
return -1; return -1;
} }
/* Populate the param_decl field in parameter descriptors of INFO that /* Return index of the formal whose tree is PTREE in function which corresponds
corresponds to NODE. */ to INFO. */
int
ipa_get_param_decl_index (struct ipa_node_params *info, tree ptree)
{
return ipa_get_param_decl_index_1 (info->descriptors, ptree);
}
/* Populate the param_decl field in parameter DESCRIPTORS that correspond to
NODE. */
static void static void
ipa_populate_param_decls (struct cgraph_node *node, ipa_populate_param_decls (struct cgraph_node *node,
struct ipa_node_params *info) VEC (ipa_param_descriptor_t, heap) *descriptors)
{ {
tree fndecl; tree fndecl;
tree fnargs; tree fnargs;
...@@ -95,8 +105,7 @@ ipa_populate_param_decls (struct cgraph_node *node, ...@@ -95,8 +105,7 @@ ipa_populate_param_decls (struct cgraph_node *node,
param_num = 0; param_num = 0;
for (parm = fnargs; parm; parm = DECL_CHAIN (parm)) for (parm = fnargs; parm; parm = DECL_CHAIN (parm))
{ {
VEC_index (ipa_param_descriptor_t, VEC_index (ipa_param_descriptor_t, descriptors, param_num).decl = parm;
info->descriptors, param_num).decl = parm;
param_num++; param_num++;
} }
} }
...@@ -133,7 +142,7 @@ ipa_initialize_node_params (struct cgraph_node *node) ...@@ -133,7 +142,7 @@ ipa_initialize_node_params (struct cgraph_node *node)
{ {
VEC_safe_grow_cleared (ipa_param_descriptor_t, heap, VEC_safe_grow_cleared (ipa_param_descriptor_t, heap,
info->descriptors, param_count); info->descriptors, param_count);
ipa_populate_param_decls (node, info); ipa_populate_param_decls (node, info->descriptors);
} }
} }
} }
...@@ -662,7 +671,7 @@ parm_preserved_before_stmt_p (struct param_analysis_info *parm_ainfo, ...@@ -662,7 +671,7 @@ parm_preserved_before_stmt_p (struct param_analysis_info *parm_ainfo,
modified. Otherwise return -1. */ modified. Otherwise return -1. */
static int static int
load_from_unmodified_param (struct ipa_node_params *info, load_from_unmodified_param (VEC (ipa_param_descriptor_t, heap) *descriptors,
struct param_analysis_info *parms_ainfo, struct param_analysis_info *parms_ainfo,
gimple stmt) gimple stmt)
{ {
...@@ -676,7 +685,7 @@ load_from_unmodified_param (struct ipa_node_params *info, ...@@ -676,7 +685,7 @@ load_from_unmodified_param (struct ipa_node_params *info,
if (TREE_CODE (op1) != PARM_DECL) if (TREE_CODE (op1) != PARM_DECL)
return -1; return -1;
index = ipa_get_param_decl_index (info, op1); index = ipa_get_param_decl_index_1 (descriptors, op1);
if (index < 0 if (index < 0
|| !parm_preserved_before_stmt_p (parms_ainfo ? &parms_ainfo[index] || !parm_preserved_before_stmt_p (parms_ainfo ? &parms_ainfo[index]
: NULL, stmt, op1)) : NULL, stmt, op1))
...@@ -750,7 +759,7 @@ parm_ref_data_pass_through_p (struct param_analysis_info *parm_ainfo, ...@@ -750,7 +759,7 @@ parm_ref_data_pass_through_p (struct param_analysis_info *parm_ainfo,
reference respectively. */ reference respectively. */
static bool static bool
ipa_load_from_parm_agg_1 (struct ipa_node_params *info, ipa_load_from_parm_agg_1 (VEC (ipa_param_descriptor_t, heap) *descriptors,
struct param_analysis_info *parms_ainfo, gimple stmt, struct param_analysis_info *parms_ainfo, gimple stmt,
tree op, int *index_p, HOST_WIDE_INT *offset_p, tree op, int *index_p, HOST_WIDE_INT *offset_p,
bool *by_ref_p) bool *by_ref_p)
...@@ -764,7 +773,7 @@ ipa_load_from_parm_agg_1 (struct ipa_node_params *info, ...@@ -764,7 +773,7 @@ ipa_load_from_parm_agg_1 (struct ipa_node_params *info,
if (DECL_P (base)) if (DECL_P (base))
{ {
int index = ipa_get_param_decl_index (info, base); int index = ipa_get_param_decl_index_1 (descriptors, base);
if (index >= 0 if (index >= 0
&& parm_preserved_before_stmt_p (parms_ainfo ? &parms_ainfo[index] && parm_preserved_before_stmt_p (parms_ainfo ? &parms_ainfo[index]
: NULL, stmt, op)) : NULL, stmt, op))
...@@ -784,7 +793,7 @@ ipa_load_from_parm_agg_1 (struct ipa_node_params *info, ...@@ -784,7 +793,7 @@ ipa_load_from_parm_agg_1 (struct ipa_node_params *info,
if (SSA_NAME_IS_DEFAULT_DEF (TREE_OPERAND (base, 0))) if (SSA_NAME_IS_DEFAULT_DEF (TREE_OPERAND (base, 0)))
{ {
tree parm = SSA_NAME_VAR (TREE_OPERAND (base, 0)); tree parm = SSA_NAME_VAR (TREE_OPERAND (base, 0));
index = ipa_get_param_decl_index (info, parm); index = ipa_get_param_decl_index_1 (descriptors, parm);
} }
else else
{ {
...@@ -804,7 +813,7 @@ ipa_load_from_parm_agg_1 (struct ipa_node_params *info, ...@@ -804,7 +813,7 @@ ipa_load_from_parm_agg_1 (struct ipa_node_params *info,
*/ */
gimple def = SSA_NAME_DEF_STMT (TREE_OPERAND (base, 0)); gimple def = SSA_NAME_DEF_STMT (TREE_OPERAND (base, 0));
index = load_from_unmodified_param (info, parms_ainfo, def); index = load_from_unmodified_param (descriptors, parms_ainfo, def);
} }
if (index >= 0 if (index >= 0
...@@ -826,8 +835,8 @@ ipa_load_from_parm_agg (struct ipa_node_params *info, gimple stmt, ...@@ -826,8 +835,8 @@ ipa_load_from_parm_agg (struct ipa_node_params *info, gimple stmt,
tree op, int *index_p, HOST_WIDE_INT *offset_p, tree op, int *index_p, HOST_WIDE_INT *offset_p,
bool *by_ref_p) bool *by_ref_p)
{ {
return ipa_load_from_parm_agg_1 (info, NULL, stmt, op, index_p, offset_p, return ipa_load_from_parm_agg_1 (info->descriptors, NULL, stmt, op, index_p,
by_ref_p); offset_p, by_ref_p);
} }
/* Given that an actual argument is an SSA_NAME (given in NAME) and is a result /* Given that an actual argument is an SSA_NAME (given in NAME) and is a result
...@@ -900,13 +909,13 @@ compute_complex_assign_jump_func (struct ipa_node_params *info, ...@@ -900,13 +909,13 @@ compute_complex_assign_jump_func (struct ipa_node_params *info,
if (SSA_NAME_IS_DEFAULT_DEF (op1)) if (SSA_NAME_IS_DEFAULT_DEF (op1))
index = ipa_get_param_decl_index (info, SSA_NAME_VAR (op1)); index = ipa_get_param_decl_index (info, SSA_NAME_VAR (op1));
else else
index = load_from_unmodified_param (info, parms_ainfo, index = load_from_unmodified_param (info->descriptors, parms_ainfo,
SSA_NAME_DEF_STMT (op1)); SSA_NAME_DEF_STMT (op1));
tc_ssa = op1; tc_ssa = op1;
} }
else else
{ {
index = load_from_unmodified_param (info, parms_ainfo, stmt); index = load_from_unmodified_param (info->descriptors, parms_ainfo, stmt);
tc_ssa = gimple_assign_lhs (stmt); tc_ssa = gimple_assign_lhs (stmt);
} }
...@@ -1649,7 +1658,7 @@ ipa_analyze_indirect_call_uses (struct cgraph_node *node, ...@@ -1649,7 +1658,7 @@ ipa_analyze_indirect_call_uses (struct cgraph_node *node,
def = SSA_NAME_DEF_STMT (target); def = SSA_NAME_DEF_STMT (target);
if (gimple_assign_single_p (def) if (gimple_assign_single_p (def)
&& ipa_load_from_parm_agg_1 (info, parms_ainfo, def, && ipa_load_from_parm_agg_1 (info->descriptors, parms_ainfo, def,
gimple_assign_rhs1 (def), &index, &offset, gimple_assign_rhs1 (def), &index, &offset,
&by_ref)) &by_ref))
{ {
......
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