[LLVMdev] Clone a function and change signature

Arushi Aggarwal arushi987 at gmail.com
Wed Feb 23 15:58:50 PST 2011


Thanks a lot. That worked.

Arushi

On Tue, Feb 22, 2011 at 2:43 PM, Chris Lattner <clattner at apple.com> wrote:

>
> On Feb 22, 2011, at 11:46 AM, John Criswell wrote:
>
> > On 2/22/11 1:31 PM, Arushi Aggarwal wrote:
> >> Hi,
> >>
> >> I want to clone a given function, and add an argument to it. I then
> >> want to add a call to that new function. I have a callInstruction CI,
> >> which I want to transform to call this new function, and to take a new
> >> argument.
> >
> > If I understand correctly, you're cloning the function first and then
> > adding a new argument to the clone.  Do I understand correctly?
> >
> > If so, I don't believe you can do that.  IIRC, you have to first create
> > a new, empty function with the additional argument and then use
> > CloneFunctionInto() to clone the body of the original function into the
> > new function.  I believe that's what poolalloc does and what I did the
> > last time I had to add function arguments to a function.
>
> Right, you can also take a look at the dead argument elimination or
> argument promotion passes for examples.
>
> -Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110223/ed9b5f69/attachment.html>


More information about the llvm-dev mailing list