* Add support for different "PassType's"
* Add new RegisterOpt/RegisterAnalysis templates for registering passes that
  are to show up in opt or analyze
* Register Analyses now
* Change optimizations to use RegisterOpt instead of RegisterPass
* Add support for different "PassType's"
* Add new RegisterOpt/RegisterAnalysis templates for registering passes that
  are to show up in opt or analyze
* Register Analyses now
* Change optimizations to use RegisterOpt instead of RegisterPass
* Remove getPassName implementations from various subclasses


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3113 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/IPA/FindUnsafePointerTypes.cpp b/lib/Analysis/IPA/FindUnsafePointerTypes.cpp
index 1180766..2678fcf 100644
--- a/lib/Analysis/IPA/FindUnsafePointerTypes.cpp
+++ b/lib/Analysis/IPA/FindUnsafePointerTypes.cpp
@@ -23,6 +23,8 @@
 #include "llvm/Support/InstIterator.h"
 #include "Support/CommandLine.h"
 
+static RegisterAnalysis<FindUnsafePointerTypes>
+X("unsafepointertypes", "Find Unsafe Pointer Types");
 AnalysisID FindUnsafePointerTypes::ID(AnalysisID::create<FindUnsafePointerTypes>());
 
 // Provide a command line option to turn on printing of which instructions cause
diff --git a/lib/Analysis/IPA/FindUsedTypes.cpp b/lib/Analysis/IPA/FindUsedTypes.cpp
index f91b8ae..1139cf3 100644
--- a/lib/Analysis/IPA/FindUsedTypes.cpp
+++ b/lib/Analysis/IPA/FindUsedTypes.cpp
@@ -11,6 +11,8 @@
 #include "llvm/Module.h"
 #include "llvm/Support/InstIterator.h"
 
+static RegisterAnalysis<FindUsedTypes>
+X("printusedtypes", "Find Used Types");
 AnalysisID FindUsedTypes::ID(AnalysisID::create<FindUsedTypes>());
 
 // IncorporateType - Incorporate one type and all of its subtypes into the
diff --git a/lib/Transforms/IPO/InlineSimple.cpp b/lib/Transforms/IPO/InlineSimple.cpp
index 3c76a33..924ad5c 100644
--- a/lib/Transforms/IPO/InlineSimple.cpp
+++ b/lib/Transforms/IPO/InlineSimple.cpp
@@ -261,7 +261,7 @@
       return doFunctionInlining(F);
     }
   };
-  RegisterPass<FunctionInlining> X("inline", "Function Integration/Inlining");
+  RegisterOpt<FunctionInlining> X("inline", "Function Integration/Inlining");
 }
 
 Pass *createFunctionInliningPass() { return new FunctionInlining(); }
diff --git a/lib/Transforms/IPO/RaiseAllocations.cpp b/lib/Transforms/IPO/RaiseAllocations.cpp
index fae1767..0f10dad 100644
--- a/lib/Transforms/IPO/RaiseAllocations.cpp
+++ b/lib/Transforms/IPO/RaiseAllocations.cpp
@@ -39,8 +39,8 @@
   bool runOnBasicBlock(BasicBlock &BB);
 };
 
-RegisterPass<RaiseAllocations>
-X("raiseallocs", "Raise allocations from calls to instructions");
+  RegisterOpt<RaiseAllocations>
+  X("raiseallocs", "Raise allocations from calls to instructions");
 }  // end anonymous namespace
 
 
diff --git a/lib/Transforms/Instrumentation/EmitFunctions.cpp b/lib/Transforms/Instrumentation/EmitFunctions.cpp
index 3506cb9..0218a14 100644
--- a/lib/Transforms/Instrumentation/EmitFunctions.cpp
+++ b/lib/Transforms/Instrumentation/EmitFunctions.cpp
@@ -17,7 +17,7 @@
     bool run(Module &M);
   };
   
