1 //===- llvm/CodeGen/MachineDominanceFrontier.h ------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLVM_CODEGEN_MACHINEDOMINANCEFRONTIER_H
11 #define LLVM_CODEGEN_MACHINEDOMINANCEFRONTIER_H
12 
13 #include "llvm/Analysis/DominanceFrontier.h"
14 #include "llvm/CodeGen/MachineBasicBlock.h"
15 #include "llvm/CodeGen/MachineFunctionPass.h"
16 
17 
18 namespace llvm {
19 
20 class MachineDominanceFrontier : public MachineFunctionPass {
21   ForwardDominanceFrontierBase<MachineBasicBlock> Base;
22 public:
23   typedef DominatorTreeBase<MachineBasicBlock> DomTreeT;
24   typedef DomTreeNodeBase<MachineBasicBlock> DomTreeNodeT;
25   typedef DominanceFrontierBase<MachineBasicBlock>::DomSetType DomSetType;
26   typedef DominanceFrontierBase<MachineBasicBlock>::iterator iterator;
27   typedef DominanceFrontierBase<MachineBasicBlock>::const_iterator const_iterator;
28 
29   void operator=(const MachineDominanceFrontier &) = delete;
30   MachineDominanceFrontier(const MachineDominanceFrontier &) = delete;
31 
32   static char ID;
33 
34   MachineDominanceFrontier();
35 
getBase()36   DominanceFrontierBase<MachineBasicBlock> &getBase() {
37     return Base;
38   }
39 
getRoots()40   inline const std::vector<MachineBasicBlock*> &getRoots() const {
41     return Base.getRoots();
42   }
43 
getRoot()44   MachineBasicBlock *getRoot() const {
45     return Base.getRoot();
46   }
47 
isPostDominator()48   bool isPostDominator() const {
49     return Base.isPostDominator();
50   }
51 
begin()52   iterator begin() {
53     return Base.begin();
54   }
55 
begin()56   const_iterator begin() const {
57     return Base.begin();
58   }
59 
end()60   iterator end() {
61     return Base.end();
62   }
63 
end()64   const_iterator end() const {
65     return Base.end();
66   }
67 
find(MachineBasicBlock * B)68   iterator find(MachineBasicBlock *B) {
69     return Base.find(B);
70   }
71 
find(MachineBasicBlock * B)72   const_iterator find(MachineBasicBlock *B) const {
73     return Base.find(B);
74   }
75 
addBasicBlock(MachineBasicBlock * BB,const DomSetType & frontier)76   iterator addBasicBlock(MachineBasicBlock *BB, const DomSetType &frontier) {
77     return Base.addBasicBlock(BB, frontier);
78   }
79 
removeBlock(MachineBasicBlock * BB)80   void removeBlock(MachineBasicBlock *BB) {
81     return Base.removeBlock(BB);
82   }
83 
addToFrontier(iterator I,MachineBasicBlock * Node)84   void addToFrontier(iterator I, MachineBasicBlock *Node) {
85     return Base.addToFrontier(I, Node);
86   }
87 
removeFromFrontier(iterator I,MachineBasicBlock * Node)88   void removeFromFrontier(iterator I, MachineBasicBlock *Node) {
89     return Base.removeFromFrontier(I, Node);
90   }
91 
compareDomSet(DomSetType & DS1,const DomSetType & DS2)92   bool compareDomSet(DomSetType &DS1, const DomSetType &DS2) const {
93     return Base.compareDomSet(DS1, DS2);
94   }
95 
compare(DominanceFrontierBase<MachineBasicBlock> & Other)96   bool compare(DominanceFrontierBase<MachineBasicBlock> &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 }
108 
109 #endif
110