diff --git a/llvm/include/llvm/CodeGen/MachineDominators.h b/llvm/include/llvm/CodeGen/MachineDominators.h --- a/llvm/include/llvm/CodeGen/MachineDominators.h +++ b/llvm/include/llvm/CodeGen/MachineDominators.h @@ -80,6 +80,11 @@ public: static char ID; // Pass ID, replacement for typeid + using UpdateType = DomTreeT::UpdateType; + using UpdateKind = DomTreeT::UpdateKind; + static constexpr UpdateKind Insert = UpdateKind::Insert; + static constexpr UpdateKind Delete = UpdateKind::Delete; + MachineDominatorTree(); explicit MachineDominatorTree(MachineFunction &MF) : MachineFunctionPass(ID) { calculate(MF); @@ -221,6 +226,11 @@ return DT->isReachableFromEntry(A); } + void applyUpdates(ArrayRef Updates) { + applySplitCriticalEdges(); + DT->applyUpdates(Updates); + } + void releaseMemory() override; void verifyAnalysis() const override; diff --git a/llvm/include/llvm/CodeGen/MachinePostDominators.h b/llvm/include/llvm/CodeGen/MachinePostDominators.h --- a/llvm/include/llvm/CodeGen/MachinePostDominators.h +++ b/llvm/include/llvm/CodeGen/MachinePostDominators.h @@ -31,6 +31,11 @@ public: static char ID; + using UpdateType = PostDomTreeT::UpdateType; + using UpdateKind = PostDomTreeT::UpdateKind; + static constexpr UpdateKind Insert = UpdateKind::Insert; + static constexpr UpdateKind Delete = UpdateKind::Delete; + MachinePostDominatorTree(); FunctionPass *createMachinePostDominatorTreePass(); @@ -77,6 +82,18 @@ return PDT->findNearestCommonDominator(A, B); } + /// addNewBlock - Add a new node to the dominator tree information. This + /// creates a new node as a child of DomBB dominator node,linking it into + /// the children list of the immediate dominator. + MachineDomTreeNode *addNewBlock(MachineBasicBlock *BB, + MachineBasicBlock *DomBB) { + return PDT->addNewBlock(BB, DomBB); + } + + void applyUpdates(ArrayRef Updates) { + PDT->applyUpdates(Updates); + } + /// Returns the nearest common dominator of the given blocks. /// If that tree node is a virtual root, a nullptr will be returned. MachineBasicBlock *