[LLVMdev] Utility function to identify user defined function

Hassan, Ahmad ahmad.hassan at sap.com
Tue Jan 22 09:29:03 PST 2013


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




More information about the llvm-dev mailing list