Add globals graphs to all three passes


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4663 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/DataStructure/Printer.cpp b/lib/Analysis/DataStructure/Printer.cpp
index 962a093..bbd9c2d 100644
--- a/lib/Analysis/DataStructure/Printer.cpp
+++ b/lib/Analysis/DataStructure/Printer.cpp
@@ -181,6 +181,16 @@
       }
     }
 
+  DSGraph &GG = C.getGlobalsGraph();
+  TotalNumNodes  += GG.getGraphSize();
+  TotalCallNodes += GG.getFunctionCalls().size();
+  if (OnlyPrintMain) {
+    GG.writeGraphToFile(O, Prefix+"GlobalsGraph");
+  } else {
+    O << "Skipped Writing '" << Prefix << "GlobalsGraph.dot'... ["
+      << GG.getGraphSize() << "+" << GG.getFunctionCalls().size() << "]\n";
+  }
+
   O << "\nGraphs contain [" << TotalNumNodes << "+" << TotalCallNodes 
     << "] nodes total" << std::endl;
 }