Mahesha S via llvm-dev
2021-Feb-14 04:51 UTC
[llvm-dev] Function type within `CallGraphNode` class
Hi- The llvm call graph infrastructure within the file `llvm/include/llvm/Analysis/CallGraph.h` has a class `CallGraphNode` which represents a unique function (of call graph) by means of a pointer member `Function *F;`. Which basically tells that the call site (if any) associated with `CallGraphNode` actually calls `F`. But in case of an indirect call site, F is actually NULL since no compile time information is available about callee in this case. Here comes the problem. For example, when we collect SCC for a particular `CallGraphNode` (of call graph) for example via `scc_iterator`, we get a set of `CallGraphNode` which are reachable. But, then, `CallGraphNode` representing an indirect call site has completely lost information about `function type` which I think could be avoided if we had explicitly captured it within `CallGraphNode`. Now my questions are: (1) Is there any particular reason for not explicitly capturing function type within `CallGraphNode` which is useful in case of indirect call sites? OR (2) Is it just missed and there is no issue if we will add this facility within `CallGraphNode? OR (3) Am I missing something here which actually makes my asking here a meaningless question? Thanks, Mahesha -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210214/77fe04e6/attachment.html>
Mahesha S via llvm-dev
2021-Feb-14 15:27 UTC
[llvm-dev] Function type within `CallGraphNode` class
Please ignore this email. Later, I myself figured out that to some extent, what I had asked was a meaningless question :( Thanks, Mahesha On Sun, Feb 14, 2021 at 10:21 AM Mahesha S <mahesha.comp at gmail.com> wrote:> Hi- > > The llvm call graph infrastructure within the file > `llvm/include/llvm/Analysis/CallGraph.h` has a class `CallGraphNode` which > represents a unique function (of call graph) by means of a pointer member > `Function *F;`. Which basically tells that the call site (if any) > associated with `CallGraphNode` actually calls `F`. But in case of an > indirect call site, F is actually NULL since no compile time information is > available about callee in this case. Here comes the problem. > > For example, when we collect SCC for a particular `CallGraphNode` (of call > graph) for example via `scc_iterator`, we get a set of `CallGraphNode` > which are reachable. But, then, `CallGraphNode` representing an indirect > call site has completely lost information about `function type` which I > think could be avoided if we had explicitly captured it within > `CallGraphNode`. > > Now my questions are: > > (1) Is there any particular reason for not explicitly capturing function > type within `CallGraphNode` which is useful in case of indirect call sites? > OR > (2) Is it just missed and there is no issue if we will add this facility > within `CallGraphNode? OR > (3) Am I missing something here which actually makes my asking here a > meaningless question? > > Thanks, > Mahesha >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210214/adbadf41/attachment.html>