[LLVMdev] getCalledFunction

Chris Lattner sabre at nondot.org
Mon Aug 29 13:37:21 PDT 2005


On Mon, 29 Aug 2005, Umar Janjua wrote:
> The getCalledFunction on CallInst is returning NULL, although it is (directly)
> calling a function, which is defined in the same file.

...
> the output is.
>
> %tmp.10 = call int (...)* cast (int ()* %releaseLock to int (...)*)( )

This is the problem.  This isn't a direct call, it's a call through a 
cast.  If you run the -instcombine pass, I believe it will clean this up. 
Alternatively, you can prototype releaseLock in your source file properly. 
In C, use:

int releaseLock(void);

not:

int releaseLock();

... which in C are different.

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/




More information about the llvm-dev mailing list