[Alignment][NFC] Migrate Instructions to Align
[llvm-core.git] / include / llvm / CodeGen / MachineDominanceFrontier.h
blobf7bbd07a63ab5a82e33a070f1836c5c5fac3581b
1 //===- llvm/CodeGen/MachineDominanceFrontier.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 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_CODEGEN_MACHINEDOMINANCEFRONTIER_H
10 #define LLVM_CODEGEN_MACHINEDOMINANCEFRONTIER_H
12 #include "llvm/Analysis/DominanceFrontier.h"
13 #include "llvm/Analysis/DominanceFrontierImpl.h"
14 #include "llvm/CodeGen/MachineBasicBlock.h"
15 #include "llvm/CodeGen/MachineFunctionPass.h"
16 #include "llvm/Support/GenericDomTree.h"
17 #include <vector>
19 namespace llvm {
21 class MachineDominanceFrontier : public MachineFunctionPass {
22 ForwardDominanceFrontierBase<MachineBasicBlock> Base;
24 public:
25 using DomTreeT = DomTreeBase<MachineBasicBlock>;
26 using DomTreeNodeT = DomTreeNodeBase<MachineBasicBlock>;
27 using DomSetType = DominanceFrontierBase<MachineBasicBlock, false>::DomSetType;
28 using iterator = DominanceFrontierBase<MachineBasicBlock, false>::iterator;
29 using const_iterator =
30 DominanceFrontierBase<MachineBasicBlock, false>::const_iterator;
32 MachineDominanceFrontier(const MachineDominanceFrontier &) = delete;
33 MachineDominanceFrontier &operator=(const MachineDominanceFrontier &) = delete;
35 static char ID;
37 MachineDominanceFrontier();
39 ForwardDominanceFrontierBase<MachineBasicBlock> &getBase() { return Base; }
41 const SmallVectorImpl<MachineBasicBlock *> &getRoots() const {
42 return Base.getRoots();
45 MachineBasicBlock *getRoot() const {
46 return Base.getRoot();
49 bool isPostDominator() const {
50 return Base.isPostDominator();
53 iterator begin() {
54 return Base.begin();
57 const_iterator begin() const {
58 return Base.begin();
61 iterator end() {
62 return Base.end();
65 const_iterator end() const {
66 return Base.end();
69 iterator find(MachineBasicBlock *B) {
70 return Base.find(B);
73 const_iterator find(MachineBasicBlock *B) const {
74 return Base.find(B);
77 iterator addBasicBlock(MachineBasicBlock *BB, const DomSetType &frontier) {
78 return Base.addBasicBlock(BB, frontier);
81 void removeBlock(MachineBasicBlock *BB) {
82 return Base.removeBlock(BB);
85 void addToFrontier(iterator I, MachineBasicBlock *Node) {
86 return Base.addToFrontier(I, Node);
89 void removeFromFrontier(iterator I, MachineBasicBlock *Node) {
90 return Base.removeFromFrontier(I, Node);
93 bool compareDomSet(DomSetType &DS1, const DomSetType &DS2) const {
94 return Base.compareDomSet(DS1, DS2);
97 bool compare(DominanceFrontierBase<MachineBasicBlock, false> &Other) const {
98 return Base.compare(Other);
101 bool runOnMachineFunction(MachineFunction &F) override;
103 void releaseMemory() override;
105 void getAnalysisUsage(AnalysisUsage &AU) const override;
108 } // end namespace llvm
110 #endif // LLVM_CODEGEN_MACHINEDOMINANCEFRONTIER_H