This is the mail archive of the
mailing list for the GCC project.
Re: At linktime, consider linkonces as ones that will go away
> On Thu, 8 Jul 2010, Jan Hubicka wrote:
> > The patch probaby has longest function name I ever invented, but I can't
> > think of something shorter that would not be unreadable.
> The _from_program seems superfluous, _will_be --> _p, _if_no_direct_calls
> also seems superfluous (it's IMO not so important why it will be removed,
> only that it is, for the why you always can look at that functions
> definition). Hence, how about cgraph_removed_p, or if too concise maybe
> cgraph_removed_from_program_p ?
Well, there are several situations each stubbly different. I concluded things
will be cleaner if the checks will be hidden in predicates with nice descriptive
names, so I ended up with the following:
cgraph_only_called_directly_p when we know function is only called directly
and we see all the calls. I.e. it is not having address taken, not externally
visible and not used in funnny way (alias, __attribute__ ((used)) etc.).
Such functions go away when all direct calls disappear.
This is used for deciding when function is local and some other cases.
Then we have cgraph_can_remove_if_no_direct_calls_p that in addition
knows that COMDAT functions can disappear even when they can be called
in hidden way from other unit if they are there. This is used i.e. by
inliner to decide whether offline copy is needed after all calls are inlined.
Then there is cgraph_can_remove_if_no_direct_calls_and_refs_p that
is stronger by not checking for addresses taken and is used by unreachable
And finally we have new predicate that is somewhere in between these two.
So cgraph_removed_p name does not make it very clear how that predicate
differs from other. Also it is not removed from program at the timewe call
it, only will be removed as consequence of transformation and unreachable
function removal later...
I will be happy to rename existing predicates too :))