Change over to use new style pass mechanism, now passes only expose small
[oota-llvm.git] / lib / Transforms / Scalar / ADCE.cpp
index 91bed41f6c338ce932d2fb98e783c9d6dfb5b6a1..14c68f410e1e1a1c52e40d5f373b10d0b2bb71b6 100644 (file)
@@ -288,21 +288,24 @@ BasicBlock *ADCE::fixupCFG(BasicBlock *BB, std::set<BasicBlock*> &VisitedBlocks,
   }
 }
 
-
-
-// doADCE - Execute the Agressive Dead Code Elimination Algorithm
-//
-bool AgressiveDCE::runOnMethod(Method *M) {
-  return ADCE(M).doADCE(
-       getAnalysis<cfg::DominanceFrontier>(cfg::DominanceFrontier::PostDomID));
+namespace {
+  struct AgressiveDCE : public MethodPass {
+    // doADCE - Execute the Agressive Dead Code Elimination Algorithm
+    //
+    virtual bool runOnMethod(Method *M) {
+      return ADCE(M).doADCE(
+   getAnalysis<cfg::DominanceFrontier>(cfg::DominanceFrontier::PostDomID));
+    }
+    // getAnalysisUsageInfo - We require post dominance frontiers (aka Control
+    // Dependence Graph)
+    virtual void getAnalysisUsageInfo(Pass::AnalysisSet &Requires,
+                                      Pass::AnalysisSet &Destroyed,
+                                      Pass::AnalysisSet &Provided) {
+      Requires.push_back(cfg::DominanceFrontier::PostDomID);
+    }
+  };
 }
 
-
-// getAnalysisUsageInfo - We require post dominance frontiers (aka Control
-// Dependence Graph)
-//
-void AgressiveDCE::getAnalysisUsageInfo(Pass::AnalysisSet &Requires,
-                                        Pass::AnalysisSet &Destroyed,
-                                        Pass::AnalysisSet &Provided) {
-  Requires.push_back(cfg::DominanceFrontier::PostDomID);
+Pass *createAgressiveDCEPass() {
+  return new AgressiveDCE();
 }