In the TD pass, don't iterate over the scalar map to find the globals, iterate over
[oota-llvm.git] / lib / Analysis / DataStructure / Printer.cpp
index 9902906e19af14056ad03778d0b291e5b29c9dc0..7cea561c1480041a051da12d779c33534fb2d3ca 100644 (file)
 #include "Support/Statistic.h"
 #include <fstream>
 #include <sstream>
-
-namespace llvm {
+using namespace llvm;
 
 // OnlyPrintMain - The DataStructure printer exposes this option to allow
 // printing of only the graph for "main".
 //
 namespace {
   cl::opt<bool> OnlyPrintMain("only-print-main-ds", cl::ReallyHidden);
+  cl::opt<bool> DontPrintAnything("dont-print-ds", cl::ReallyHidden);
   Statistic<> MaxGraphSize   ("dsnode", "Maximum graph size");
   Statistic<> NumFoldedNodes ("dsnode", "Number of folded nodes (in final graph)");
 }
@@ -73,6 +73,7 @@ static std::string getCaption(const DSNode *N, const DSGraph *G) {
   return OS.str();
 }
 
+namespace llvm {
 template<>
 struct DOTGraphTraits<const DSGraph*> : public DefaultDOTGraphTraits {
   static std::string getGraphName(const DSGraph *G) {
@@ -132,12 +133,12 @@ struct DOTGraphTraits<const DSGraph*> : public DefaultDOTGraphTraits {
         else
           Label = I->first->getName() + " ret node";
         // Output the return node...
-        GW.emitSimpleNode((void*)1, "plaintext=circle", Label);
+        GW.emitSimpleNode((void*)I->first, "plaintext=circle", Label);
 
         // Add edge from return node to real destination
         int RetEdgeDest = I->second.getOffset() >> DS::PointerShift;;
         if (RetEdgeDest == 0) RetEdgeDest = -1;
-        GW.emitEdge((void*)1, -1, I->second.getNode(),
+        GW.emitEdge((void*)I->first, -1, I->second.getNode(),
                     RetEdgeDest, "arrowtail=tee,color=gray63");
       }
 
@@ -179,6 +180,7 @@ struct DOTGraphTraits<const DSGraph*> : public DefaultDOTGraphTraits {
     }
   }
 };
+}   // end namespace llvm
 
 void DSNode::print(std::ostream &O, const DSGraph *G) const {
   GraphWriter<const DSGraph *> W(O, G);
@@ -271,15 +273,23 @@ static void printCollection(const Collection &C, std::ostream &O,
 
 // print - Print out the analysis results...
 void LocalDataStructures::print(std::ostream &O, const Module *M) const {
+  if (DontPrintAnything) return;
   printCollection(*this, O, M, "ds.");
 }
 
 void BUDataStructures::print(std::ostream &O, const Module *M) const {
+  if (DontPrintAnything) return;
   printCollection(*this, O, M, "bu.");
 }
 
 void TDDataStructures::print(std::ostream &O, const Module *M) const {
+  if (DontPrintAnything) return;
   printCollection(*this, O, M, "td.");
 }
 
-} // End llvm namespace
+void CompleteBUDataStructures::print(std::ostream &O, const Module *M) const {
+  if (DontPrintAnything) return;
+  printCollection(*this, O, M, "cbu.");
+}
+
+