-  RegisterPass<EmitFunctionTable> X("emitfuncs", "Emit a Function Table");
+  RegisterOpt<EmitFunctionTable> X("emitfuncs", "Emit a Function Table");
 }
 
 // Create a new pass to add function table
diff --git a/lib/Transforms/Instrumentation/TraceValues.cpp b/lib/Transforms/Instrumentation/TraceValues.cpp
index 52c7c0a..3239e73 100644
--- a/lib/Transforms/Instrumentation/TraceValues.cpp
+++ b/lib/Transforms/Instrumentation/TraceValues.cpp
@@ -97,8 +97,8 @@
   };
 
   // Register the passes...
-  RegisterPass<FunctionTracer>  X("tracem","Insert Function trace code only");
-  RegisterPass<BasicBlockTracer> Y("trace","Insert BB and Function trace code");
+  RegisterOpt<FunctionTracer>  X("tracem","Insert Function trace code only");
+  RegisterOpt<BasicBlockTracer> Y("trace","Insert BB and Function trace code");
 } // end anonymous namespace
 
 
diff --git a/lib/Transforms/LevelRaise.cpp b/lib/Transforms/LevelRaise.cpp
index 420cc79..b2008b0 100644
--- a/lib/Transforms/LevelRaise.cpp
+++ b/lib/Transforms/LevelRaise.cpp
@@ -545,5 +545,5 @@
   return new RaisePointerReferences(TD);
 }
 
-static RegisterPass<RaisePointerReferences>
+static RegisterOpt<RaisePointerReferences>
 X("raise", "Raise Pointer References", createRaisePointerReferencesPass);
diff --git a/lib/Transforms/Scalar/ADCE.cpp b/lib/Transforms/Scalar/ADCE.cpp
index 058ef1b..40ae87b 100644
--- a/lib/Transforms/Scalar/ADCE.cpp
+++ b/lib/Transforms/Scalar/ADCE.cpp
@@ -84,7 +84,7 @@
   }
 };
 
-  RegisterPass<ADCE> X("adce", "Aggressive Dead Code Elimination");
+  RegisterOpt<ADCE> X("adce", "Aggressive Dead Code Elimination");
 } // End of anonymous namespace
 
 Pass *createAggressiveDCEPass() { return new ADCE(); }
diff --git a/lib/Transforms/Scalar/ConstantProp.cpp b/lib/Transforms/Scalar/ConstantProp.cpp
index 025b8a7..5da909e 100644
--- a/lib/Transforms/Scalar/ConstantProp.cpp
+++ b/lib/Transforms/Scalar/ConstantProp.cpp
@@ -31,7 +31,7 @@
     }
   };
 
-RegisterPass<ConstantPropogation> X("constprop", "Simple constant propogation");
+  RegisterOpt<ConstantPropogation> X("constprop","Simple constant propogation");
 }
 
 Pass *createConstantPropogationPass() {
diff --git a/lib/Transforms/Scalar/DCE.cpp b/lib/Transforms/Scalar/DCE.cpp
index bfc41b14..2903699 100644
--- a/lib/Transforms/Scalar/DCE.cpp
+++ b/lib/Transforms/Scalar/DCE.cpp
@@ -42,7 +42,7 @@
     }
   };
   
-  RegisterPass<DeadInstElimination> X("die", "Dead Instruction Elimination");
+  RegisterOpt<DeadInstElimination> X("die", "Dead Instruction Elimination");
 }
 
 Pass *createDeadInstEliminationPass() {
@@ -64,7 +64,7 @@
     }
  };
 
-  RegisterPass<DCE> Y("dce", "Dead Code Elimination");
+  RegisterOpt<DCE> Y("dce", "Dead Code Elimination");
 }
 
 bool DCE::runOnFunction(Function &F) {
diff --git a/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp b/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp
index 5d873cd..f0a8074 100644
--- a/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp
+++ b/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp
@@ -27,8 +27,8 @@
     static void decomposeArrayRef(BasicBlock::iterator &BBI);
   };
 
