[llvm-dev] Function type within `CallGraphNode` class

Mahesha S via llvm-dev llvm-dev at lists.llvm.org
Sat Feb 13 20:51:54 PST 2021


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>


More information about the llvm-dev mailing list