<html><head><base href="x-msg://1694/"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Nov 29, 2010, at 5:22 PM, huwei8717 wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="margin-top: 10px; margin-right: 10px; margin-bottom: 10px; margin-left: 10px; font-family: verdana; font-size: 10pt; "><div><font size="2">Hi,</font></div><div> </div><div style="text-indent: 2em; ">I have a llvm-pass in hand written by other people. There are following statements that I couldn't understand:</div><div style="text-indent: 2em; "> </div><div style="text-indent: 2em; ">-------------------------------program----------------------------------------------------</div><div style="text-indent: 2em; "><div>...</div><div>if (isa<CallInst>(inst) || isa<InvokeInst>(inst)) {</div><div>    const CallSite cs(inst);</div><div>    if (cs.getCalledFunction() == NULL)</div><div>      return dealAtIndirectCall(cs);</div><div>    else</div><div>      return dealAtDirectCall(cs);</div><div>}</div></div><div style="text-indent: 2em; ">...</div><div style="text-indent: 2em; ">-------------------------------------------------------------------------------------------</div><div style="text-indent: 2em; "> </div><div style="text-indent: 2em; ">My question is:</div><div style="text-indent: 2em; "> </div><div style="text-indent: 2em; ">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?</div></div></span></blockquote><br></div><div>A call to a value of function-pointer type, e.g.</div><div>  void callit(void (*f)()) { f(); }</div><br><div>Virtual calls in C++ would also have no known called function.</div><div><br></div><div>John.</div></body></html>