[LLVMdev] How to replace a function using llvm?

Duncan Sands baldrick at free.fr
Mon Sep 19 08:39:32 PDT 2011


Hi Shawn,

> I am a newbie and have a question.
>
> Using llvm, I want to change the original function into a new function which
> have an additional pointer argument:
>
> original function: int haha(int n) { .... }
> new function: int haha(int n, *ptr) { ... }
>
> Could you give me a suggestion?

I suggest you look at how lib/Transforms/IPO/ArgumentPromotion.cpp does this
kind of thing.

Best wishes, Duncan.



More information about the llvm-dev mailing list