[llvm-dev] Writing Module Pass to modify arguments of a function
Ammar Naqvi via llvm-dev
llvm-dev at lists.llvm.org
Tue Mar 22 23:52:12 PDT 2016
Hi everyone,
I'm struggling on a module pass, my goal is to change the number of
arguments of a function found in the IR( the first function found).
My approach is using a modulepass ,creating a function with exactly one
argument then cloning the first found function using *CloneFunctionInto*;
then i replace uses of the old function using
*Old_func->replaceAllUsesWith(new_Func)*.
I have the end code figured however, I'm stuck at the beginning of the loop
:
*"for (Module::iterator F = M.begin(), e = M.end(); F != e; ++F) {*
* Function *Func=M.getAtIndex(F);"*
Now the problem is there is no such function as getAtIndex, so how do i
know the function i'm currently at so i can use it in the *Old_func*
variable?
If any of you can point me in the right direction, any help is greatly
appreciated, thank you!
Best,
-Ammar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160322/80049d72/attachment.html>
More information about the llvm-dev
mailing list