[llvm] 7dce9eb - [DomPrinter] Migrate -dot-dom to the new pass manager.
Michael Kruse via llvm-commits
llvm-commits at lists.llvm.org
Mon May 16 13:16:20 PDT 2022
Author: Yang Keao
Date: 2022-05-16T15:07:16-05:00
New Revision: 7dce9eb6e507d48d0b79bfb408592936d378cc28
URL: https://github.com/llvm/llvm-project/commit/7dce9eb6e507d48d0b79bfb408592936d378cc28
DIFF: https://github.com/llvm/llvm-project/commit/7dce9eb6e507d48d0b79bfb408592936d378cc28.diff
LOG: [DomPrinter] Migrate -dot-dom to the new pass manager.
In D123677, @YangKeao provided an implementation of `DOTGraphTraits{Viewer,Printer}` in the new pass manager. This commit migrates the `DomPrinter` and `DomViewer` to the new pass manager.
Reviewed By: Meinersbur
Differential Revision: https://reviews.llvm.org/D124904
Added:
Modified:
llvm/include/llvm/Analysis/DomPrinter.h
llvm/include/llvm/Analysis/PostDominators.h
llvm/include/llvm/InitializePasses.h
llvm/include/llvm/LinkAllPasses.h
llvm/lib/Analysis/Analysis.cpp
llvm/lib/Analysis/DomPrinter.cpp
llvm/lib/Passes/PassRegistry.def
Removed:
################################################################################
diff --git a/llvm/include/llvm/Analysis/DomPrinter.h b/llvm/include/llvm/Analysis/DomPrinter.h
index e6df12d880726..5ba717f67403e 100644
--- a/llvm/include/llvm/Analysis/DomPrinter.h
+++ b/llvm/include/llvm/Analysis/DomPrinter.h
@@ -14,30 +14,121 @@
#ifndef LLVM_ANALYSIS_DOMPRINTER_H
#define LLVM_ANALYSIS_DOMPRINTER_H
+#include "llvm/Analysis/DOTGraphTraitsPass.h"
+#include "llvm/Analysis/PostDominators.h"
+#include "llvm/IR/Dominators.h"
#include "llvm/IR/PassManager.h"
namespace llvm {
-class DomTreePrinterPass : public PassInfoMixin<DomTreePrinterPass> {
-public:
- PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+
+template <>
+struct DOTGraphTraits<DomTreeNode *> : public DefaultDOTGraphTraits {
+
+ DOTGraphTraits(bool isSimple = false) : DefaultDOTGraphTraits(isSimple) {}
+
+ std::string getNodeLabel(DomTreeNode *Node, DomTreeNode *Graph) {
+
+ BasicBlock *BB = Node->getBlock();
+
+ if (!BB)
+ return "Post dominance root node";
+
+ if (isSimple())
+ return DOTGraphTraits<DOTFuncInfo *>::getSimpleNodeLabel(BB, nullptr);
+
+ return DOTGraphTraits<DOTFuncInfo *>::getCompleteNodeLabel(BB, nullptr);
+ }
+};
+
+template <>
+struct DOTGraphTraits<DominatorTree *>
+ : public DOTGraphTraits<DomTreeNode *> {
+
+ DOTGraphTraits(bool isSimple = false)
+ : DOTGraphTraits<DomTreeNode *>(isSimple) {}
+
+ static std::string getGraphName(DominatorTree *DT) {
+ return "Dominator tree";
+ }
+
+ std::string getNodeLabel(DomTreeNode *Node, DominatorTree *G) {
+ return DOTGraphTraits<DomTreeNode *>::getNodeLabel(Node,
+ G->getRootNode());
+ }
+};
+
+template<>
+struct DOTGraphTraits<PostDominatorTree *>
+ : public DOTGraphTraits<DomTreeNode*> {
+
+ DOTGraphTraits (bool isSimple=false)
+ : DOTGraphTraits<DomTreeNode*>(isSimple) {}
+
+ static std::string getGraphName(PostDominatorTree *DT) {
+ return "Post dominator tree";
+ }
+
+ std::string getNodeLabel(DomTreeNode *Node,
+ PostDominatorTree *G) {
+ return DOTGraphTraits<DomTreeNode*>::getNodeLabel(Node, G->getRootNode());
+ }
+};
+
+struct DomViewer : public DOTGraphTraitsViewer<DominatorTreeAnalysis, false> {
+ DomViewer() : DOTGraphTraitsViewer<DominatorTreeAnalysis, false>("dom") {}
+};
+
+struct DomOnlyViewer
+ : public DOTGraphTraitsViewer<DominatorTreeAnalysis, true> {
+ DomOnlyViewer()
+ : DOTGraphTraitsViewer<DominatorTreeAnalysis, true>("domonly") {}
+};
+
+struct PostDomViewer
+ : public DOTGraphTraitsViewer<PostDominatorTreeAnalysis, false> {
+ PostDomViewer()
+ : DOTGraphTraitsViewer<PostDominatorTreeAnalysis, false>("postdom") {}
+};
+
+struct PostDomOnlyViewer
+ : public DOTGraphTraitsViewer<PostDominatorTreeAnalysis, true> {
+ PostDomOnlyViewer()
+ : DOTGraphTraitsViewer<PostDominatorTreeAnalysis, true>("postdomonly") {}
+};
+
+struct DomPrinter : public DOTGraphTraitsPrinter<DominatorTreeAnalysis, false> {
+ DomPrinter() : DOTGraphTraitsPrinter<DominatorTreeAnalysis, false>("dom") {}
+};
+
+struct DomOnlyPrinter
+ : public DOTGraphTraitsPrinter<DominatorTreeAnalysis, true> {
+ DomOnlyPrinter()
+ : DOTGraphTraitsPrinter<DominatorTreeAnalysis, true>("domonly") {}
+};
+
+struct PostDomPrinter
+ : public DOTGraphTraitsPrinter<PostDominatorTreeAnalysis, false> {
+ PostDomPrinter()
+ : DOTGraphTraitsPrinter<PostDominatorTreeAnalysis, false>("postdom") {}
};
-class DomTreeOnlyPrinterPass : public PassInfoMixin<DomTreeOnlyPrinterPass> {
-public:
- PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+struct PostDomOnlyPrinter
+ : public DOTGraphTraitsPrinter<PostDominatorTreeAnalysis, true> {
+ PostDomOnlyPrinter()
+ : DOTGraphTraitsPrinter<PostDominatorTreeAnalysis, true>("postdomonly") {}
};
} // namespace llvm
namespace llvm {
class FunctionPass;
- FunctionPass *createDomPrinterPass();
- FunctionPass *createDomOnlyPrinterPass();
- FunctionPass *createDomViewerPass();
- FunctionPass *createDomOnlyViewerPass();
- FunctionPass *createPostDomPrinterPass();
- FunctionPass *createPostDomOnlyPrinterPass();
- FunctionPass *createPostDomViewerPass();
- FunctionPass *createPostDomOnlyViewerPass();
+ FunctionPass *createDomPrinterWrapperPassPass();
+ FunctionPass *createDomOnlyPrinterWrapperPassPass();
+ FunctionPass *createDomViewerWrapperPassPass();
+ FunctionPass *createDomOnlyViewerWrapperPassPass();
+ FunctionPass *createPostDomPrinterWrapperPassPass();
+ FunctionPass *createPostDomOnlyPrinterWrapperPassPass();
+ FunctionPass *createPostDomViewerWrapperPassPass();
+ FunctionPass *createPostDomOnlyViewerWrapperPassPass();
} // End llvm namespace
#endif
diff --git a/llvm/include/llvm/Analysis/PostDominators.h b/llvm/include/llvm/Analysis/PostDominators.h
index 296110d8d03be..4383113c8db11 100644
--- a/llvm/include/llvm/Analysis/PostDominators.h
+++ b/llvm/include/llvm/Analysis/PostDominators.h
@@ -102,10 +102,7 @@ template <> struct GraphTraits<PostDominatorTree*>
}
static nodes_iterator nodes_begin(PostDominatorTree *N) {
- if (getEntryNode(N))
- return df_begin(getEntryNode(N));
- else
- return df_end(getEntryNode(N));
+ return df_begin(getEntryNode(N));
}
static nodes_iterator nodes_end(PostDominatorTree *N) {
diff --git a/llvm/include/llvm/InitializePasses.h b/llvm/include/llvm/InitializePasses.h
index 2ad65a5d51040..704539b91c9c8 100644
--- a/llvm/include/llvm/InitializePasses.h
+++ b/llvm/include/llvm/InitializePasses.h
@@ -132,10 +132,10 @@ void initializeDependenceAnalysisPass(PassRegistry&);
void initializeDependenceAnalysisWrapperPassPass(PassRegistry&);
void initializeDetectDeadLanesPass(PassRegistry&);
void initializeDivRemPairsLegacyPassPass(PassRegistry&);
-void initializeDomOnlyPrinterPass(PassRegistry&);
-void initializeDomOnlyViewerPass(PassRegistry&);
-void initializeDomPrinterPass(PassRegistry&);
-void initializeDomViewerPass(PassRegistry&);
+void initializeDomOnlyPrinterWrapperPassPass(PassRegistry &);
+void initializeDomOnlyViewerWrapperPassPass(PassRegistry &);
+void initializeDomPrinterWrapperPassPass(PassRegistry &);
+void initializeDomViewerWrapperPassPass(PassRegistry &);
void initializeDominanceFrontierWrapperPassPass(PassRegistry&);
void initializeDominatorTreeWrapperPassPass(PassRegistry&);
void initializeDwarfEHPrepareLegacyPassPass(PassRegistry &);
@@ -342,10 +342,10 @@ void initializePhiValuesWrapperPassPass(PassRegistry&);
void initializePhysicalRegisterUsageInfoPass(PassRegistry&);
void initializePlaceBackedgeSafepointsImplPass(PassRegistry&);
void initializePlaceSafepointsPass(PassRegistry&);
-void initializePostDomOnlyPrinterPass(PassRegistry&);
-void initializePostDomOnlyViewerPass(PassRegistry&);
-void initializePostDomPrinterPass(PassRegistry&);
-void initializePostDomViewerPass(PassRegistry&);
+void initializePostDomOnlyPrinterWrapperPassPass(PassRegistry &);
+void initializePostDomOnlyViewerWrapperPassPass(PassRegistry &);
+void initializePostDomPrinterWrapperPassPass(PassRegistry &);
+void initializePostDomViewerWrapperPassPass(PassRegistry &);
void initializePostDominatorTreeWrapperPassPass(PassRegistry&);
void initializePostInlineEntryExitInstrumenterPass(PassRegistry&);
void initializePostMachineSchedulerPass(PassRegistry&);
diff --git a/llvm/include/llvm/LinkAllPasses.h b/llvm/include/llvm/LinkAllPasses.h
index 43b56f1ce3e82..32252b1902b9e 100644
--- a/llvm/include/llvm/LinkAllPasses.h
+++ b/llvm/include/llvm/LinkAllPasses.h
@@ -98,10 +98,10 @@ namespace {
(void) llvm::createDeadCodeEliminationPass();
(void) llvm::createDeadStoreEliminationPass();
(void) llvm::createDependenceAnalysisWrapperPass();
- (void) llvm::createDomOnlyPrinterPass();
- (void) llvm::createDomPrinterPass();
- (void) llvm::createDomOnlyViewerPass();
- (void) llvm::createDomViewerPass();
+ (void) llvm::createDomOnlyPrinterWrapperPassPass();
+ (void) llvm::createDomPrinterWrapperPassPass();
+ (void) llvm::createDomOnlyViewerWrapperPassPass();
+ (void) llvm::createDomViewerWrapperPassPass();
(void) llvm::createInstrProfilingLegacyPass();
(void) llvm::createFunctionImportPass();
(void) llvm::createFunctionInliningPass();
@@ -151,10 +151,10 @@ namespace {
(void) llvm::createPromoteMemoryToRegisterPass();
(void) llvm::createDemoteRegisterToMemoryPass();
(void) llvm::createPruneEHPass();
- (void) llvm::createPostDomOnlyPrinterPass();
- (void) llvm::createPostDomPrinterPass();
- (void) llvm::createPostDomOnlyViewerPass();
- (void) llvm::createPostDomViewerPass();
+ (void)llvm::createPostDomOnlyPrinterWrapperPassPass();
+ (void)llvm::createPostDomPrinterWrapperPassPass();
+ (void)llvm::createPostDomOnlyViewerWrapperPassPass();
+ (void)llvm::createPostDomViewerWrapperPassPass();
(void) llvm::createReassociatePass();
(void) llvm::createRedundantDbgInstEliminationPass();
(void) llvm::createRegionInfoPass();
diff --git a/llvm/lib/Analysis/Analysis.cpp b/llvm/lib/Analysis/Analysis.cpp
index 177f38af13d8b..460dddceaf17a 100644
--- a/llvm/lib/Analysis/Analysis.cpp
+++ b/llvm/lib/Analysis/Analysis.cpp
@@ -40,14 +40,14 @@ void llvm::initializeAnalysis(PassRegistry &Registry) {
initializeDelinearizationPass(Registry);
initializeDemandedBitsWrapperPassPass(Registry);
initializeDominanceFrontierWrapperPassPass(Registry);
- initializeDomViewerPass(Registry);
- initializeDomPrinterPass(Registry);
- initializeDomOnlyViewerPass(Registry);
- initializePostDomViewerPass(Registry);
- initializeDomOnlyPrinterPass(Registry);
- initializePostDomPrinterPass(Registry);
- initializePostDomOnlyViewerPass(Registry);
- initializePostDomOnlyPrinterPass(Registry);
+ initializeDomViewerWrapperPassPass(Registry);
+ initializeDomPrinterWrapperPassPass(Registry);
+ initializeDomOnlyViewerWrapperPassPass(Registry);
+ initializePostDomViewerWrapperPassPass(Registry);
+ initializeDomOnlyPrinterWrapperPassPass(Registry);
+ initializePostDomPrinterWrapperPassPass(Registry);
+ initializePostDomOnlyViewerWrapperPassPass(Registry);
+ initializePostDomOnlyPrinterWrapperPassPass(Registry);
initializeAAResultsWrapperPassPass(Registry);
initializeGlobalsAAWrapperPassPass(Registry);
initializeIVUsersWrapperPassPass(Registry);
diff --git a/llvm/lib/Analysis/DomPrinter.cpp b/llvm/lib/Analysis/DomPrinter.cpp
index 2239790f509a9..e9f5103e12761 100644
--- a/llvm/lib/Analysis/DomPrinter.cpp
+++ b/llvm/lib/Analysis/DomPrinter.cpp
@@ -24,74 +24,6 @@
using namespace llvm;
-namespace llvm {
-template<>
-struct DOTGraphTraits<DomTreeNode*> : public DefaultDOTGraphTraits {
-
- DOTGraphTraits (bool isSimple=false)
- : DefaultDOTGraphTraits(isSimple) {}
-
- std::string getNodeLabel(DomTreeNode *Node, DomTreeNode *Graph) {
-
- BasicBlock *BB = Node->getBlock();
-
- if (!BB)
- return "Post dominance root node";
-
-
- if (isSimple())
- return DOTGraphTraits<DOTFuncInfo *>
- ::getSimpleNodeLabel(BB, nullptr);
- else
- return DOTGraphTraits<DOTFuncInfo *>
- ::getCompleteNodeLabel(BB, nullptr);
- }
-};
-
-template<>
-struct DOTGraphTraits<DominatorTree*> : public DOTGraphTraits<DomTreeNode*> {
-
- DOTGraphTraits (bool isSimple=false)
- : DOTGraphTraits<DomTreeNode*>(isSimple) {}
-
- static std::string getGraphName(DominatorTree *DT) {
- return "Dominator tree";
- }
-
- std::string getNodeLabel(DomTreeNode *Node, DominatorTree *G) {
- return DOTGraphTraits<DomTreeNode*>::getNodeLabel(Node, G->getRootNode());
- }
-};
-
-template<>
-struct DOTGraphTraits<PostDominatorTree*>
- : public DOTGraphTraits<DomTreeNode*> {
-
- DOTGraphTraits (bool isSimple=false)
- : DOTGraphTraits<DomTreeNode*>(isSimple) {}
-
- static std::string getGraphName(PostDominatorTree *DT) {
- return "Post dominator tree";
- }
-
- std::string getNodeLabel(DomTreeNode *Node, PostDominatorTree *G ) {
- return DOTGraphTraits<DomTreeNode*>::getNodeLabel(Node, G->getRootNode());
- }
-};
-}
-
-PreservedAnalyses DomTreePrinterPass::run(Function &F,
- FunctionAnalysisManager &AM) {
- WriteDOTGraphToFile(F, &AM.getResult<DominatorTreeAnalysis>(F), "dom", false);
- return PreservedAnalyses::all();
-}
-
-PreservedAnalyses DomTreeOnlyPrinterPass::run(Function &F,
- FunctionAnalysisManager &AM) {
- WriteDOTGraphToFile(F, &AM.getResult<DominatorTreeAnalysis>(F), "domonly",
- true);
- return PreservedAnalyses::all();
-}
void DominatorTree::viewGraph(const Twine &Name, const Twine &Title) {
#ifndef NDEBUG
@@ -110,162 +42,167 @@ void DominatorTree::viewGraph() {
}
namespace {
-struct DominatorTreeWrapperPassAnalysisGraphTraits {
+struct LegacyDominatorTreeWrapperPassAnalysisGraphTraits {
static DominatorTree *getGraph(DominatorTreeWrapperPass *DTWP) {
return &DTWP->getDomTree();
}
};
-struct DomViewer : public DOTGraphTraitsViewerWrapperPass<
- DominatorTreeWrapperPass, false, DominatorTree *,
- DominatorTreeWrapperPassAnalysisGraphTraits> {
+struct DomViewerWrapperPass
+ : public DOTGraphTraitsViewerWrapperPass<
+ DominatorTreeWrapperPass, false, DominatorTree *,
+ LegacyDominatorTreeWrapperPassAnalysisGraphTraits> {
static char ID;
- DomViewer()
+ DomViewerWrapperPass()
: DOTGraphTraitsViewerWrapperPass<
DominatorTreeWrapperPass, false, DominatorTree *,
- DominatorTreeWrapperPassAnalysisGraphTraits>("dom", ID) {
- initializeDomViewerPass(*PassRegistry::getPassRegistry());
+ LegacyDominatorTreeWrapperPassAnalysisGraphTraits>("dom", ID) {
+ initializeDomViewerWrapperPassPass(*PassRegistry::getPassRegistry());
}
};
-struct DomOnlyViewer : public DOTGraphTraitsViewerWrapperPass<
- DominatorTreeWrapperPass, true, DominatorTree *,
- DominatorTreeWrapperPassAnalysisGraphTraits> {
+struct DomOnlyViewerWrapperPass
+ : public DOTGraphTraitsViewerWrapperPass<
+ DominatorTreeWrapperPass, true, DominatorTree *,
+ LegacyDominatorTreeWrapperPassAnalysisGraphTraits> {
static char ID;
- DomOnlyViewer()
+ DomOnlyViewerWrapperPass()
: DOTGraphTraitsViewerWrapperPass<
DominatorTreeWrapperPass, true, DominatorTree *,
- DominatorTreeWrapperPassAnalysisGraphTraits>("domonly", ID) {
- initializeDomOnlyViewerPass(*PassRegistry::getPassRegistry());
+ LegacyDominatorTreeWrapperPassAnalysisGraphTraits>("domonly", ID) {
+ initializeDomOnlyViewerWrapperPassPass(*PassRegistry::getPassRegistry());
}
};
-struct PostDominatorTreeWrapperPassAnalysisGraphTraits {
+struct LegacyPostDominatorTreeWrapperPassAnalysisGraphTraits {
static PostDominatorTree *getGraph(PostDominatorTreeWrapperPass *PDTWP) {
return &PDTWP->getPostDomTree();
}
};
-struct PostDomViewer
+struct PostDomViewerWrapperPass
: public DOTGraphTraitsViewerWrapperPass<
PostDominatorTreeWrapperPass, false, PostDominatorTree *,
- PostDominatorTreeWrapperPassAnalysisGraphTraits> {
+ LegacyPostDominatorTreeWrapperPassAnalysisGraphTraits> {
static char ID;
- PostDomViewer()
+ PostDomViewerWrapperPass()
: DOTGraphTraitsViewerWrapperPass<
PostDominatorTreeWrapperPass, false, PostDominatorTree *,
- PostDominatorTreeWrapperPassAnalysisGraphTraits>("postdom", ID) {
- initializePostDomViewerPass(*PassRegistry::getPassRegistry());
+ LegacyPostDominatorTreeWrapperPassAnalysisGraphTraits>("postdom",
+ ID) {
+ initializePostDomViewerWrapperPassPass(*PassRegistry::getPassRegistry());
}
};
-struct PostDomOnlyViewer
+struct PostDomOnlyViewerWrapperPass
: public DOTGraphTraitsViewerWrapperPass<
PostDominatorTreeWrapperPass, true, PostDominatorTree *,
- PostDominatorTreeWrapperPassAnalysisGraphTraits> {
+ LegacyPostDominatorTreeWrapperPassAnalysisGraphTraits> {
static char ID;
- PostDomOnlyViewer()
+ PostDomOnlyViewerWrapperPass()
: DOTGraphTraitsViewerWrapperPass<
PostDominatorTreeWrapperPass, true, PostDominatorTree *,
- PostDominatorTreeWrapperPassAnalysisGraphTraits>("postdomonly",
- ID) {
- initializePostDomOnlyViewerPass(*PassRegistry::getPassRegistry());
+ LegacyPostDominatorTreeWrapperPassAnalysisGraphTraits>(
+ "postdomonly", ID) {
+ initializePostDomOnlyViewerWrapperPassPass(
+ *PassRegistry::getPassRegistry());
}
};
} // end anonymous namespace
-char DomViewer::ID = 0;
-INITIALIZE_PASS(DomViewer, "view-dom",
+char DomViewerWrapperPass::ID = 0;
+INITIALIZE_PASS(DomViewerWrapperPass, "view-dom",
"View dominance tree of function", false, false)
-char DomOnlyViewer::ID = 0;
-INITIALIZE_PASS(DomOnlyViewer, "view-dom-only",
+char DomOnlyViewerWrapperPass::ID = 0;
+INITIALIZE_PASS(DomOnlyViewerWrapperPass, "view-dom-only",
"View dominance tree of function (with no function bodies)",
false, false)
-char PostDomViewer::ID = 0;
-INITIALIZE_PASS(PostDomViewer, "view-postdom",
+char PostDomViewerWrapperPass::ID = 0;
+INITIALIZE_PASS(PostDomViewerWrapperPass, "view-postdom",
"View postdominance tree of function", false, false)
-char PostDomOnlyViewer::ID = 0;
-INITIALIZE_PASS(PostDomOnlyViewer, "view-postdom-only",
+char PostDomOnlyViewerWrapperPass::ID = 0;
+INITIALIZE_PASS(PostDomOnlyViewerWrapperPass, "view-postdom-only",
"View postdominance tree of function "
"(with no function bodies)",
false, false)
namespace {
-struct DomPrinter : public DOTGraphTraitsPrinterWrapperPass<
- DominatorTreeWrapperPass, false, DominatorTree *,
- DominatorTreeWrapperPassAnalysisGraphTraits> {
+struct DomPrinterWrapperPass
+ : public DOTGraphTraitsPrinterWrapperPass<
+ DominatorTreeWrapperPass, false, DominatorTree *,
+ LegacyDominatorTreeWrapperPassAnalysisGraphTraits> {
static char ID;
- DomPrinter()
+ DomPrinterWrapperPass()
: DOTGraphTraitsPrinterWrapperPass<
DominatorTreeWrapperPass, false, DominatorTree *,
- DominatorTreeWrapperPassAnalysisGraphTraits>("dom", ID) {
- initializeDomPrinterPass(*PassRegistry::getPassRegistry());
+ LegacyDominatorTreeWrapperPassAnalysisGraphTraits>("dom", ID) {
+ initializeDomPrinterWrapperPassPass(*PassRegistry::getPassRegistry());
}
};
-struct DomOnlyPrinter : public DOTGraphTraitsPrinterWrapperPass<
- DominatorTreeWrapperPass, true, DominatorTree *,
- DominatorTreeWrapperPassAnalysisGraphTraits> {
+struct DomOnlyPrinterWrapperPass
+ : public DOTGraphTraitsPrinterWrapperPass<
+ DominatorTreeWrapperPass, true, DominatorTree *,
+ LegacyDominatorTreeWrapperPassAnalysisGraphTraits> {
static char ID;
- DomOnlyPrinter()
+ DomOnlyPrinterWrapperPass()
: DOTGraphTraitsPrinterWrapperPass<
DominatorTreeWrapperPass, true, DominatorTree *,
- DominatorTreeWrapperPassAnalysisGraphTraits>("domonly", ID) {
- initializeDomOnlyPrinterPass(*PassRegistry::getPassRegistry());
+ LegacyDominatorTreeWrapperPassAnalysisGraphTraits>("domonly", ID) {
+ initializeDomOnlyPrinterWrapperPassPass(*PassRegistry::getPassRegistry());
}
};
-struct PostDomPrinter
+struct PostDomPrinterWrapperPass
: public DOTGraphTraitsPrinterWrapperPass<
PostDominatorTreeWrapperPass, false, PostDominatorTree *,
- PostDominatorTreeWrapperPassAnalysisGraphTraits> {
+ LegacyPostDominatorTreeWrapperPassAnalysisGraphTraits> {
static char ID;
- PostDomPrinter()
+ PostDomPrinterWrapperPass()
: DOTGraphTraitsPrinterWrapperPass<
PostDominatorTreeWrapperPass, false, PostDominatorTree *,
- PostDominatorTreeWrapperPassAnalysisGraphTraits>("postdom", ID) {
- initializePostDomPrinterPass(*PassRegistry::getPassRegistry());
+ LegacyPostDominatorTreeWrapperPassAnalysisGraphTraits>("postdom",
+ ID) {
+ initializePostDomPrinterWrapperPassPass(*PassRegistry::getPassRegistry());
}
};
-struct PostDomOnlyPrinter
+struct PostDomOnlyPrinterWrapperPass
: public DOTGraphTraitsPrinterWrapperPass<
PostDominatorTreeWrapperPass, true, PostDominatorTree *,
- PostDominatorTreeWrapperPassAnalysisGraphTraits> {
+ LegacyPostDominatorTreeWrapperPassAnalysisGraphTraits> {
static char ID;
- PostDomOnlyPrinter()
+ PostDomOnlyPrinterWrapperPass()
: DOTGraphTraitsPrinterWrapperPass<
PostDominatorTreeWrapperPass, true, PostDominatorTree *,
- PostDominatorTreeWrapperPassAnalysisGraphTraits>("postdomonly",
- ID) {
- initializePostDomOnlyPrinterPass(*PassRegistry::getPassRegistry());
+ LegacyPostDominatorTreeWrapperPassAnalysisGraphTraits>(
+ "postdomonly", ID) {
+ initializePostDomOnlyPrinterWrapperPassPass(
+ *PassRegistry::getPassRegistry());
}
};
} // end anonymous namespace
+char DomPrinterWrapperPass::ID = 0;
+INITIALIZE_PASS(DomPrinterWrapperPass, "dot-dom",
+ "Print dominance tree of function to 'dot' file", false, false)
-
-char DomPrinter::ID = 0;
-INITIALIZE_PASS(DomPrinter, "dot-dom",
- "Print dominance tree of function to 'dot' file",
- false, false)
-
-char DomOnlyPrinter::ID = 0;
-INITIALIZE_PASS(DomOnlyPrinter, "dot-dom-only",
+char DomOnlyPrinterWrapperPass::ID = 0;
+INITIALIZE_PASS(DomOnlyPrinterWrapperPass, "dot-dom-only",
"Print dominance tree of function to 'dot' file "
"(with no function bodies)",
false, false)
-char PostDomPrinter::ID = 0;
-INITIALIZE_PASS(PostDomPrinter, "dot-postdom",
- "Print postdominance tree of function to 'dot' file",
- false, false)
+char PostDomPrinterWrapperPass::ID = 0;
+INITIALIZE_PASS(PostDomPrinterWrapperPass, "dot-postdom",
+ "Print postdominance tree of function to 'dot' file", false,
+ false)
-char PostDomOnlyPrinter::ID = 0;
-INITIALIZE_PASS(PostDomOnlyPrinter, "dot-postdom-only",
+char PostDomOnlyPrinterWrapperPass::ID = 0;
+INITIALIZE_PASS(PostDomOnlyPrinterWrapperPass, "dot-postdom-only",
"Print postdominance tree of function to 'dot' file "
"(with no function bodies)",
false, false)
@@ -274,34 +211,34 @@ INITIALIZE_PASS(PostDomOnlyPrinter, "dot-postdom-only",
// "include/llvm/LinkAllPasses.h". Otherwise the pass would be deleted by
// the link time optimization.
-FunctionPass *llvm::createDomPrinterPass() {
- return new DomPrinter();
+FunctionPass *llvm::createDomPrinterWrapperPassPass() {
+ return new DomPrinterWrapperPass();
}
-FunctionPass *llvm::createDomOnlyPrinterPass() {
- return new DomOnlyPrinter();
+FunctionPass *llvm::createDomOnlyPrinterWrapperPassPass() {
+ return new DomOnlyPrinterWrapperPass();
}
-FunctionPass *llvm::createDomViewerPass() {
- return new DomViewer();
+FunctionPass *llvm::createDomViewerWrapperPassPass() {
+ return new DomViewerWrapperPass();
}
-FunctionPass *llvm::createDomOnlyViewerPass() {
- return new DomOnlyViewer();
+FunctionPass *llvm::createDomOnlyViewerWrapperPassPass() {
+ return new DomOnlyViewerWrapperPass();
}
-FunctionPass *llvm::createPostDomPrinterPass() {
- return new PostDomPrinter();
+FunctionPass *llvm::createPostDomPrinterWrapperPassPass() {
+ return new PostDomPrinterWrapperPass();
}
-FunctionPass *llvm::createPostDomOnlyPrinterPass() {
- return new PostDomOnlyPrinter();
+FunctionPass *llvm::createPostDomOnlyPrinterWrapperPassPass() {
+ return new PostDomOnlyPrinterWrapperPass();
}
-FunctionPass *llvm::createPostDomViewerPass() {
- return new PostDomViewer();
+FunctionPass *llvm::createPostDomViewerWrapperPassPass() {
+ return new PostDomViewerWrapperPass();
}
-FunctionPass *llvm::createPostDomOnlyViewerPass() {
- return new PostDomOnlyViewer();
+FunctionPass *llvm::createPostDomOnlyViewerWrapperPassPass() {
+ return new PostDomOnlyViewerWrapperPass();
}
diff --git a/llvm/lib/Passes/PassRegistry.def b/llvm/lib/Passes/PassRegistry.def
index a1f422874e359..bb839c7cee6ff 100644
--- a/llvm/lib/Passes/PassRegistry.def
+++ b/llvm/lib/Passes/PassRegistry.def
@@ -267,8 +267,14 @@ FUNCTION_PASS("div-rem-pairs", DivRemPairsPass())
FUNCTION_PASS("dse", DSEPass())
FUNCTION_PASS("dot-cfg", CFGPrinterPass())
FUNCTION_PASS("dot-cfg-only", CFGOnlyPrinterPass())
-FUNCTION_PASS("dot-dom", DomTreePrinterPass())
-FUNCTION_PASS("dot-dom-only", DomTreeOnlyPrinterPass())
+FUNCTION_PASS("dot-dom", DomPrinter())
+FUNCTION_PASS("dot-dom-only", DomOnlyPrinter())
+FUNCTION_PASS("dot-post-dom", PostDomPrinter())
+FUNCTION_PASS("dot-post-dom-only", PostDomOnlyPrinter())
+FUNCTION_PASS("view-dom", DomViewer())
+FUNCTION_PASS("view-dom-only", DomOnlyViewer())
+FUNCTION_PASS("view-post-dom", PostDomViewer())
+FUNCTION_PASS("view-post-dom-only", PostDomOnlyViewer())
FUNCTION_PASS("fix-irreducible", FixIrreduciblePass())
FUNCTION_PASS("flattencfg", FlattenCFGPass())
FUNCTION_PASS("make-guards-explicit", MakeGuardsExplicitPass())
More information about the llvm-commits
mailing list