[PATCH] D32145: [Dominator] Add a way to dump a `dot` representation of the dominator tree
Davide Italiano via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 24 11:01:52 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL301205: [DomPrinter] Add a way to programmatically dump a dot representation. (authored by davide).
Changed prior to commit:
https://reviews.llvm.org/D32145?vs=95516&id=96429#toc
Repository:
rL LLVM
https://reviews.llvm.org/D32145
Files:
llvm/trunk/include/llvm/IR/Dominators.h
llvm/trunk/lib/Analysis/DomPrinter.cpp
Index: llvm/trunk/lib/Analysis/DomPrinter.cpp
===================================================================
--- llvm/trunk/lib/Analysis/DomPrinter.cpp
+++ llvm/trunk/lib/Analysis/DomPrinter.cpp
@@ -80,6 +80,22 @@
};
}
+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) {
Index: llvm/trunk/include/llvm/IR/Dominators.h
===================================================================
--- llvm/trunk/include/llvm/IR/Dominators.h
+++ llvm/trunk/include/llvm/IR/Dominators.h
@@ -157,6 +157,10 @@
/// 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();
};
//===-------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32145.96429.patch
Type: text/x-patch
Size: 1363 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170424/6abbf58c/attachment.bin>
More information about the llvm-commits
mailing list