[ValueTracking] Move GlobalAlias handling to be after the max depth check in computeK...
[oota-llvm.git] / lib / CodeGen / MachineDominators.cpp
index f7820484376c0eb3c6855bf17375e0b3d5f7821b..df60cf34b610eb471fc31c8dea50b761612874f1 100644 (file)
 
 using namespace llvm;
 
+namespace llvm {
 TEMPLATE_INSTANTIATION(class DomTreeNodeBase<MachineBasicBlock>);
 TEMPLATE_INSTANTIATION(class DominatorTreeBase<MachineBasicBlock>);
+}
 
 char MachineDominatorTree::ID = 0;
 
-static RegisterPass<MachineDominatorTree>
-E("machinedomtree", "MachineDominator Tree Construction", true);
+INITIALIZE_PASS(MachineDominatorTree, "machinedomtree",
+                "MachineDominator Tree Construction", true, true)
 
-const PassInfo *const llvm::MachineDominatorsID = &E;
+char &llvm::MachineDominatorsID = MachineDominatorTree::ID;
 
 void MachineDominatorTree::getAnalysisUsage(AnalysisUsage &AU) const {
   AU.setPreservesAll();
@@ -33,21 +35,27 @@ void MachineDominatorTree::getAnalysisUsage(AnalysisUsage &AU) const {
 }
 
 bool MachineDominatorTree::runOnMachineFunction(MachineFunction &F) {
+  CriticalEdgesToSplit.clear();
+  NewBBs.clear();
   DT->recalculate(F);
 
   return false;
 }
 
 MachineDominatorTree::MachineDominatorTree()
-    : MachineFunctionPass(intptr_t(&ID)) {
+    : MachineFunctionPass(ID) {
+  initializeMachineDominatorTreePass(*PassRegistry::getPassRegistry());
   DT = new DominatorTreeBase<MachineBasicBlock>(false);
 }
 
 MachineDominatorTree::~MachineDominatorTree() {
-  DT->releaseMemory();
   delete DT;
 }
 
 void MachineDominatorTree::releaseMemory() {
   DT->releaseMemory();
 }
+
+void MachineDominatorTree::print(raw_ostream &OS, const Module*) const {
+  DT->print(OS);
+}