LLVM 19.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
15#include "llvm/ADT/SmallSet.h"
19#include <algorithm>
20#include <functional>
21#include <utility>
22
23namespace llvm {
24
25template class GenericDomTreeUpdater<
26 MachineDomTreeUpdater, MachineDominatorTree, MachinePostDominatorTree>;
27
28template void
29GenericDomTreeUpdater<MachineDomTreeUpdater, MachineDominatorTree,
30 MachinePostDominatorTree>::recalculate(MachineFunction
31 &MF);
32
33bool MachineDomTreeUpdater::forceFlushDeletedBB() {
34 if (DeletedBBs.empty())
35 return false;
36
37 for (auto *BB : DeletedBBs) {
39 BB->eraseFromParent();
40 }
42 return true;
43}
44
45// The DT and PDT require the nodes related to updates
46// are not deleted when update functions are called.
47// So MachineBasicBlock deletions must be pended when the
48// UpdateStrategy is Lazy. When the UpdateStrategy is
49// Eager, the MachineBasicBlock will be deleted immediately.
51 validateDeleteBB(DelBB);
52 if (Strategy == UpdateStrategy::Lazy) {
53 DeletedBBs.insert(DelBB);
54 return;
55 }
56
57 eraseDelBBNode(DelBB);
58 DelBB->eraseFromParent();
59}
60
61void MachineDomTreeUpdater::validateDeleteBB(MachineBasicBlock *DelBB) {
62 assert(DelBB && "Invalid push_back of nullptr DelBB.");
63 assert(DelBB->pred_empty() && "DelBB has one or more predecessors.");
64}
65
66} // namespace llvm
This file defines a set of templates that efficiently compute a dominator tree over a generic graph.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines the SmallSet class.
void eraseDelBBNode(BasicBlockT *DelBB)
Erase Basic Block node that has been 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:344
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18