This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[debuglocus] Inlining and some cfgcleanup locus updates
- From: Andrew MacLeod <amacleod at redhat dot com>
- To: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 24 Mar 2009 11:23:45 -0400
- Subject: [debuglocus] Inlining and some cfgcleanup locus updates
This patch transfers the locus to inlined PHIs and to merged PHIs
during cfgcleanup.
bootstrapped and no new regressions on x86_64-unknown-linux-gnu.
Andrew
2009-03-24 Andrew MacLeod <amacleod@redhat.com>
* tree-cfgcleanup.c (remove_forwarder_block): Propagate phi arg locus.
* tree-inline.c (copy_phis_for_bb): Copy phi source locations.
(setup_one_parameter): Add locus parameter, add to initializer.
(initialize_inlined_parameters, tree_function_versioning): Add locus
parameter to setup_one_parameter call.
Index: tree-cfgcleanup.c
===================================================================
*** tree-cfgcleanup.c (revision 145011)
--- tree-cfgcleanup.c (working copy)
*************** remove_forwarder_block (basic_block bb)
*** 421,427 ****
--- 421,429 ----
gsi_next (&gsi))
{
gimple phi = gsi_stmt (gsi);
+ source_location l = gimple_phi_arg_location (phi, succ->dest_idx);
add_phi_arg (phi, gimple_phi_arg_def (phi, succ->dest_idx), s);
+ gimple_phi_arg_set_location (phi, s->dest_idx, l);
}
}
}
Index: tree-inline.c
===================================================================
*** tree-inline.c (revision 145011)
--- tree-inline.c (working copy)
*************** copy_phis_for_bb (basic_block bb, copy_b
*** 1743,1748 ****
--- 1743,1749 ----
tree res, new_res;
gimple new_phi;
edge new_edge;
+ unsigned x;
phi = gsi_stmt (si);
res = PHI_RESULT (phi);
*************** copy_phis_for_bb (basic_block bb, copy_b
*** 1775,1780 ****
--- 1776,1788 ----
}
add_phi_arg (new_phi, new_arg, new_edge);
}
+ /* Duplicate the locus's on each inlined argument. */
+ for (x = 0; x < gimple_phi_num_args (new_phi); x++)
+ {
+ source_location locus = gimple_phi_arg_location (phi, x);
+ gimple_phi_arg_set_location (new_phi, x, locus);
+ }
+
}
}
}
*************** insert_init_stmt (basic_block bb, gimple
*** 2020,2026 ****
output later. */
static gimple
setup_one_parameter (copy_body_data *id, tree p, tree value, tree fn,
! basic_block bb, tree *vars)
{
gimple init_stmt = NULL;
tree var;
--- 2028,2034 ----
output later. */
static gimple
setup_one_parameter (copy_body_data *id, tree p, tree value, tree fn,
! basic_block bb, tree *vars, source_location call_locus)
{
gimple init_stmt = NULL;
tree var;
*************** setup_one_parameter (copy_body_data *id,
*** 2165,2170 ****
--- 2173,2181 ----
else
init_stmt = gimple_build_assign (var, rhs);
+ /* Set the source location. */
+ gimple_set_location (init_stmt, call_locus);
+
if (bb && init_stmt)
insert_init_stmt (bb, init_stmt);
}
*************** initialize_inlined_parameters (copy_body
*** 2183,2188 ****
--- 2194,2201 ----
tree p;
tree vars = NULL_TREE;
tree static_chain = gimple_call_chain (stmt);
+ source_location locus = gimple_location (stmt);
+
/* Figure out what the parameters are. */
parms = DECL_ARGUMENTS (fn);
*************** initialize_inlined_parameters (copy_body
*** 2192,2199 ****
for (p = parms, i = 0; p; p = TREE_CHAIN (p), i++)
{
tree val;
val = i < gimple_call_num_args (stmt) ? gimple_call_arg (stmt, i) : NULL;
! setup_one_parameter (id, p, val, fn, bb, &vars);
}
/* Initialize the static chain. */
--- 2205,2213 ----
for (p = parms, i = 0; p; p = TREE_CHAIN (p), i++)
{
tree val;
+
val = i < gimple_call_num_args (stmt) ? gimple_call_arg (stmt, i) : NULL;
! setup_one_parameter (id, p, val, fn, bb, &vars, locus);
}
/* Initialize the static chain. */
*************** initialize_inlined_parameters (copy_body
*** 2204,2210 ****
/* No static chain? Seems like a bug in tree-nested.c. */
gcc_assert (static_chain);
! setup_one_parameter (id, p, static_chain, fn, bb, &vars);
}
declare_inline_vars (id->block, vars);
--- 2218,2224 ----
/* No static chain? Seems like a bug in tree-nested.c. */
gcc_assert (static_chain);
! setup_one_parameter (id, p, static_chain, fn, bb, &vars, locus);
}
declare_inline_vars (id->block, vars);
*************** tree_function_versioning (tree old_decl,
*** 4378,4384 ****
init = setup_one_parameter (&id, replace_info->old_tree,
replace_info->new_tree, id.src_fn,
NULL,
! &vars);
if (init)
VEC_safe_push (gimple, heap, init_stmts, init);
}
--- 4392,4399 ----
init = setup_one_parameter (&id, replace_info->old_tree,
replace_info->new_tree, id.src_fn,
NULL,
! &vars,
! UNKNOWN_LOCATION);
if (init)
VEC_safe_push (gimple, heap, init_stmts, init);
}