Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
14 | pmbaty | 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/MachineFunctionPass.h" |
||
16 | #include "llvm/Support/GenericDomTree.h" |
||
17 | |||
18 | namespace llvm { |
||
19 | |||
20 | class MachineDominanceFrontier : public MachineFunctionPass { |
||
21 | ForwardDominanceFrontierBase<MachineBasicBlock> Base; |
||
22 | |||
23 | public: |
||
24 | using DomTreeT = DomTreeBase<MachineBasicBlock>; |
||
25 | using DomTreeNodeT = DomTreeNodeBase<MachineBasicBlock>; |
||
26 | using DomSetType = DominanceFrontierBase<MachineBasicBlock, false>::DomSetType; |
||
27 | using iterator = DominanceFrontierBase<MachineBasicBlock, false>::iterator; |
||
28 | using const_iterator = |
||
29 | DominanceFrontierBase<MachineBasicBlock, false>::const_iterator; |
||
30 | |||
31 | MachineDominanceFrontier(const MachineDominanceFrontier &) = delete; |
||
32 | MachineDominanceFrontier &operator=(const MachineDominanceFrontier &) = delete; |
||
33 | |||
34 | static char ID; |
||
35 | |||
36 | MachineDominanceFrontier(); |
||
37 | |||
38 | ForwardDominanceFrontierBase<MachineBasicBlock> &getBase() { return Base; } |
||
39 | |||
40 | const SmallVectorImpl<MachineBasicBlock *> &getRoots() const { |
||
41 | return Base.getRoots(); |
||
42 | } |
||
43 | |||
44 | MachineBasicBlock *getRoot() const { |
||
45 | return Base.getRoot(); |
||
46 | } |
||
47 | |||
48 | bool isPostDominator() const { |
||
49 | return Base.isPostDominator(); |
||
50 | } |
||
51 | |||
52 | iterator begin() { |
||
53 | return Base.begin(); |
||
54 | } |
||
55 | |||
56 | const_iterator begin() const { |
||
57 | return Base.begin(); |
||
58 | } |
||
59 | |||
60 | iterator end() { |
||
61 | return Base.end(); |
||
62 | } |
||
63 | |||
64 | const_iterator end() const { |
||
65 | return Base.end(); |
||
66 | } |
||
67 | |||
68 | iterator find(MachineBasicBlock *B) { |
||
69 | return Base.find(B); |
||
70 | } |
||
71 | |||
72 | const_iterator find(MachineBasicBlock *B) const { |
||
73 | return Base.find(B); |
||
74 | } |
||
75 | |||
76 | iterator addBasicBlock(MachineBasicBlock *BB, const DomSetType &frontier) { |
||
77 | return Base.addBasicBlock(BB, frontier); |
||
78 | } |
||
79 | |||
80 | void removeBlock(MachineBasicBlock *BB) { |
||
81 | return Base.removeBlock(BB); |
||
82 | } |
||
83 | |||
84 | void addToFrontier(iterator I, MachineBasicBlock *Node) { |
||
85 | return Base.addToFrontier(I, Node); |
||
86 | } |
||
87 | |||
88 | void removeFromFrontier(iterator I, MachineBasicBlock *Node) { |
||
89 | return Base.removeFromFrontier(I, Node); |
||
90 | } |
||
91 | |||
92 | bool compareDomSet(DomSetType &DS1, const DomSetType &DS2) const { |
||
93 | return Base.compareDomSet(DS1, DS2); |
||
94 | } |
||
95 | |||
96 | bool compare(DominanceFrontierBase<MachineBasicBlock, false> &Other) const { |
||
97 | return Base.compare(Other); |
||
98 | } |
||
99 | |||
100 | bool runOnMachineFunction(MachineFunction &F) override; |
||
101 | |||
102 | void releaseMemory() override; |
||
103 | |||
104 | void getAnalysisUsage(AnalysisUsage &AU) const override; |
||
105 | }; |
||
106 | |||
107 | } // end namespace llvm |
||
108 | |||
109 | #endif // LLVM_CODEGEN_MACHINEDOMINANCEFRONTIER_H |