Cgraph alias reorg 0/14

Jan Hubicka hubicka@ucw.cz
Wed Jun 8 14:12:00 GMT 2011


Hi,
in the following series of patches I want to reorganize handling of alises in
cgraph infastructure.

The longer term plan is to introduce symbol table into GCC that will be common
base for cgraph, varpool and aliases (i.e. all kinds of symbols we have in
GCC).

Original design of cgraph/varpool was motivated by needs of IPA passes that
sort of don't want to know about existence of multiple symbols defining same
object and thus aliases was not present in the structures.

The implementation of aliases is ackward. We do collect them in alias pairs and
then we mark all aliased symbols as "needed" that is kind of full optimization
barrier for IPA. This produce lousy code and thus we added special case of
same body aliases and thunks for C++ use.

I already changed thunks to be stand alone function, this series is going to do
the same for standard aliases (i.e. function-function aliases that are not
weakrefs). Weakrefs, variable aliases and introduction of symbtab will follow
incremnetally.

The repsentation of function alias is a cgraph_node with node->alias set and
with only one reference of new type IPA_REF_ALIAS pointing to the real
function.

This imply a need for IPA passes to actually understand the aliases.  Most
passes want to simply pretend that edges/references go to the final objects
instead of the alias nodes.  This is hoever not 100% direct transition because
alias can have different visibility than the final function (i.e. one can take
overwritable alias of static or hidden function).

For this reason I added several accestor functions.

cgraph_function_or_thunk_node that for given node walks the chain of aliases
until it finds a real function or thunk node and cgraph_for_node_and_aliases
that takes a callback and calls it on given function and all its alias nodes.

For passes that wants to go through thunks, too, there is
cgraph_for_node_thunks_and_aliases and cgraph_function_node.

The merge plan of this series is as follows:

 - first few fixes and cleanups
 - cgraph_function_or_thunk_node, cgraph_for_node_and_aliases,
   cgraph_for_node_thunks_and_aliases, cgraph_function_node functions that do
   nothing, since they are pointless on current representaiton.
 - update of each of the individual optimizers to use them
 - introduction of the new representation + all the changes that has to
   go along with it.

I've tested the combined patch on x86_64-linux, x86-linux, ppc-linux
by bootstrap/regtest as well as on the Mozilla.

Honza



More information about the Gcc-patches mailing list