-RegisterPass<DecomposePass> X("lowerrefs", "Decompose multi-dimensional "
-                              "structure/array references");
+  RegisterOpt<DecomposePass> X("lowerrefs", "Decompose multi-dimensional "
+                               "structure/array references");
 }
 
 Pass *createDecomposeMultiDimRefsPass() {
diff --git a/lib/Transforms/Scalar/GCSE.cpp b/lib/Transforms/Scalar/GCSE.cpp
index 568f3db..c8f8775 100644
--- a/lib/Transforms/Scalar/GCSE.cpp
+++ b/lib/Transforms/Scalar/GCSE.cpp
@@ -84,7 +84,7 @@
     }
   };
 
-  RegisterPass<GCSE> X("gcse", "Global Common Subexpression Elimination");
+  RegisterOpt<GCSE> X("gcse", "Global Common Subexpression Elimination");
 }
 
 // createGCSEPass - The public interface to this file...
diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp
index 35fe697..411ab11 100644
--- a/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ b/lib/Transforms/Scalar/IndVarSimplify.cpp
@@ -198,7 +198,7 @@
       AU.preservesCFG();
     }
   };
-  RegisterPass<InductionVariableSimplify> X("indvars",
+  RegisterOpt<InductionVariableSimplify> X("indvars",
                                            "Cannonicalize Induction Variables");
 }
 
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index ba2bbe0..230b553 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -79,7 +79,7 @@
     Instruction *visitInstruction(Instruction &I) { return 0; }
   };
 
-  RegisterPass<InstCombiner> X("instcombine", "Combine redundant instructions");
+  RegisterOpt<InstCombiner> X("instcombine", "Combine redundant instructions");
 }
 
 
diff --git a/lib/Transforms/Scalar/LICM.cpp b/lib/Transforms/Scalar/LICM.cpp
index 99450bb..9f3c757 100644
--- a/lib/Transforms/Scalar/LICM.cpp
+++ b/lib/Transforms/Scalar/LICM.cpp
@@ -103,7 +103,7 @@
     }
   };
 
-  RegisterPass<LICM> X("licm", "Loop Invariant Code Motion");
+  RegisterOpt<LICM> X("licm", "Loop Invariant Code Motion");
 }
 
 Pass *createLICMPass() { return new LICM(); }
diff --git a/lib/Transforms/Scalar/PiNodeInsertion.cpp b/lib/Transforms/Scalar/PiNodeInsertion.cpp
index 81f3cb3..399b5fe 100644
--- a/lib/Transforms/Scalar/PiNodeInsertion.cpp
+++ b/lib/Transforms/Scalar/PiNodeInsertion.cpp
@@ -55,7 +55,7 @@
     bool insertPiNodeFor(Value *V, BasicBlock *BB, Value *Rep = 0);
   };
 
-  RegisterPass<PiNodeInserter> X("pinodes", "Pi Node Insertion");
+  RegisterOpt<PiNodeInserter> X("pinodes", "Pi Node Insertion");
 }
 
 Pass *createPiNodeInsertionPass() { return new PiNodeInserter(); }
diff --git a/lib/Transforms/Scalar/Reassociate.cpp b/lib/Transforms/Scalar/Reassociate.cpp
index a6ad88a..24d7dce 100644
--- a/lib/Transforms/Scalar/Reassociate.cpp
+++ b/lib/Transforms/Scalar/Reassociate.cpp
@@ -47,7 +47,7 @@
     bool ReassociateBB(BasicBlock *BB);
   };
 
-  RegisterPass<Reassociate> X("reassociate", "Reassociate expressions");
+  RegisterOpt<Reassociate> X("reassociate", "Reassociate expressions");
 }
 
 Pass *createReassociatePass() { return new Reassociate(); }
diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp
index b32481e..b721ca0 100644
--- a/lib/Transforms/Scalar/SCCP.cpp
+++ b/lib/Transforms/Scalar/SCCP.cpp
@@ -220,7 +220,7 @@
   }
 };
 
