This is the mail archive of the
mailing list for the GCC project.
Re: [tree-ssa] Nested functions
- From: law at redhat dot com
- To: Richard Henderson <rth at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 08 May 2003 01:16:01 -0600
- Subject: Re: [tree-ssa] Nested functions
- Reply-to: law at redhat dot com
In message <20030502013541.GL31208@redhat.com>, Richard Henderson writes:
>On Thu, May 01, 2003 at 04:25:28PM -0600, email@example.com wrote:
>> This means that when we find a nested function, we need to mark all
>> variables at the same block nesting level as having a hidden use
>> (since they may be used by the nested function). We must also mark
>> all variables in the containing block nest as having a hidden use.
>If you've merged up to
>2003-04-18 Eric Botcazou <firstname.lastname@example.org>
> PR optimization/7675
> * c-typeck.c (build_external_ref): Set the DECL_NONLOCAL flag
> on VAR_DECL, PARM_DECL and FUNCTION_DECL from within
> nested functions if they refer to declarations from parent functions.
> * stmt.c (expand_decl): Don't put automatic variables in registers
> if the DECL_NONLOCAL flag is set.
>you can omit the hidden use for variables that don't
>have DECL_NONLOCAL set.
Yea, this seems to work pretty well and is less pessimistic than my
code. Probably better compile-time characteristics as well.
>> + for (decl = BLOCK_VARS (block); decl; decl = TREE_CHAIN (decl))
>> + if (TREE_CODE (decl) == VAR_DECL)
>> + set_has_hidden_use (decl);
>Did you forget PARM_DECLs?
Yes. I was thinking in terms of variable removal, where PARM_DECLs are
ignored. However, they probably are important in terms of DCE. The
updated patch (testing now) includes PARM_DECLs.