Convert xforms over to new pass structure.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1605 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/IPO/SimpleStructMutation.cpp b/lib/Transforms/IPO/SimpleStructMutation.cpp
index 7e28af3..8583e3e 100644
--- a/lib/Transforms/IPO/SimpleStructMutation.cpp
+++ b/lib/Transforms/IPO/SimpleStructMutation.cpp
@@ -89,24 +89,16 @@
 
 SimpleStructMutation::TransformsType
   SimpleStructMutation::getTransforms(Module *M, enum Transform XForm) {
-
-  // FIXME: These should be calculated by the Pass framework!
-
   // We need to know which types to modify, and which types we CAN'T modify
-  FindUsedTypes          *FUT = new FindUsedTypes(/*true*/); // TODO: Do symbol tables as well
-  FindUnsafePointerTypes *FUPT = new FindUnsafePointerTypes();
-
-  // Simutaneously find all of the types used, and all of the types that aren't
-  // safe.
-  //
-  PassManager Analyses;
-  Analyses.add(FUT);
-  Analyses.add(FUPT);
-  Analyses.run(M);  // Do analyses
+  // TODO: Do symbol tables as well
 
   // Get the results out of the analyzers...
-  const set<PointerType*> &UnsafePTys = FUPT->getUnsafeTypes();
-  const set<const Type *> &UsedTypes  = FUT->getTypes();
+  FindUsedTypes          &FUT = getAnalysis<FindUsedTypes>();
+  const set<const Type *> &UsedTypes  = FUT.getTypes();
+
+  FindUnsafePointerTypes &FUPT = getAnalysis<FindUnsafePointerTypes>();
+  const set<PointerType*> &UnsafePTys = FUPT.getUnsafeTypes();
+
 
 
   // Combine the two sets, weeding out non structure types.  Closures in C++
@@ -144,3 +136,14 @@
   return Transforms;
 }
 
+
+// getAnalysisUsageInfo - This function needs the results of the
+// FindUsedTypes and FindUnsafePointerTypes analysis passes...
+//
+void SimpleStructMutation::getAnalysisUsageInfo(Pass::AnalysisSet &Required,
+                                                Pass::AnalysisSet &Destroyed,
+                                                Pass::AnalysisSet &Provided){
+  Required.push_back(FindUsedTypes::ID);
+  Required.push_back(FindUnsafePointerTypes::ID);
+  MutateStructTypes::getAnalysisUsageInfo(Required, Destroyed, Provided);
+}