This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Copy debug info properly in the inliner
- From: Richard Henderson <rth at redhat dot com>
- To: Jan Hubicka <jh at suse dot cz>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sun, 26 Jun 2005 19:39:31 -0700
- Subject: Re: Copy debug info properly in the inliner
- References: <20050624131956.GX8728@kam.mff.cuni.cz>
On Fri, Jun 24, 2005 at 03:19:56PM +0200, Jan Hubicka wrote:
> fn = id->caller;
> - #if 1
> /* FIXME! It shouldn't be so hard to manage blocks. Rebuilding them in
> rest_of_compilation is a good start. */
FIXME is either not accurate or you havn't done your job.
> + /* Copy the whole locks tree and root it in id->block. */
s/ locks/block/
> ! /* If EXPR has block defined, map it to newly constructed block.
> ! (if set previously by remap_block, when saving blocks are not remapped
> ! at all)
> ! When inlining we want EXPRs without block appear in the block
> ! of function call. */
> ! if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (*tp))))
> ! {
> ! splay_tree_node n;
> !
> ! n = splay_tree_lookup (id->decl_map,
> ! (splay_tree_key) TREE_BLOCK (*tp));
> ! if (n)
> ! TREE_BLOCK (*tp) = (tree)n->value;
> ! else if (id->block)
> ! TREE_BLOCK (*tp) = id->block;
> ! }
If the lookup fails, we're putting the stmt into the wrong block.
Surely it should never fail? I'm thinking
tree new_block = id->block;
if (TREE_BLOCK (*tp))
{
splay_tree_node n;
n = splay_tree_lookup (id->decl_map,
(splay_tree_key) TREE_BLOCK (*tp));
gcc_assert (n != NULL);
new_block = (tree) n->value;
}
TREE_BLOCK (*tp) = new_block;
> + /* Add local static vars in this inlined callee to caller. */
> + t_step = id->callee_cfun->unexpanded_var_list;
> + if (id->callee_cfun->saved_unexpanded_var_list)
> + t_step = id->callee_cfun->saved_unexpanded_var_list;
> + for (; t_step; t_step = TREE_CHAIN (t_step))
> + {
> + var = TREE_VALUE (t_step);
> + if (TREE_STATIC (var) && !TREE_ASM_WRITTEN (var))
> + cfun->unexpanded_var_list = tree_cons (NULL_TREE, var,
> + cfun->unexpanded_var_list);
> + else if (TREE_CODE (var) == VAR_DECL || TREE_CODE (var) == PARM_DECL)
> + cfun->unexpanded_var_list = tree_cons (NULL_TREE, remap_decl (var, id),
> + cfun->unexpanded_var_list);
> + }
Comment is no longer accurate, because it's more than local statics.
> + /* Add local static vars in this inlined callee to caller. */
> + for (t_step = id.callee_cfun->unexpanded_var_list;
> + t_step;
> + t_step = TREE_CHAIN (t_step))
> + {
> + tree var = TREE_VALUE (t_step);
> + if (TREE_STATIC (var) && !TREE_ASM_WRITTEN (var))
> + cfun->saved_unexpanded_var_list = tree_cons (NULL_TREE, var,
> + cfun->saved_unexpanded_var_list);
> + else if (TREE_CODE (var) == VAR_DECL || TREE_CODE (var) == PARM_DECL)
> + cfun->saved_unexpanded_var_list = tree_cons (NULL_TREE, remap_decl (var, &id),
> + cfun->saved_unexpanded_var_list);
> + }
Comment is no longer accurate because it has nothing to do with
a callee. Surely here you should be copying the entire list
without further checks.
r~