questions (fwd)

FYI, this may be useful to others...

    Quick question. I have a CallInst *, how do i know if its a direct
function call or a call via a function pointer?

if (Function *F = dyn_cast<Function>(CI->getOperand(0))) {
  it's a direct call

If it is a function pointer, is it easy to get all the possible
functions that have the signature (i guess the DSGraph would be helpful
here)?

No, there is no easy way. Given a DSGraph, you could ask for the DSNode
corresponding to the function pointer, then get a list of globals in that
node. That would provide the list you need. Note that this is only valid
if the "incomplete" bit is not set on the node. If it is, then you must
assume ALL functions can get called.

-Chris

> If it is a function pointer, is it easy to get all the possible
> functions that have the signature (i guess the DSGraph would be
> helpful here)?

No, there is no easy way. Given a DSGraph, you could ask for
the DSNode corresponding to the function pointer, then get a
list of globals in that node. That would provide the list
you need. Note that this is only valid if the "incomplete"
bit is not set on the node. If it is, then you must assume
ALL functions can get called.

Minor exception: you can exclude functions *with prototypes* that do
not match the type of the function pointer (since, in LLVM, a call to a
function with an incompatible signature would have to be done by first
casting the pointer type).

--Vikram