summaryrefslogtreecommitdiff
path: root/lib/Analysis/IteratedDominanceFrontier.cpp
diff options
context:
space:
mode:
authorJakub Kuderski <kubakuderski@gmail.com>2017-07-14 18:26:09 +0000
committerJakub Kuderski <kubakuderski@gmail.com>2017-07-14 18:26:09 +0000
commitcb105529db3efec7d2de569f14fb12987f035405 (patch)
tree7b5d3975e1f2a7127f555a9a547f5c56dc32f51d /lib/Analysis/IteratedDominanceFrontier.cpp
parent1356a150afcb05341b624f0eb933752d9020c6c2 (diff)
[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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308040 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/IteratedDominanceFrontier.cpp')
-rw-r--r--lib/Analysis/IteratedDominanceFrontier.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/Analysis/IteratedDominanceFrontier.cpp b/lib/Analysis/IteratedDominanceFrontier.cpp
index 0e02850df34..3992657417c 100644
--- a/lib/Analysis/IteratedDominanceFrontier.cpp
+++ b/lib/Analysis/IteratedDominanceFrontier.cpp
@@ -17,8 +17,8 @@
#include <queue>
namespace llvm {
-template <class NodeTy>
-void IDFCalculator<NodeTy>::calculate(
+template <class NodeTy, bool IsPostDom>
+void IDFCalculator<NodeTy, IsPostDom>::calculate(
SmallVectorImpl<BasicBlock *> &PHIBlocks) {
// Use a priority queue keyed on dominator tree level so that inserted nodes
// are handled from the bottom of the dominator tree upwards.
@@ -88,6 +88,6 @@ void IDFCalculator<NodeTy>::calculate(
}
}
-template class IDFCalculator<BasicBlock *>;
-template class IDFCalculator<Inverse<BasicBlock *>>;
+template class IDFCalculator<BasicBlock *, false>;
+template class IDFCalculator<Inverse<BasicBlock *>, true>;
}