X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FCodeGen%2FMachineDominators.cpp;h=df60cf34b610eb471fc31c8dea50b761612874f1;hb=540b4f6c08a089f487edad2befb7caf98c127ac5;hp=7c521ccb0e86bcfd71920cee2ec106053c427168;hpb=67d65bb69d5cad957cbb6d672dc0b4a19c211a42;p=oota-llvm.git diff --git a/lib/CodeGen/MachineDominators.cpp b/lib/CodeGen/MachineDominators.cpp index 7c521ccb0e8..df60cf34b61 100644 --- a/lib/CodeGen/MachineDominators.cpp +++ b/lib/CodeGen/MachineDominators.cpp @@ -17,13 +17,45 @@ using namespace llvm; +namespace llvm { TEMPLATE_INSTANTIATION(class DomTreeNodeBase); TEMPLATE_INSTANTIATION(class DominatorTreeBase); +} + +char MachineDominatorTree::ID = 0; + +INITIALIZE_PASS(MachineDominatorTree, "machinedomtree", + "MachineDominator Tree Construction", true, true) + +char &llvm::MachineDominatorsID = MachineDominatorTree::ID; + +void MachineDominatorTree::getAnalysisUsage(AnalysisUsage &AU) const { + AU.setPreservesAll(); + MachineFunctionPass::getAnalysisUsage(AU); +} + +bool MachineDominatorTree::runOnMachineFunction(MachineFunction &F) { + CriticalEdgesToSplit.clear(); + NewBBs.clear(); + DT->recalculate(F); -namespace { - char MachineDominatorTree::ID = 0; - RegisterPass - E("machinedomtree", "MachineDominator Tree Construction", true); + return false; } -const PassInfo *llvm::MachineDominatorsID = E.getPassInfo(); +MachineDominatorTree::MachineDominatorTree() + : MachineFunctionPass(ID) { + initializeMachineDominatorTreePass(*PassRegistry::getPassRegistry()); + DT = new DominatorTreeBase(false); +} + +MachineDominatorTree::~MachineDominatorTree() { + delete DT; +} + +void MachineDominatorTree::releaseMemory() { + DT->releaseMemory(); +} + +void MachineDominatorTree::print(raw_ostream &OS, const Module*) const { + DT->print(OS); +}