On Thu, Sep 19, 2019 at 4:27 AM Gary Oblock <gobl...@marvell.com> wrote: > > I'm trying to build new functions on the fly during optimization. > For those of you that have not been following my previous questions, > this is structure reorganization optimization related. For example when > somebody frees an array of type fu, I'd like to build a new > function _reorg_free_fu which does the correct things for a > transformed array of type _reorg_fu. > > I've run across uses of these: > build_fn_decl > gimple_build_call > However, I don't see any code going any further than that. > > Anybody have any ideas about how I can accomplish the rest of > what I need to do? Note, I'll be doing this during LTRANS.
One of the few examples is cgraph_node::expand_thunk where it builds a GIMPLE thunk. The other is in ipa.c, cgraph_build_static_cdtor_1 but using a GENERIC body. Most others do sth like cloning an existing function or moving part of the CFG to a new function. Richard. > Thanks, > > Gary Oblock