[llvm-dev] Get root node of CallGraph
Kevin Hu via llvm-dev
llvm-dev at lists.llvm.org
Tue Dec 8 12:03:22 PST 2015
The Root pointer in CallGraph represents either the "main" function
CallGraph node, or the ExternalCallingNode, when the main function doesn't
exist in the module.
I don't see a public API to this pointer in the header, but the
Callgraph::print function could print out info for the node, including if
the Root has a function related to it or it's null.
If you want to obtain the Root pointer, you can consult the
In short, while it adds the new node it determine if the new node is main
function. The Root is pointed to main node if and only if there's only one
main node added to CallGraph. It points to ExternalCallingNode when there
are multiple main functions or no main at all.
You can iterate through the CallGraph to get all functions to decide what
Root really is. In this way you should get the same results as what LLVM is
doing right now.
Hope this helps and point out if I miss something.
On Tue, Dec 8, 2015, 10:39 Riyad Parvez via llvm-dev <
llvm-dev at lists.llvm.org> wrote:
> There is a "Root" private member in CallGraph
> <http://llvm.org/docs/doxygen/html/CallGraph_8h_source.html#l00192> class.
> But there is no way to get access to that member. How can I do that? I can
> get CallGraphNode of "main" method. But I am curious is there more cleaner
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev