Add GlobalDSGraph -- a common graph that holds externally visible nodes.
authorVikram S. Adve <vadve@cs.uiuc.edu>
Tue, 30 Jul 2002 22:08:08 +0000 (22:08 +0000)
committerVikram S. Adve <vadve@cs.uiuc.edu>
Tue, 30 Jul 2002 22:08:08 +0000 (22:08 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3173 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/DataStructure/Local.cpp

index 296195cb1f9942a43e6f158aedefd81bfd874284..eb3d5b7374ae804ebb1f293cfe2f5765b4714b3e 100644 (file)
@@ -109,10 +109,14 @@ namespace {
 //===----------------------------------------------------------------------===//
 // DSGraph constructor - Simply use the GraphBuilder to construct the local
 // graph.
-DSGraph::DSGraph(Function &F) : Func(F), RetNode(0) {
-  // Use the graph builder to construct the local version of the graph
-  GraphBuilder B(*this, Nodes, RetNode, ValueMap, FunctionCalls);
-  markIncompleteNodes();
+DSGraph::DSGraph(Function &F, GlobalDSGraph* GlobalsG)
+  : Func(F), RetNode(0), GlobalsGraph(GlobalsG) {
+  if (GlobalsGraph != this) {
+    GlobalsGraph->addReference(this);
+    // Use the graph builder to construct the local version of the graph
+    GraphBuilder B(*this, Nodes, RetNode, ValueMap, FunctionCalls);
+    markIncompleteNodes();
+  }
 }