This is the mail archive of the
mailing list for the GCC project.
Re: [rfc] Whole program optimization
- From: Geoffrey Keating <geoffk at geoffk dot org>
- To: Jan Hubicka <jh at suse dot cz>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: 26 May 2005 18:46:33 -0700
- Subject: Re: [rfc] Whole program optimization
- References: <20050525232400.GC18902@kam.mff.cuni.cz>
Jan Hubicka <email@example.com> writes:
> 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
> 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("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.