[LLVMdev] Walking thru CallGraph bottom up

John Criswell jtcriswel at gmail.com
Tue Feb 24 12:29:47 PST 2015


On 2/24/15 2:27 PM, Simone Atzeni wrote:
> Hi all,
>
> I would like to create a Pass that given an IR instruction walks starting from that instruction up to the main function
> to identify all the functions call that have been made to call that instruction.
>
> Is it possible? What kind of Pass should I create?

Yes, it is possible.  I think a ModulePass would be most appropriate, 
though a FunctionPass may be alright.

To get the call graph, you can use LLVM's CallGraph analysis.  If you 
need to handle function pointers more accurately than LLVM's internal 
CallGraph analysis does, you can use DSA's CallGraph analysis (which has 
the same interface but may only work with LLVM 3.2 and earlier LLVM 
releases).

-- John T.

>
> Thanks
> Best,
> Simone
>
> Simone Atzeni
> simone.at at gmail.com
> +1 (801) 696-8373
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev


-- 
John Criswell
Assistant Professor
Department of Computer Science, University of Rochester
http://www.cs.rochester.edu/u/criswell




More information about the llvm-dev mailing list