* [PATCH] Minor ipa-prop.c internal interface tweak
@ 2012-11-04 22:32 Martin Jambor
2012-11-05 16:17 ` Jan Hubicka
0 siblings, 1 reply; 2+ messages in thread
From: Martin Jambor @ 2012-11-04 22:32 UTC (permalink / raw)
To: GCC Patches; +Cc: Jan Hubicka
Hi,
in order to use a few functions in the transformation phase of IPA-CP
without computing the whole struct ipa_node_params for the current
function, the following patch makes those functions (or their _1
versions) use just the vector they need.
Bootstrapped and tested on x86_64-linux, needed for the aggregate
IPA-CP.
OK for trunk?
Thanks,
Martin
2012-10-31 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.
Index: src/gcc/ipa-prop.c
===================================================================
--- src.orig/gcc/ipa-prop.c
+++ src/gcc/ipa-prop.c
@@ -64,25 +64,35 @@ static struct cgraph_node_hook_list *fun
/* Return index of the formal whose tree is PTREE in function which corresponds
to INFO. */
-int
-ipa_get_param_decl_index (struct ipa_node_params *info, tree ptree)
+static int
+ipa_get_param_decl_index_1 (VEC (ipa_param_descriptor_t, heap) *descriptors,
+ tree ptree)
{
int i, count;
- count = ipa_get_param_count (info);
+ count = VEC_length (ipa_param_descriptor_t, descriptors);
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 -1;
}
-/* Populate the param_decl field in parameter descriptors of INFO that
- corresponds to NODE. */
+/* Return index of the formal whose tree is PTREE in function which corresponds
+ 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
ipa_populate_param_decls (struct cgraph_node *node,
- struct ipa_node_params *info)
+ VEC (ipa_param_descriptor_t, heap) *descriptors)
{
tree fndecl;
tree fnargs;
@@ -94,8 +104,7 @@ ipa_populate_param_decls (struct cgraph_
param_num = 0;
for (parm = fnargs; parm; parm = DECL_CHAIN (parm))
{
- VEC_index (ipa_param_descriptor_t,
- info->descriptors, param_num).decl = parm;
+ VEC_index (ipa_param_descriptor_t, descriptors, param_num).decl = parm;
param_num++;
}
}
@@ -132,7 +141,7 @@ ipa_initialize_node_params (struct cgrap
{
VEC_safe_grow_cleared (ipa_param_descriptor_t, heap,
info->descriptors, param_count);
- ipa_populate_param_decls (node, info);
+ ipa_populate_param_decls (node, info->descriptors);
}
}
}
@@ -661,7 +670,7 @@ parm_preserved_before_stmt_p (struct par
modified. Otherwise return -1. */
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,
gimple stmt)
{
@@ -675,7 +684,7 @@ load_from_unmodified_param (struct ipa_n
if (TREE_CODE (op1) != PARM_DECL)
return -1;
- index = ipa_get_param_decl_index (info, op1);
+ index = ipa_get_param_decl_index_1 (descriptors, op1);
if (index < 0
|| !parm_preserved_before_stmt_p (parms_ainfo ? &parms_ainfo[index]
: NULL, stmt, op1))
@@ -749,7 +758,7 @@ parm_ref_data_pass_through_p (struct par
reference respectively. */
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,
tree op, int *index_p, HOST_WIDE_INT *offset_p,
bool *by_ref_p)
@@ -763,7 +772,7 @@ ipa_load_from_parm_agg_1 (struct ipa_nod
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
&& parm_preserved_before_stmt_p (parms_ainfo ? &parms_ainfo[index]
: NULL, stmt, op))
@@ -783,7 +792,7 @@ ipa_load_from_parm_agg_1 (struct ipa_nod
if (SSA_NAME_IS_DEFAULT_DEF (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
{
@@ -803,7 +812,7 @@ ipa_load_from_parm_agg_1 (struct ipa_nod
*/
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
@@ -825,8 +834,8 @@ ipa_load_from_parm_agg (struct ipa_node_
tree op, int *index_p, HOST_WIDE_INT *offset_p,
bool *by_ref_p)
{
- return ipa_load_from_parm_agg_1 (info, NULL, stmt, op, index_p, offset_p,
- by_ref_p);
+ return ipa_load_from_parm_agg_1 (info->descriptors, NULL, stmt, op, index_p,
+ offset_p, by_ref_p);
}
/* Given that an actual argument is an SSA_NAME (given in NAME) and is a result
@@ -899,13 +908,13 @@ compute_complex_assign_jump_func (struct
if (SSA_NAME_IS_DEFAULT_DEF (op1))
index = ipa_get_param_decl_index (info, SSA_NAME_VAR (op1));
else
- index = load_from_unmodified_param (info, parms_ainfo,
+ index = load_from_unmodified_param (info->descriptors, parms_ainfo,
SSA_NAME_DEF_STMT (op1));
tc_ssa = op1;
}
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);
}
@@ -1648,7 +1657,7 @@ ipa_analyze_indirect_call_uses (struct c
def = SSA_NAME_DEF_STMT (target);
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,
&by_ref))
{
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Minor ipa-prop.c internal interface tweak
2012-11-04 22:32 [PATCH] Minor ipa-prop.c internal interface tweak Martin Jambor
@ 2012-11-05 16:17 ` Jan Hubicka
0 siblings, 0 replies; 2+ messages in thread
From: Jan Hubicka @ 2012-11-05 16:17 UTC (permalink / raw)
To: GCC Patches, Jan Hubicka
> 2012-10-31 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.
OK.
Thanks,
Honza
> -int
> -ipa_get_param_decl_index (struct ipa_node_params *info, tree ptree)
> +static int
> +ipa_get_param_decl_index_1 (VEC (ipa_param_descriptor_t, heap) *descriptors,
> + tree ptree)
> {
> int i, count;
>
> - count = ipa_get_param_count (info);
> + count = VEC_length (ipa_param_descriptor_t, descriptors);
> 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 -1;
> }
>
> -/* Populate the param_decl field in parameter descriptors of INFO that
> - corresponds to NODE. */
> +/* Return index of the formal whose tree is PTREE in function which corresponds
> + 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);
> +}
I think it would be nice to not have same comment for both functions and explain
the reason why we need _1 variant.
Honza
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-11-05 16:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-04 22:32 [PATCH] Minor ipa-prop.c internal interface tweak Martin Jambor
2012-11-05 16:17 ` Jan Hubicka
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).