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/CodeGen/MachinePostDominators.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/CodeGen/MachinePostDominators.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachinePostDominators.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/MachinePostDominators.cpp b/llvm/lib/CodeGen/MachinePostDominators.cpp index c3f6e9249e7..488377998cb 100644 --- a/llvm/lib/CodeGen/MachinePostDominators.cpp +++ b/llvm/lib/CodeGen/MachinePostDominators.cpp @@ -16,6 +16,10 @@ using namespace llvm; +namespace llvm { +template class DominatorTreeBase<MachineBasicBlock, true>; // PostDomTreeBase +} + char MachinePostDominatorTree::ID = 0; //declare initializeMachinePostDominatorTreePass @@ -24,8 +28,7 @@ INITIALIZE_PASS(MachinePostDominatorTree, "machinepostdomtree", MachinePostDominatorTree::MachinePostDominatorTree() : MachineFunctionPass(ID) { initializeMachinePostDominatorTreePass(*PassRegistry::getPassRegistry()); - DT = new DominatorTreeBase<MachineBasicBlock>(true); //true indicate - // postdominator + DT = new PostDomTreeBase<MachineBasicBlock>(); } FunctionPass * |