2007-10-31 03:30:14 +00:00
|
|
|
//===- MachineDominators.cpp - Machine Dominator Calculation --------------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 20:36:04 +00:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2007-10-31 03:30:14 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file implements simple dominator construction algorithms for finding
|
|
|
|
// forward dominators on machine functions.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "llvm/CodeGen/MachineDominators.h"
|
2008-01-04 20:54:55 +00:00
|
|
|
#include "llvm/CodeGen/Passes.h"
|
2007-10-31 03:30:14 +00:00
|
|
|
|
|
|
|
using namespace llvm;
|
|
|
|
|
2009-12-16 00:13:24 +00:00
|
|
|
namespace llvm {
|
2007-10-31 03:30:14 +00:00
|
|
|
TEMPLATE_INSTANTIATION(class DomTreeNodeBase<MachineBasicBlock>);
|
|
|
|
TEMPLATE_INSTANTIATION(class DominatorTreeBase<MachineBasicBlock>);
|
2009-12-16 00:13:24 +00:00
|
|
|
}
|
2007-10-31 03:30:14 +00:00
|
|
|
|
2008-01-05 20:15:42 +00:00
|
|
|
char MachineDominatorTree::ID = 0;
|
|
|
|
|
2010-08-23 17:52:01 +00:00
|
|
|
INITIALIZE_PASS(MachineDominatorTree, "machinedomtree",
|
2010-10-07 22:25:06 +00:00
|
|
|
"MachineDominator Tree Construction", true, true)
|
2008-01-04 20:54:55 +00:00
|
|
|
|
2010-08-06 18:33:48 +00:00
|
|
|
char &llvm::MachineDominatorsID = MachineDominatorTree::ID;
|
2009-01-05 17:59:02 +00:00
|
|
|
|
|
|
|
void MachineDominatorTree::getAnalysisUsage(AnalysisUsage &AU) const {
|
|
|
|
AU.setPreservesAll();
|
|
|
|
MachineFunctionPass::getAnalysisUsage(AU);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool MachineDominatorTree::runOnMachineFunction(MachineFunction &F) {
|
|
|
|
DT->recalculate(F);
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
MachineDominatorTree::MachineDominatorTree()
|
2010-08-06 18:33:48 +00:00
|
|
|
: MachineFunctionPass(ID) {
|
2010-10-19 17:21:58 +00:00
|
|
|
initializeMachineDominatorTreePass(*PassRegistry::getPassRegistry());
|
2009-01-05 17:59:02 +00:00
|
|
|
DT = new DominatorTreeBase<MachineBasicBlock>(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
MachineDominatorTree::~MachineDominatorTree() {
|
|
|
|
delete DT;
|
|
|
|
}
|
|
|
|
|
|
|
|
void MachineDominatorTree::releaseMemory() {
|
|
|
|
DT->releaseMemory();
|
|
|
|
}
|
2009-08-23 05:17:37 +00:00
|
|
|
|
2009-08-23 06:03:38 +00:00
|
|
|
void MachineDominatorTree::print(raw_ostream &OS, const Module*) const {
|
|
|
|
DT->print(OS);
|
2009-08-23 05:17:37 +00:00
|
|
|
}
|