#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);
- Statistic<> MaxGraphSize ("dsnode", "Maximum graph size");
- Statistic<> NumFoldedNodes ("dsnode", "Number of folded nodes (in final graph)");
+ cl::opt<bool> DontPrintAnything("dont-print-ds", cl::ReallyHidden);
+ Statistic<> MaxGraphSize ("dsa", "Maximum graph size");
+ Statistic<> NumFoldedNodes ("dsa", "Number of folded nodes (in final graph)");
}
void DSNode::dump() const { print(std::cerr, 0); }
return OS.str();
}
+namespace llvm {
template<>
struct DOTGraphTraits<const DSGraph*> : public DefaultDOTGraphTraits {
static std::string getGraphName(const DSGraph *G) {
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");
}
}
}
};
+} // end namespace llvm
void DSNode::print(std::ostream &O, const DSGraph *G) const {
GraphWriter<const DSGraph *> W(O, G);
<< Gr.getGraphSize() << "+" << NumCalls << "]\n";
}
- if (MaxGraphSize < Gr.getNodes().size())
- MaxGraphSize = Gr.getNodes().size();
- for (unsigned i = 0, e = Gr.getNodes().size(); i != e; ++i)
- if (Gr.getNodes()[i]->isNodeCompletelyFolded())
+ unsigned GraphSize = Gr.getGraphSize();
+ if (MaxGraphSize < GraphSize) MaxGraphSize = GraphSize;
+
+ for (DSGraph::node_iterator NI = Gr.node_begin(), E = Gr.node_end();
+ NI != E; ++NI)
+ if ((*NI)->isNodeCompletelyFolded())
++NumFoldedNodes;
}
// 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.");
+}
+
+