Heming Cui
2011-Jan-25 07:10 UTC
[LLVMdev] Can CallGraphSCCPass distinguish different function pointer types in CallGraphNode?
Dear folks, I am trying to handle function pointers at call graph, and I found that the CallGraphSCCPass makes function pointers as external node, which is actually an empty CallGraphNode (NULL pointer)? If I want to distinguish the function pointer types in the call graph (and I also want the SCC order in CallGraphSCCPass), can I do that easily? Or I have to inheritate the CallGraphSCCPass and handle function pointer types in the call graph by myself? 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? -- Regards, Heming Cui -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110125/128c2ae7/attachment.html>
Duncan Sands
2011-Mar-01 12:07 UTC
[LLVMdev] Can CallGraphSCCPass distinguish different function pointer types in CallGraphNode?
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.
Maybe Matching Threads
- [LLVMdev] Function::getName in CallGraphSCCPass causes bus error
- [LLVMdev] Function::getName in CallGraphSCCPass causes bus error
- [LLVMdev] Identify recursion in a call graph
- [LLVMdev] CallGraphSCCPass
- [LLVMdev] Fwd: Problem getting LoopInfo inside non-LoopPass