-  RegisterPass<SCCP> X("sccp", "Sparse Conditional Constant Propogation");
+  RegisterOpt<SCCP> X("sccp", "Sparse Conditional Constant Propogation");
 } // end anonymous namespace
 
 
diff --git a/lib/Transforms/Scalar/SimplifyCFG.cpp b/lib/Transforms/Scalar/SimplifyCFG.cpp
index 6774dc1..f26d5a0 100644
--- a/lib/Transforms/Scalar/SimplifyCFG.cpp
+++ b/lib/Transforms/Scalar/SimplifyCFG.cpp
@@ -26,7 +26,7 @@
   struct CFGSimplifyPass : public FunctionPass {
     virtual bool runOnFunction(Function &F);
   };
-  RegisterPass<CFGSimplifyPass> X("simplifycfg", "Simplify the CFG");
+  RegisterOpt<CFGSimplifyPass> X("simplifycfg", "Simplify the CFG");
 }
 
 Pass *createCFGSimplificationPass() {
diff --git a/lib/Transforms/Scalar/SymbolStripping.cpp b/lib/Transforms/Scalar/SymbolStripping.cpp
index 4ad5af3..2f3d1aa 100644
--- a/lib/Transforms/Scalar/SymbolStripping.cpp
+++ b/lib/Transforms/Scalar/SymbolStripping.cpp
@@ -51,15 +51,15 @@
       AU.setPreservesAll();
     }
   };
-  RegisterPass<SymbolStripping> X("strip", "Strip symbols from functions");
+  RegisterOpt<SymbolStripping> X("strip", "Strip symbols from functions");
 
   struct FullSymbolStripping : public SymbolStripping {
     virtual bool doInitialization(Module &M) {
       return StripSymbolTable(M.getSymbolTable());
     }
   };
-  RegisterPass<FullSymbolStripping> Y("mstrip",
-                                    "Strip symbols from module and functions");
+  RegisterOpt<FullSymbolStripping> Y("mstrip",
+                                     "Strip symbols from module and functions");
 }
 
 Pass *createSymbolStrippingPass() {
diff --git a/lib/Transforms/Utils/LowerAllocations.cpp b/lib/Transforms/Utils/LowerAllocations.cpp
index 486061f..7e0960d 100644
--- a/lib/Transforms/Utils/LowerAllocations.cpp
+++ b/lib/Transforms/Utils/LowerAllocations.cpp
@@ -52,7 +52,7 @@
   return new LowerAllocations(TD);
 }
 
-static RegisterPass<LowerAllocations>
+static RegisterOpt<LowerAllocations>
 X("lowerallocs", "Lower allocations from instructions to calls (TD)",
   createLowerAllocationsPass);
 
diff --git a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
index 378e979..0a92d0d 100644
--- a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
+++ b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
@@ -66,7 +66,7 @@
     void FindSafeAllocas(Function &F);
   };
 
-  RegisterPass<PromotePass> X("mem2reg", "Promote Memory to Register");
+  RegisterOpt<PromotePass> X("mem2reg", "Promote Memory to Register");
 }  // end of anonymous namespace
 
 
diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp
index e33d9f4..c1af5e4 100644
--- a/lib/VMCore/AsmWriter.cpp
+++ b/lib/VMCore/AsmWriter.cpp
@@ -29,8 +29,10 @@
 using std::vector;
 using std::ostream;
 
-static RegisterPass<PrintModulePass>   X("printm", "Print module to stderr");
-static RegisterPass<PrintFunctionPass> Y("print", "Print function to stderr");
+static RegisterPass<PrintModulePass>
+X("printm", "Print module to stderr",PassInfo::Analysis|PassInfo::Optimization);
+static RegisterPass<PrintFunctionPass>
+Y("print","Print function to stderr",PassInfo::Analysis|PassInfo::Optimization);
 
 static void WriteAsOperandInternal(ostream &Out, const Value *V, bool PrintName,
                                    map<const Type *, string> &TypeTable,