aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/LazyCallGraph.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/LazyCallGraph.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/LazyCallGraph.cpp')
-rw-r--r--llvm/lib/Analysis/LazyCallGraph.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/LazyCallGraph.cpp b/llvm/lib/Analysis/LazyCallGraph.cpp
index b54ef31..cdf1d55 100644
--- a/llvm/lib/Analysis/LazyCallGraph.cpp
+++ b/llvm/lib/Analysis/LazyCallGraph.cpp
@@ -1566,6 +1566,15 @@ void LazyCallGraph::removeDeadFunction(Function &F) {
// allocators.
}
+void LazyCallGraph::addNewFunctionIntoSCC(Function &NewF, SCC &C) {
+ Node &CGNode = get(NewF);
+ CGNode.DFSNumber = CGNode.LowLink = -1;
+ CGNode.populate();
+ C.Nodes.push_back(&CGNode);
+ SCCMap[&CGNode] = &C;
+ NodeMap[&NewF] = &CGNode;
+}
+
LazyCallGraph::Node &LazyCallGraph::insertInto(Function &F, Node *&MappedN) {
return *new (MappedN = BPA.Allocate()) Node(*this, F);
}