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//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_CODEGEN_MACHINEDOMINANCEFRONTIER_H
10#define LLVM_CODEGEN_MACHINEDOMINANCEFRONTIER_H
11
12#include "llvm/Analysis/DominanceFrontier.h"
13#include "llvm/Analysis/DominanceFrontierImpl.h"
14#include "llvm/CodeGen/MachineBasicBlock.h"
15#include "llvm/CodeGen/MachineDominators.h"
16#include "llvm/CodeGen/MachineFunctionPass.h"
17#include "llvm/CodeGen/MachinePassManager.h"
18#include "llvm/Support/GenericDomTree.h"
19
20namespace llvm {
21
22class MachineDominanceFrontier
23 : public DominanceFrontierBase<MachineBasicBlock, false> {
24public:
25 using DomTreeT = DomTreeBase<MachineBasicBlock>;
26 using DomTreeNodeT = DomTreeNodeBase<MachineBasicBlock>;
27 using DomSetType = MachineDominanceFrontier::DomSetType;
28 using iterator = MachineDominanceFrontier::iterator;
29 using const_iterator = MachineDominanceFrontier ::const_iterator;
30
31 MachineDominanceFrontier() = default;
32
33 LLVM_ABI bool invalidate(MachineFunction &F, const PreservedAnalyses &PA,
34 MachineFunctionAnalysisManager::Invalidator &);
35};
36
37class LLVM_ABI MachineDominanceFrontierWrapperPass
38 : public MachineFunctionPass {
39private:
40 MachineDominanceFrontier MDF;
41
42public:
43 MachineDominanceFrontierWrapperPass();
44
45 MachineDominanceFrontierWrapperPass(
46 const MachineDominanceFrontierWrapperPass &) = delete;
47 MachineDominanceFrontierWrapperPass &
48 operator=(const MachineDominanceFrontierWrapperPass &) = delete;
49
50 static char ID;
51
52 bool runOnMachineFunction(MachineFunction &F) override;
53
54 void getAnalysisUsage(AnalysisUsage &AU) const override;
55
56 void releaseMemory() override;
57
58 MachineDominanceFrontier &getMDF() { return MDF; }
59};
60
61class MachineDominanceFrontierAnalysis
62 : public AnalysisInfoMixin<MachineDominanceFrontierAnalysis> {
63 friend AnalysisInfoMixin<MachineDominanceFrontierAnalysis>;
64 static AnalysisKey Key;
65
66public:
67 using Result = MachineDominanceFrontier;
68
69 LLVM_ABI Result run(MachineFunction &MF,
70 MachineFunctionAnalysisManager &MFAM);
71};
72
73} // end namespace llvm
74
75#endif // LLVM_CODEGEN_MACHINEDOMINANCEFRONTIER_H
76