1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 12:41:49 +01:00

[DomPrinter] Add a way to programmatically dump a dot representation.

Differential Revision:  https://reviews.llvm.org/D32145

llvm-svn: 301205
This commit is contained in:
Davide Italiano 2017-04-24 17:48:44 +00:00
parent ad8956d21b
commit 2ab2fd7435
2 changed files with 20 additions and 0 deletions

View File

@ -157,6 +157,10 @@ public:
/// This should only be used for debugging as it aborts the program if the
/// verification fails.
void verifyDomTree() const;
// Pop up a GraphViz/gv window with the Dominator Tree rendered using `dot`.
void viewGraph(const Twine &Name, const Twine &Title);
void viewGraph();
};
//===-------------------------------------

View File

@ -80,6 +80,22 @@ struct DOTGraphTraits<PostDominatorTree*>
};
}
void DominatorTree::viewGraph(const Twine &Name, const Twine &Title) {
#ifndef NDEBUG
ViewGraph(this, Name, false, Title);
#else
errs() << "DomTree dump not available, build with DEBUG\n";
#endif // NDEBUG
}
void DominatorTree::viewGraph() {
#ifndef NDEBUG
this->viewGraph("domtree", "Dominator Tree for function");
#else
errs() << "DomTree dump not available, build with DEBUG\n";
#endif // NDEBUG
}
namespace {
struct DominatorTreeWrapperPassAnalysisGraphTraits {
static DominatorTree *getGraph(DominatorTreeWrapperPass *DTWP) {