[LLVMdev] the called function equal NULL

huwei8717 huwei8717 at yahoo.com.cn
Mon Nov 29 17:34:58 PST 2010


Than you John, It's very nice of you.

Best Regards

2010-11-30 



-Wei



发件人: John McCall 
发送时间: 2010-11-30  09:26:17 
收件人: huwei8717 
抄送: llvmdev 
主题: Re: [LLVMdev] the called function equal NULL 
 


On Nov 29, 2010, at 5:22 PM, huwei8717 wrote:


Hi,

I have a llvm-pass in hand written by other people. There are following statements that I couldn't understand:

-------------------------------program----------------------------------------------------
...
if (isa<CallInst>(inst) || isa<InvokeInst>(inst)) {
    const CallSite cs(inst);
    if (cs.getCalledFunction() == NULL)
      return dealAtIndirectCall(cs);
    else
      return dealAtDirectCall(cs);
}
...
-------------------------------------------------------------------------------------------

My question is:

When does the called function equal NULL, could you give an example?  I mean what kind of call in source code could change to this case in llvm-IR, could you give an example?


A call to a value of function-pointer type, e.g.
  void callit(void (*f)()) { f(); }


Virtual calls in C++ would also have no known called function.


John.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20101130/26d78c3a/attachment.html>


More information about the llvm-dev mailing list