diff options
author | Jakub Kuderski <kubakuderski@gmail.com> | 2017-07-14 18:26:09 +0000 |
---|---|---|
committer | Jakub Kuderski <kubakuderski@gmail.com> | 2017-07-14 18:26:09 +0000 |
commit | b292c22c8de8128b8699dc3247fbf54ee6d49822 (patch) | |
tree | 59ad52f8d1246826cae29c406a4fc4d8c6d4df2a /llvm/lib/Analysis/IteratedDominanceFrontier.cpp | |
parent | 5b27072f5719fddfde10dba5d8b6365f32ad0356 (diff) | |
download | bcm5719-llvm-b292c22c8de8128b8699dc3247fbf54ee6d49822.tar.gz bcm5719-llvm-b292c22c8de8128b8699dc3247fbf54ee6d49822.zip |
[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
Diffstat (limited to 'llvm/lib/Analysis/IteratedDominanceFrontier.cpp')
-rw-r--r-- | llvm/lib/Analysis/IteratedDominanceFrontier.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Analysis/IteratedDominanceFrontier.cpp b/llvm/lib/Analysis/IteratedDominanceFrontier.cpp index 0e02850df34..3992657417c 100644 --- a/llvm/lib/Analysis/IteratedDominanceFrontier.cpp +++ b/llvm/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>; } |