Change over to use new style pass mechanism, now passes only expose small
creation functions in their public header file, unless they can help it.
llvm-svn: 1816
diff --git a/llvm/lib/Transforms/Scalar/ADCE.cpp b/llvm/lib/Transforms/Scalar/ADCE.cpp
index 91bed41..14c68f4 100644
--- a/llvm/lib/Transforms/Scalar/ADCE.cpp
+++ b/llvm/lib/Transforms/Scalar/ADCE.cpp
@@ -288,21 +288,24 @@
}
}
-
-
-// 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();
}