LLVM 20.0.0git
MachineDomTreeUpdater.cpp
Go to the documentation of this file.
1//===- MachineDomTreeUpdater.cpp -----------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file implements the MachineDomTreeUpdater class, which provides a
10// uniform way to update dominator tree related data structures.
11//
12//===----------------------------------------------------------------------===//
13
17
18namespace llvm {
19
20template class GenericDomTreeUpdater<
21 MachineDomTreeUpdater, MachineDominatorTree, MachinePostDominatorTree>;
22
23template void
24GenericDomTreeUpdater<MachineDomTreeUpdater, MachineDominatorTree,
25 MachinePostDominatorTree>::recalculate(MachineFunction
26 &MF);
27
28template void GenericDomTreeUpdater<
29 MachineDomTreeUpdater, MachineDominatorTree,
30 MachinePostDominatorTree>::applyUpdatesImpl</*IsForward=*/true>();
31template void GenericDomTreeUpdater<
32 MachineDomTreeUpdater, MachineDominatorTree,
33 MachinePostDominatorTree>::applyUpdatesImpl</*IsForward=*/false>();
34
35bool MachineDomTreeUpdater::forceFlushDeletedBB() {
36 if (DeletedBBs.empty())
37 return false;
38
39 for (auto *BB : DeletedBBs) {
41 BB->eraseFromParent();
42 }
44 return true;
45}
46
47// The DT and PDT require the nodes related to updates
48// are not deleted when update functions are called.
49// So MachineBasicBlock deletions must be pended when the
50// UpdateStrategy is Lazy. When the UpdateStrategy is
51// Eager, the MachineBasicBlock will be deleted immediately.
53 validateDeleteBB(DelBB);
54 if (Strategy == UpdateStrategy::Lazy) {
55 DeletedBBs.insert(DelBB);
56 return;
57 }
58
59 eraseDelBBNode(DelBB);
60 DelBB->eraseFromParent();
61}
62
63void MachineDomTreeUpdater::validateDeleteBB(MachineBasicBlock *DelBB) {
64 assert(DelBB && "Invalid push_back of nullptr DelBB.");
65 assert(DelBB->pred_empty() && "DelBB has one or more predecessors.");
66}
67
68} // namespace llvm
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
void eraseDelBBNode(BasicBlockT *DelBB)
Erase Basic Block node before it is unlinked from Function in the DomTree and PostDomTree.
void eraseFromParent()
This method unlinks 'this' from the containing function and deletes it.
void deleteBB(MachineBasicBlock *DelBB)
Delete DelBB.
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
Definition: SmallPtrSet.h:384
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18