This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [tree-ssa] Nested functions


In message <20030502013541.GL31208@redhat.com>, Richard Henderson writes:
 >On Thu, May 01, 2003 at 04:25:28PM -0600, law@redhat.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  <ebotcazou@libertysurf.fr>
 >
 >        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.

jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]