From b292c22c8de8128b8699dc3247fbf54ee6d49822 Mon Sep 17 00:00:00 2001 From: Jakub Kuderski Date: Fri, 14 Jul 2017 18:26:09 +0000 Subject: [Dominators] Make IsPostDominator a template parameter Summary: DominatorTreeBase used to have IsPostDominators (bool) member to indicate if the tree is a dominator or a postdominator tree. This made it possible to switch between the two 'modes' at runtime, but it isn't used in practice anywhere. This patch makes IsPostDominator a template argument. This way, it is easier to switch between different algorithms at compile-time based on this argument and design external utilities around it. It also makes it impossible to incidentally assign a postdominator tree to a dominator tree (and vice versa), and to further simplify template code in GenericDominatorTreeConstruction. Reviewers: dberlin, sanjoy, davide, grosser Reviewed By: dberlin Subscribers: mzolotukhin, llvm-commits Differential Revision: https://reviews.llvm.org/D35315 llvm-svn: 308040 --- llvm/lib/IR/Dominators.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'llvm/lib/IR/Dominators.cpp') diff --git a/llvm/lib/IR/Dominators.cpp b/llvm/lib/IR/Dominators.cpp index a76f9e9d04c..df475283609 100644 --- a/llvm/lib/IR/Dominators.cpp +++ b/llvm/lib/IR/Dominators.cpp @@ -61,14 +61,20 @@ bool BasicBlockEdge::isSingleEdge() const { //===----------------------------------------------------------------------===// template class llvm::DomTreeNodeBase; -template class llvm::DominatorTreeBase; +template class llvm::DominatorTreeBase; // DomTreeBase +template class llvm::DominatorTreeBase; // PostDomTreeBase template void llvm::DomTreeBuilder::Calculate( DomTreeBuilder::BBDomTree &DT, Function &F); +template void +llvm::DomTreeBuilder::Calculate( + DomTreeBuilder::BBPostDomTree &DT, Function &F); template bool llvm::DomTreeBuilder::Verify( const DomTreeBuilder::BBDomTree &DT); +template bool llvm::DomTreeBuilder::Verify( + const DomTreeBuilder::BBPostDomTree &DT); bool DominatorTree::invalidate(Function &F, const PreservedAnalyses &PA, FunctionAnalysisManager::Invalidator &) { -- cgit v1.2.3