LLVM 22.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
18
19namespace llvm {
20
23
24template LLVM_EXPORT_TEMPLATE void
27 &MF);
28
31 MachinePostDominatorTree>::applyUpdatesImpl</*IsForward=*/true>();
34 MachinePostDominatorTree>::applyUpdatesImpl</*IsForward=*/false>();
35
36bool MachineDomTreeUpdater::forceFlushDeletedBB() {
37 if (DeletedBBs.empty())
38 return false;
39
40 for (auto *BB : DeletedBBs) {
42 BB->eraseFromParent();
43 }
45 return true;
46}
47
48// The DT and PDT require the nodes related to updates
49// are not deleted when update functions are called.
50// So MachineBasicBlock deletions must be pended when the
51// UpdateStrategy is Lazy. When the UpdateStrategy is
52// Eager, the MachineBasicBlock will be deleted immediately.
54 validateDeleteBB(DelBB);
55 if (Strategy == UpdateStrategy::Lazy) {
56 DeletedBBs.insert(DelBB);
57 return;
58 }
59
60 eraseDelBBNode(DelBB);
61 DelBB->eraseFromParent();
62}
63
64void MachineDomTreeUpdater::validateDeleteBB(MachineBasicBlock *DelBB) {
65 assert(DelBB && "Invalid push_back of nullptr DelBB.");
66 assert(DelBB->pred_empty() && "DelBB has one or more predecessors.");
67}
68
69} // namespace llvm
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
#define LLVM_EXPORT_TEMPLATE
Definition Compiler.h:215
LLVM_ABI void eraseFromParent()
This method unlinks 'this' from the containing function and deletes it.
LLVM_ABI void deleteBB(MachineBasicBlock *DelBB)
Delete DelBB.
DominatorTree Class - Concrete subclass of DominatorTreeBase that is used to compute a normal dominat...
MachinePostDominatorTree - an analysis pass wrapper for DominatorTree used to compute the post-domina...
This is an optimization pass for GlobalISel generic memory operations.