aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/CallGraph.cpp
diff options
context:
space:
mode:
authorJohannes Doerfert <johannes@jdoerfert.de>2019-11-29 13:11:24 -0600
committerJohannes Doerfert <johannes@jdoerfert.de>2020-02-08 14:16:48 -0600
commit72277ecd62e28a01bb98866c1b15d5f172ed30dc (patch)
treeb44704bc5d6227d472dbeb90dcda2801231ccd1b /llvm/lib/Analysis/CallGraph.cpp
parentf8c9ceb1ce9c71574d413a6391812d46d9f9edb3 (diff)
downloadllvm-72277ecd62e28a01bb98866c1b15d5f172ed30dc.zip
llvm-72277ecd62e28a01bb98866c1b15d5f172ed30dc.tar.gz
llvm-72277ecd62e28a01bb98866c1b15d5f172ed30dc.tar.bz2
Introduce a CallGraph updater helper class
The CallGraphUpdater is a helper that simplifies the process of updating the call graph, both old and new style, while running an CGSCC pass. The uses are contained in different commits, e.g. D70767. More functionality is added as we need it. Reviewed By: modocache, hfinkel Differential Revision: https://reviews.llvm.org/D70927
Diffstat (limited to 'llvm/lib/Analysis/CallGraph.cpp')
-rw-r--r--llvm/lib/Analysis/CallGraph.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/CallGraph.cpp b/llvm/lib/Analysis/CallGraph.cpp
index 99cdf3f..777821c 100644
--- a/llvm/lib/Analysis/CallGraph.cpp
+++ b/llvm/lib/Analysis/CallGraph.cpp
@@ -74,6 +74,12 @@ void CallGraph::addToCallGraph(Function *F) {
if (!F->hasLocalLinkage() || F->hasAddressTaken())
ExternalCallingNode->addCalledFunction(nullptr, Node);
+ populateCallGraphNode(Node);
+}
+
+void CallGraph::populateCallGraphNode(CallGraphNode *Node) {
+ Function *F = Node->getFunction();
+
// If this function is not defined in this translation unit, it could call
// anything.
if (F->isDeclaration() && !F->isIntrinsic())