[LLVMdev] Finding call points to a function

Sanjiv Gupta sanjiv.gupta at microchip.com
Wed Sep 9 22:27:53 PDT 2009


Rakesh Komuravelli wrote:
> Hi,
>
> I am writing an LLVM Pass and I would like to know how would I do the 
> following:
>
> 1. I have a function foo, and I need to get all the call points 
> calling this function in each Function of the Module. The only way I 
> can think of is to iterate over the BasicBlocks of each Function, look 
> for all the Call Instructions and check if the called function is foo. 
> I was wondering if there is any other better way to do this.
Write a ModulePass and use CallGraph analysis in that.

>
> 2. Is it possible to distinguish a class method from a non class 
> method while analyzing the emitted LLVM code for a C++ program? 
> Because, I need to interpret the calls made to foo differently in a 
> class method and in a non class method.
>
> Thanks,
> Rakesh
> ------------------------------------------------------------------------
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>   




More information about the llvm-dev mailing list