From ebd77645cc1c309bd53c382cf462f59d94d0cc63 Mon Sep 17 00:00:00 2001 From: Davide Italiano Date: Mon, 24 Apr 2017 17:48:44 +0000 Subject: [DomPrinter] Add a way to programmatically dump a dot representation. Differential Revision: https://reviews.llvm.org/D32145 llvm-svn: 301205 --- llvm/lib/Analysis/DomPrinter.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'llvm/lib') diff --git a/llvm/lib/Analysis/DomPrinter.cpp b/llvm/lib/Analysis/DomPrinter.cpp index 7acfb41500d..8abc0e7d0df 100644 --- a/llvm/lib/Analysis/DomPrinter.cpp +++ b/llvm/lib/Analysis/DomPrinter.cpp @@ -80,6 +80,22 @@ struct DOTGraphTraits }; } +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) { -- cgit v1.2.3