2014-07-12 23:59:52 +02:00
|
|
|
//===- llvm/CodeGen/MachineDominanceFrontier.h ------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_CODEGEN_MACHINEDOMINANCEFRONTIER_H
|
|
|
|
#define LLVM_CODEGEN_MACHINEDOMINANCEFRONTIER_H
|
|
|
|
|
|
|
|
#include "llvm/Analysis/DominanceFrontier.h"
|
2017-05-25 01:10:29 +02:00
|
|
|
#include "llvm/Analysis/DominanceFrontierImpl.h"
|
2014-07-12 23:59:52 +02:00
|
|
|
#include "llvm/CodeGen/MachineBasicBlock.h"
|
|
|
|
#include "llvm/CodeGen/MachineFunctionPass.h"
|
2017-05-25 01:10:29 +02:00
|
|
|
#include "llvm/Support/GenericDomTree.h"
|
|
|
|
#include <vector>
|
2014-07-12 23:59:52 +02:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
|
|
|
class MachineDominanceFrontier : public MachineFunctionPass {
|
|
|
|
ForwardDominanceFrontierBase<MachineBasicBlock> Base;
|
2017-05-25 01:10:29 +02:00
|
|
|
|
2014-07-12 23:59:52 +02:00
|
|
|
public:
|
2017-07-14 20:26:09 +02:00
|
|
|
using DomTreeT = DomTreeBase<MachineBasicBlock>;
|
|
|
|
using DomTreeNodeT = DomTreeNodeBase<MachineBasicBlock>;
|
|
|
|
using DomSetType = DominanceFrontierBase<MachineBasicBlock, false>::DomSetType;
|
|
|
|
using iterator = DominanceFrontierBase<MachineBasicBlock, false>::iterator;
|
|
|
|
using const_iterator =
|
|
|
|
DominanceFrontierBase<MachineBasicBlock, false>::const_iterator;
|
2014-07-12 23:59:52 +02:00
|
|
|
|
2017-07-14 20:26:09 +02:00
|
|
|
MachineDominanceFrontier(const MachineDominanceFrontier &) = delete;
|
|
|
|
MachineDominanceFrontier &operator=(const MachineDominanceFrontier &) = delete;
|
2014-07-12 23:59:52 +02:00
|
|
|
|
2017-07-14 20:26:09 +02:00
|
|
|
static char ID;
|
2014-07-12 23:59:52 +02:00
|
|
|
|
2017-07-14 20:26:09 +02:00
|
|
|
MachineDominanceFrontier();
|
2014-07-12 23:59:52 +02:00
|
|
|
|
2018-06-25 03:20:21 +02:00
|
|
|
ForwardDominanceFrontierBase<MachineBasicBlock> &getBase() { return Base; }
|
2014-07-12 23:59:52 +02:00
|
|
|
|
2018-06-25 03:20:21 +02:00
|
|
|
const SmallVectorImpl<MachineBasicBlock *> &getRoots() const {
|
2017-07-14 20:26:09 +02:00
|
|
|
return Base.getRoots();
|
2014-07-12 23:59:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
MachineBasicBlock *getRoot() const {
|
|
|
|
return Base.getRoot();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool isPostDominator() const {
|
|
|
|
return Base.isPostDominator();
|
|
|
|
}
|
|
|
|
|
|
|
|
iterator begin() {
|
|
|
|
return Base.begin();
|
|
|
|
}
|
|
|
|
|
|
|
|
const_iterator begin() const {
|
|
|
|
return Base.begin();
|
|
|
|
}
|
|
|
|
|
|
|
|
iterator end() {
|
|
|
|
return Base.end();
|
|
|
|
}
|
|
|
|
|
|
|
|
const_iterator end() const {
|
|
|
|
return Base.end();
|
|
|
|
}
|
|
|
|
|
|
|
|
iterator find(MachineBasicBlock *B) {
|
|
|
|
return Base.find(B);
|
|
|
|
}
|
|
|
|
|
|
|
|
const_iterator find(MachineBasicBlock *B) const {
|
|
|
|
return Base.find(B);
|
|
|
|
}
|
|
|
|
|
|
|
|
iterator addBasicBlock(MachineBasicBlock *BB, const DomSetType &frontier) {
|
|
|
|
return Base.addBasicBlock(BB, frontier);
|
|
|
|
}
|
|
|
|
|
|
|
|
void removeBlock(MachineBasicBlock *BB) {
|
|
|
|
return Base.removeBlock(BB);
|
|
|
|
}
|
|
|
|
|
|
|
|
void addToFrontier(iterator I, MachineBasicBlock *Node) {
|
|
|
|
return Base.addToFrontier(I, Node);
|
|
|
|
}
|
|
|
|
|
|
|
|
void removeFromFrontier(iterator I, MachineBasicBlock *Node) {
|
|
|
|
return Base.removeFromFrontier(I, Node);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool compareDomSet(DomSetType &DS1, const DomSetType &DS2) const {
|
|
|
|
return Base.compareDomSet(DS1, DS2);
|
|
|
|
}
|
|
|
|
|
2017-07-14 20:26:09 +02:00
|
|
|
bool compare(DominanceFrontierBase<MachineBasicBlock, false> &Other) const {
|
2014-07-12 23:59:52 +02:00
|
|
|
return Base.compare(Other);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool runOnMachineFunction(MachineFunction &F) override;
|
|
|
|
|
|
|
|
void releaseMemory() override;
|
|
|
|
|
|
|
|
void getAnalysisUsage(AnalysisUsage &AU) const override;
|
|
|
|
};
|
|
|
|
|
2017-05-25 01:10:29 +02:00
|
|
|
} // end namespace llvm
|
2014-07-12 23:59:52 +02:00
|
|
|
|
2017-05-25 01:10:29 +02:00
|
|
|
#endif // LLVM_CODEGEN_MACHINEDOMINANCEFRONTIER_H
|