[llvm-dev] opt callgraph implementation
Muhui Jiang via llvm-dev
llvm-dev at lists.llvm.org
Sun Oct 14 08:49:58 PDT 2018
Hi
I am looking at the library related to the call graph. I noticed that in
the source code CallGraph.cpp, there is a check inside the function
addToCallGraph.
83 for (BasicBlock &BB : *F)
84 for (Instruction &I : BB) {
85 if (auto CS = CallSite(&I)) {
86 const Function *Callee = CS.getCalledFunction();
87 if (!Callee || !Intrinsic::isLeaf(Callee->getIntrinsicID()))
88 // Indirect calls of intrinsics are not allowed so no need
to check.
89 // We can be more precise here by using TargetArg returned by
90 // Intrinsic::isLeaf.
91 Node->addCalledFunction(CS, CallsExternalNode.get());
92 else if (!Callee->isIntrinsic())
93 Node->addCalledFunction(CS, getOrInsertFunction(Callee));
94 }
95 }
In line 87 and line 92. There are two checks that will add the callee to
the function. Could you please explain in detail why we need these two
different checks. What does Intrinsic mean? Many Thanks
Regards
Muhui
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181014/2b48f847/attachment.html>
More information about the llvm-dev
mailing list