Hassan, Ahmad
2013-Jan-22 16:37 UTC
[LLVMdev] Utility function to identify user defined function
Hi, I would like to ask if LLVM provides a utility function like 'isMallocCall' to check if the 'call' instruction is calling some 'foo' user defined function? If there is no such utility function then I am thinking to do this in the following way: bool testFoo(CallInst *CI) { Function *Callee = CI->getCalledFunction(); if (Callee->getName() == "foo") return true; return false; } Thanks. Cheers, Ahmad -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130122/c153c4cb/attachment.html>
Óscar Fuentes
2013-Jan-22 17:19 UTC
[LLVMdev] Utility function to identify user defined function
"Hassan, Ahmad" <ahmad.hassan at sap.com> writes:> I would like to ask if LLVM provides a utility function like > 'isMallocCall' to check if the 'call' instruction is calling some > 'foo' user defined function? > > If there is no such utility function then I am thinking to do this in > the following way: > > bool testFoo(CallInst *CI) { > Function *Callee = CI->getCalledFunction(); > if (Callee->getName() == "foo") > return true; > return false; > }Depending on the exact meaning of "user defined function" you can check if the function contains any BasicBlock. The method Function::empty() is handy for that.
Hassan, Ahmad
2013-Jan-22 17:29 UTC
[LLVMdev] Utility function to identify user defined function
I am looking for utility function to check if a particular user defined function i.e. foo1, foo2 is called. Cheers, Ahmad -----Original Message----- From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Óscar Fuentes Sent: 22 January 2013 17:20 To: llvmdev at cs.uiuc.edu Subject: Re: [LLVMdev] Utility function to identify user defined function "Hassan, Ahmad" <ahmad.hassan at sap.com> writes:> I would like to ask if LLVM provides a utility function like > 'isMallocCall' to check if the 'call' instruction is calling some > 'foo' user defined function? > > If there is no such utility function then I am thinking to do this in > the following way: > > bool testFoo(CallInst *CI) { > Function *Callee = CI->getCalledFunction(); > if (Callee->getName() == "foo") > return true; > return false; > }Depending on the exact meaning of "user defined function" you can check if the function contains any BasicBlock. The method Function::empty() is handy for that. _______________________________________________ LLVM Developers mailing list LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev