[PATCH] D112690: MachineDominators: Define MachineDomTree type alias

Sameer Sahasrabuddhe via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 27 23:23:42 PDT 2021


sameerds created this revision.
Herald added subscribers: jeroen.dobbelaere, hiraditya.
sameerds requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This is a (very) small move towards making the machine dominators more
aligned with the IR dominators:

- DominatorTree / MachineDomTree is the class holding the dominator tree
- DominatorTreeWrapperPass / MachineDominatorTree is the corresponding (machine) function pass

This alignment will be used by analyses that are designed as templates
that work with LLVM IR as well as Machine IR.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D112690

Files:
  llvm/include/llvm/CodeGen/MachineDominators.h
  llvm/lib/CodeGen/MachineDominators.cpp


Index: llvm/lib/CodeGen/MachineDominators.cpp
===================================================================
--- llvm/lib/CodeGen/MachineDominators.cpp
+++ llvm/lib/CodeGen/MachineDominators.cpp
@@ -73,7 +73,7 @@
 
 void MachineDominatorTree::verifyAnalysis() const {
   if (DT && VerifyMachineDomInfo)
-    if (!DT->verify(DomTreeT::VerificationLevel::Basic)) {
+    if (!DT->verify(MachineDomTree::VerificationLevel::Basic)) {
       errs() << "MachineDominatorTree verification failed\n";
       abort();
     }
Index: llvm/include/llvm/CodeGen/MachineDominators.h
===================================================================
--- llvm/include/llvm/CodeGen/MachineDominators.h
+++ llvm/include/llvm/CodeGen/MachineDominators.h
@@ -36,6 +36,7 @@
 extern template class DominatorTreeBase<MachineBasicBlock, false>; // DomTree
 extern template class DominatorTreeBase<MachineBasicBlock, true>; // PostDomTree
 
+using MachineDomTree = DomTreeBase<MachineBasicBlock>;
 using MachineDomTreeNode = DomTreeNodeBase<MachineBasicBlock>;
 
 //===-------------------------------------
@@ -43,8 +44,6 @@
 /// compute a normal dominator tree.
 ///
 class MachineDominatorTree : public MachineFunctionPass {
-  using DomTreeT = DomTreeBase<MachineBasicBlock>;
-
   /// Helper structure used to hold all the basic blocks
   /// involved in the split of a critical edge.
   struct CriticalEdge {
@@ -67,7 +66,7 @@
   mutable SmallSet<MachineBasicBlock *, 32> NewBBs;
 
   /// The DominatorTreeBase that is used to compute a normal dominator tree.
-  std::unique_ptr<DomTreeT> DT;
+  std::unique_ptr<MachineDomTree> DT;
 
   /// Apply all the recorded critical edges to the DT.
   /// This updates the underlying DT information in a way that uses
@@ -84,8 +83,8 @@
     calculate(MF);
   }
 
-  DomTreeT &getBase() {
-    if (!DT) DT.reset(new DomTreeT());
+  MachineDomTree &getBase() {
+    if (!DT) DT.reset(new MachineDomTree());
     applySplitCriticalEdges();
     return *DT;
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112690.382925.patch
Type: text/x-patch
Size: 1985 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211028/1a86bc8c/attachment.bin>


More information about the llvm-commits mailing list