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