[LLVMdev] Can CallGraphSCCPass distinguish different function pointer types in CallGraphNode?

Duncan Sands baldrick at free.fr
Tue Mar 1 04:07:37 PST 2011


Hi Heming Cui,

>     For example,
>
> int aa(int i);
>
> int main() {
> int (*foo)(int);
> foo = &aa;
> foo(1);
> }
>
>       If I want to use the CallGraphSCCPass to get to know that the "foo"
> pointer, which is an external node in the CallGraphSCCPass, actually has the
> same function type the same as aa(int), how could I get this type information
> from CallGraphSCCPass?

the CallGraphNode for "main" keeps a list of (call_instruction, called_function)
pairs.  In it you should find the pair ("foo(1)", aa).  You can extract the type
of the callee from the call (or invoke) instruction.

Ciao, Duncan.



More information about the llvm-dev mailing list