This is the mail archive of the gcc@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: problem inserting new function to cgraph


Hi,

On Tue, Jan 29, 2013 at 12:44:07AM -0500, Chassin wrote:
> Hi again , this time i am trying to clone a function then insert it
> with new name
> 

If you want to create a clone of a function including its body, you
probably want to use cgraph_function_versioning.  See how it is used
in ipa-split.c and tree-sra.c for examples how to use it.

It seems to me however that PLUGIN_ALL_IPA_PASSES_END runs prior to
transformation phase of IPA passes (the name is rather unclear in this
regard)... so to do things really properly (so that it works with
LTO), perhaps you should not touch function bodies at this point (they
might not be available).  You can create virtual clones with
cgraph_create_virtual_clone (see its use in ipa-cp.c) but then you'll
need to change their bodies (when they get one of their own as opposed
to a shared one) later, I would guess in PLUGIN_ALL_PASSES_START but I
know next to nothing about plugins, in-gcc passes have an extra
transform phase for that.

On a related note, I see there are no
PLUGIN_ALL_LATE_IPA_PASSES_{START,END} events, even though they might
be quite useful.

Hope this helps, I know it can look complicated,

Martin


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