LLVM 19.0.0git
MachineDomTreeUpdater.h
Go to the documentation of this file.
1//===- llvm/CodeGen/MachineDomTreeUpdater.h -----------------------*- C++-*-==//
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 exposes interfaces to post dominance information for
10// target-specific code.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_CODEGEN_MACHINEDOMTREEUPDATER_H
15#define LLVM_CODEGEN_MACHINEDOMTREEUPDATER_H
16
19
20namespace llvm {
21
22class MachinePostDominatorTree;
23
25 : public GenericDomTreeUpdater<MachineDomTreeUpdater, MachineDominatorTree,
26 MachinePostDominatorTree> {
29
30public:
31 using Base =
34 using Base::Base;
35
37
38 ///@{
39 /// \name Mutation APIs
40 ///
41
42 /// Delete DelBB. DelBB will be removed from its Parent and
43 /// erased from available trees if it exists and finally get deleted.
44 /// Under Eager UpdateStrategy, DelBB will be processed immediately.
45 /// Under Lazy UpdateStrategy, DelBB will be queued until a flush event and
46 /// all available trees are up-to-date. Assert if any instruction of DelBB is
47 /// modified while awaiting deletion. When both DT and PDT are nullptrs, DelBB
48 /// will be queued until flush() is called.
49 void deleteBB(MachineBasicBlock *DelBB);
50
51 ///@}
52
53private:
54 /// First remove all the instructions of DelBB and then make sure DelBB has a
55 /// valid terminator instruction which is necessary to have when DelBB still
56 /// has to be inside of its parent Function while awaiting deletion under Lazy
57 /// UpdateStrategy to prevent other routines from asserting the state of the
58 /// IR is inconsistent. Assert if DelBB is nullptr or has predecessors.
59 void validateDeleteBB(MachineBasicBlock *DelBB);
60
61 /// Returns true if at least one MachineBasicBlock is deleted.
62 bool forceFlushDeletedBB();
63};
64
65extern template class GenericDomTreeUpdater<
66 MachineDomTreeUpdater, MachineDominatorTree, MachinePostDominatorTree>;
67
68extern template void
69GenericDomTreeUpdater<MachineDomTreeUpdater, MachineDominatorTree,
70 MachinePostDominatorTree>::recalculate(MachineFunction
71 &MF);
72} // namespace llvm
73#endif // LLVM_CODEGEN_MACHINEDOMTREEUPDATER_H
void flush()
Apply all pending updates to available trees and flush all BasicBlocks awaiting deletion.
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.
Definition: AddressRanges.h:18