1 //===- llvm/CodeGen/MachineDominanceFrontier.h ------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_CODEGEN_MACHINEDOMINANCEFRONTIER_H
11 #define LLVM_CODEGEN_MACHINEDOMINANCEFRONTIER_H
13 #include "llvm/Analysis/DominanceFrontier.h"
14 #include "llvm/CodeGen/MachineBasicBlock.h"
15 #include "llvm/CodeGen/MachineFunctionPass.h"
20 class MachineDominanceFrontier : public MachineFunctionPass {
21 ForwardDominanceFrontierBase<MachineBasicBlock> Base;
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;
29 void operator=(const MachineDominanceFrontier &) = delete;
30 MachineDominanceFrontier(const MachineDominanceFrontier &) = delete;
34 MachineDominanceFrontier();
36 DominanceFrontierBase<MachineBasicBlock> &getBase() {
40 inline const std::vector<MachineBasicBlock*> &getRoots() const {
41 return Base.getRoots();
44 MachineBasicBlock *getRoot() const {
45 return Base.getRoot();
48 bool isPostDominator() const {
49 return Base.isPostDominator();
56 const_iterator begin() const {
64 const_iterator end() const {
68 iterator find(MachineBasicBlock *B) {
72 const_iterator find(MachineBasicBlock *B) const {
76 iterator addBasicBlock(MachineBasicBlock *BB, const DomSetType &frontier) {
77 return Base.addBasicBlock(BB, frontier);
80 void removeBlock(MachineBasicBlock *BB) {
81 return Base.removeBlock(BB);
84 void addToFrontier(iterator I, MachineBasicBlock *Node) {
85 return Base.addToFrontier(I, Node);
88 void removeFromFrontier(iterator I, MachineBasicBlock *Node) {
89 return Base.removeFromFrontier(I, Node);
92 bool compareDomSet(DomSetType &DS1, const DomSetType &DS2) const {
93 return Base.compareDomSet(DS1, DS2);
96 bool compare(DominanceFrontierBase<MachineBasicBlock> &Other) const {
97 return Base.compare(Other);
100 bool runOnMachineFunction(MachineFunction &F) override;
102 void releaseMemory() override;
104 void getAnalysisUsage(AnalysisUsage &AU) const override;