[LLVMdev] Indirect function call

Andrew Lenharth alenhar2 at cs.uiuc.edu
Mon May 22 07:22:15 PDT 2006


On Mon, 2006-05-22 at 15:33 +0800, 夏一民 wrote:
> But my code does not always works: if the arguments are not pointer,
> CompleteBUDataStructures not records it. So, if you want to find all indirect
> calls, you maybe have to repair CompleteBUDataStructures. :)

Not surprising, CBU is trying to do something entirely different that
what you are.

> If you do not use BUDataStructures, you can do it yourself: find all load/store
> instructions with its destination is function type.

You may want to look at how the call graph builder works.  It finds all
indirect call sites, and also finds all functions whose address escapes
(this is, may be called indirectly).

Finding indirect calls is actually easy, just check if the Op(0) of the
call (or invoke) instruction !isa<Function>.

Andrew





More information about the llvm-dev mailing list