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: [rfc] Whole program optimization


Jan Hubicka <jh@suse.cz> writes:

> Hi,
> this patch adds the -fwhole-program command line option that effectivly brings
> all public functions static except for main and those marked with "used"
> attribute.  With --combine it is usefull to make IPA quite more active
> (especially code size wise at a moment, but hopefully performance wise soon
> too).
> 
> There are two issues I would like to discuss before applying the patch.
> I remember that we discussed this with Richard while past and Richard
> argued that ELF visibility flags should be used instead.  I don't have
> archive of the disucssion and I am not quite convinced that this is
> possible (this is quite ortoghonal issue to the visibility outside
> linked object), so if I miss something here, please enlighten me.

I believe that the idea here was that instead of
__attribute__((used)), you would use
__attribute__((visibility("default"))) or
__attribute__((visibility("hidden"))) or
__attribute__((visibility("protected"))).  That is, this new functionality
would be equivalent to saying -fvisibility=internal.

I think this makes more sense.  You can put 'used' on a static
function, the implication is "this gets used from assembly language or
in some other way that the compiler can't see, but inside this file".
I would expect 'used' on an extern function with -fwhole-program to
behave the same way ('used in some way inside this compilation').

It also has the advantage that you can *not* use -fwhole-program, but
annotate specific functions with
__attribute__((visibility("internal"))).  This would be good when
building GCC itself, for instance.

I'm not absolutely wedded to this compared to using a new pair of
attributes, but I think it's much better than using 'used'.

> Other issue is the way of explicitly marking entry point - at the moment I
> reuse attribute "used" as any function marked by this beast can not be properly
> optimized anyway, but it might be usefull to invent new attribute for this
> such as "externally_visible" or so.


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