//===- Printer.cpp - Code for printing data structure graphs nicely -------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file was developed by the LLVM research group and is distributed under
+// the University of Illinois Open Source License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
//
// This file implements the 'dot' graph printer.
//
#include "Support/Statistic.h"
#include <fstream>
#include <sstream>
+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)");
}
-
void DSNode::dump() const { print(std::cerr, 0); }
static std::string getCaption(const DSNode *N, const DSGraph *G) {
M = G->getReturnNodes().begin()->first->getParent();
if (N->isNodeCompletelyFolded())
- OS << "FOLDED";
+ OS << "COLLAPSED";
else {
WriteTypeSymbolic(OS, N->getType(), M);
if (N->isArray())
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);
// 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.");
}
+
+void CompleteBUDataStructures::print(std::ostream &O, const Module *M) const {
+ if (DontPrintAnything) return;
+ printCollection(*this, O, M, "cbu.");
+}
+
+