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: PING: [PATCH, LTO] add externally_visible attribute when necessary with -fwhole-program and resolution file.


Honza, 

As you suggested, I added "externally_visible_by_resolver" flags only for this purpose. 
The relevant places in ipa.c are updated to check this flag. It passes tests
and is bootstrapped. OK for trunk?

Thanks,
Bingfeng

2010-06-21  Bingfeng Mei <bmei@broadcom.com>

        * lto-symbtab.c (lto_symtab_merge_decls_1): Set
        externally_visible_by_resolver flags for symbols of
        LDPR_PREVAILING_DEF when compiling with -fwhole-program.
        (lto_symtab_resolve_symbols) Use LDPR_PREVAILING_DEF_IRONLY for
	internal resolver.
        * ipa.c (function_and_variable_visibility): Set externally_visible
        flag of varpool_node if externally_visible_by_resolver flag is set.
        (cgraph_externally_visible_p): check externally_visible_by_resolver
        flag.
        * cgraph.h (struct varpool_node): new externally_visible_by_resolver
        flag.  (struct cgraph_local_info): new externally_visible_by_resolver
        flag.
        * cgraph.c (dump_cgraph_node): dump externally_visible_by_resolver
        flag.  (cgraph_clone_node): initialize externally_visible_by_resolver.
        (cgraph_create_virtual_clone): initialize externally_visible_by_resolver.
        * doc/invoke.texi (-fwhole-program option): Change description of
        externally_visible attribute accordingly.
        * doc/extend.texi (externally_visible): Ditto.

> -----Original Message-----
> From: Jan Hubicka [mailto:hubicka@ucw.cz]
> Sent: 18 June 2010 17:39
> To: Bingfeng Mei
> Cc: Jan Hubicka; gcc-patches@gcc.gnu.org; Richard Guenther
> Subject: Re: PING: [PATCH, LTO] add externally_visible attribute when
> necessary with -fwhole-program and resolution file.
> 
> > +  /* Set externally_visible flags for declaration of
> LDPR_PREVAILING_DEF */
> > +  if (flag_whole_program)
> > +    {
> > +      if (prevailing->resolution == LDPR_PREVAILING_DEF)
> > +        {
> > +          if (TREE_CODE (prevailing->decl) == FUNCTION_DECL)
> > +            prevailing->node->local.externally_visible = true;
> > +          else
> > +            prevailing->vnode->externally_visible = true;
> > +        }
> > +      else if (prevailing->resolution == LDPR_PREVAILING_DEF_IRONLY)
> > +        {
> > +          if (TREE_CODE (prevailing->decl) == FUNCTION_DECL)
> > +            prevailing->node->local.externally_visible = false;
> > +          else
> > +            prevailing->vnode->externally_visible = false;
> > +        }
> > +    }
> 
> This is executed only with LTO and -fwhole-program, so you would make
> non-LTO
> -fwhole-program noop.
> >
> > The difference from original code is that when no -fwhole-program
> specified, the true
> > value of externally_visible (from
> pass_ipa_function_and_variable_visibility)
> > will be passed on and not conditionally set to false in
> pass_ipa_whole_program_visibility.
> > But does that matter? Cgraph_externally_visible_p will always return
> true then.
> 
> Without -fwhole-program the visibilities should match, so this is not a
> problem, but we need to keep non-LTO -fwhole-program working.  It seems
> that
> having specific flag for this case is better than trying to play rather
> fragile
> games with setting/preserving the flag based on compliation mode.
> 
> It is useful to know if the symbol is bound from non-LTO object at
> linktime
> also to make hidden symbols to become local when building the final DSO
> even
> without -fwhole-program.
> 
> Honza

Attachment: patch;size=6937;creation-date="Mon,
Description: patch


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