Eliminate RegisterAnalysis. RegisterPass now does all that is necessary.
authorChris Lattner <sabre@nondot.org>
Sun, 27 Aug 2006 22:30:17 +0000 (22:30 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 27 Aug 2006 22:30:17 +0000 (22:30 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29921 91177308-0d34-0410-b5e6-96231b3b80d8

22 files changed:
include/llvm/PassSupport.h
lib/Analysis/CFGPrinter.cpp
lib/Analysis/DataStructure/BottomUpClosure.cpp
lib/Analysis/DataStructure/CallTargets.cpp
lib/Analysis/DataStructure/CompleteBottomUp.cpp
lib/Analysis/DataStructure/DataStructureStats.cpp
lib/Analysis/DataStructure/EquivClassGraphs.cpp
lib/Analysis/DataStructure/GraphChecker.cpp
lib/Analysis/DataStructure/Local.cpp
lib/Analysis/DataStructure/TopDownClosure.cpp
lib/Analysis/IPA/FindUsedTypes.cpp
lib/Analysis/InstCount.cpp
lib/Analysis/IntervalPartition.cpp
lib/Analysis/LoopInfo.cpp
lib/Analysis/PostDominators.cpp
lib/Analysis/ScalarEvolution.cpp
lib/CodeGen/LiveIntervalAnalysis.cpp
lib/CodeGen/LiveVariables.cpp
lib/VMCore/Dominators.cpp
tools/opt/AnalysisWrappers.cpp
tools/opt/GraphPrinters.cpp
tools/opt/PrintSCC.cpp

index 8d978b35d1b84e0fb555f4de88ae00563538407c..95702c0cfa5ce2587a79807169df7be1748c5a91 100644 (file)
@@ -179,24 +179,33 @@ template<typename PassName>
 struct RegisterPass : public RegisterPassBase {
 
   // Register Pass using default constructor...
-  RegisterPass(const char *PassArg, const char *Name)
+  RegisterPass(const char *PassArg, const char *Name, bool CFGOnly = false)
   : RegisterPassBase(Name, PassArg, typeid(PassName),
-                     callDefaultCtor<PassName>) {}
+                     callDefaultCtor<PassName>) {
+    if (CFGOnly) setOnlyUsesCFG();
+  }
 
   // Register Pass using default constructor explicitly...
   RegisterPass(const char *PassArg, const char *Name,
-               Pass *(*ctor)()) 
-  : RegisterPassBase(Name, PassArg, typeid(PassName), ctor) {}
+               Pass *(*ctor)(), bool CFGOnly = false) 
+  : RegisterPassBase(Name, PassArg, typeid(PassName), ctor) {
+    if (CFGOnly) setOnlyUsesCFG();
+  }
 
   // Register Pass using TargetMachine constructor...
   RegisterPass(const char *PassArg, const char *Name, 
-               Pass *(*targetctor)(TargetMachine &))
-  : RegisterPassBase(Name, PassArg, typeid(PassName), 0, targetctor) {}
+               Pass *(*targetctor)(TargetMachine &), bool CFGOnly = false)
+  : RegisterPassBase(Name, PassArg, typeid(PassName), 0, targetctor) {
+    if (CFGOnly) setOnlyUsesCFG();
+  }
 
   // Generic constructor version that has an unknown ctor type...
   template<typename CtorType>
-  RegisterPass(const char *PassArg, const char *Name, CtorType *Fn)
-  : RegisterPassBase(Name, PassArg, typeid(PassName), 0) {}
+  RegisterPass(const char *PassArg, const char *Name, CtorType *Fn,
+               bool CFGOnly = false)
+  : RegisterPassBase(Name, PassArg, typeid(PassName), 0) {
+    if (CFGOnly) setOnlyUsesCFG();
+  }
 };
 
 /// RegisterOpt - Register something that is to show up in Opt, this is just a
@@ -246,22 +255,6 @@ struct RegisterOpt : public RegisterPassBase {
   }
 };
 
-/// RegisterAnalysis - Register something that is to show up in Analysis, this
-/// is just a shortcut for specifying RegisterPass...  Analyses take a special
-/// argument that, when set to true, tells the system that the analysis ONLY
-/// depends on the shape of the CFG, so if a transformation preserves the CFG
-/// that the analysis is not invalidated.
-///
-template<typename PassName>
-struct RegisterAnalysis : public RegisterPassBase {
-  RegisterAnalysis(const char *PassArg, const char *Name,
-                   bool CFGOnly = false)
-  : RegisterPassBase(Name, PassArg, typeid(PassName),
-                     callDefaultCtor<PassName>) {
-    if (CFGOnly) setOnlyUsesCFG();
-  }
-};
-
 
 /// RegisterAnalysisGroup - Register a Pass as a member of an analysis _group_.
 /// Analysis groups are used to define an interface (which need not derive from
index 693c1f6d8c66c3f99642953dcf775c066cb46dd3..a762a8e5f8c651922becc7492ec618ef3a1bdf43 100644 (file)
@@ -109,8 +109,8 @@ namespace {
     }
   };
 
-  RegisterAnalysis<CFGPrinter> P1("print-cfg",
-                                  "Print CFG of function to 'dot' file");
+  RegisterPass<CFGPrinter> P1("print-cfg",
+                              "Print CFG of function to 'dot' file");
 
   struct CFGOnlyPrinter : public CFGPrinter {
     virtual bool runOnFunction(Function &F) {
@@ -127,7 +127,7 @@ namespace {
     }
   };
 
-  RegisterAnalysis<CFGOnlyPrinter>
+  RegisterPass<CFGOnlyPrinter>
   P2("print-cfg-only",
      "Print CFG of function to 'dot' file (with no function bodies)");
 }
index dc7c761194b2df414bb7c24ae72017addacbee6d..d2708b0fb1cb1c5f9e346ee2755d90734e0d0eb7 100644 (file)
@@ -37,7 +37,7 @@ namespace {
   UpdateGlobals("budatastructures-update-from-globals",
                cl::desc("Update local graph from global graph when processing function"));
 
-  RegisterAnalysis<BUDataStructures>
+  RegisterPass<BUDataStructures>
   X("budatastructure", "Bottom-up Data Structure Analysis");
 }
 
index 30d7d48334df96e304d02f758efad5a268617d3a..eb1e28dcc6974e59ae009bef483cea66b2e4068f 100644 (file)
@@ -34,7 +34,7 @@ namespace {
   Statistic<> CompleteInd("calltarget", "Number of complete indirect calls");
   Statistic<> CompleteEmpty("calltarget", "Number of complete empty calls");
 
-  RegisterAnalysis<CallTargetFinder> X("calltarget", "Find Call Targets (uses DSA)");
+  RegisterPass<CallTargetFinder> X("calltarget","Find Call Targets (uses DSA)");
 }
 
 void CallTargetFinder::findIndTargets(Module &M)
index 452f0338cb045fdc0abaad3243435ba6781c4302..ea21a4f03051519ae577328dcf15fa83f13745a8 100644 (file)
@@ -25,7 +25,7 @@
 using namespace llvm;
 
 namespace {
-  RegisterAnalysis<CompleteBUDataStructures>
+  RegisterPass<CompleteBUDataStructures>
   X("cbudatastructure", "'Complete' Bottom-up Data Structure Analysis");
   Statistic<> NumCBUInlines("cbudatastructures", "Number of graphs inlined");
 }
index f4aff3013ad9df27e3daaa5e906e5562217c820b..a73fc96e6e307b2c5ca2ec3218a2e41f70f04fff 100644 (file)
@@ -60,7 +60,7 @@ namespace {
     void print(std::ostream &O, const Module* = 0) const { }
   };
 
-  static RegisterAnalysis<DSGraphStats> Z("dsstats", "DS Graph Statistics");
+  static RegisterPass<DSGraphStats> Z("dsstats", "DS Graph Statistics");
 }
 
 FunctionPass *llvm::createDataStructureStatsPass() { 
index cc536a7f89cb8de49ddbd730fb60ea6aa0910936..9126ef9814653c6d16e3433ef29266422e1a26fe 100644 (file)
@@ -30,7 +30,7 @@
 using namespace llvm;
 
 namespace {
-  RegisterAnalysis<EquivClassGraphs> X("eqdatastructure",
+  RegisterPass<EquivClassGraphs> X("eqdatastructure",
                     "Equivalence-class Bottom-up Data Structure Analysis");
   Statistic<> NumEquivBUInlines("equivdatastructures",
                                 "Number of graphs inlined");
index f42ea7eb08e834eab9fa8e92f9039e98f8b27e4e..50a41f2b9a8118b7e387ca2b629a163dbc567fb1 100644 (file)
@@ -74,7 +74,7 @@ namespace {
     void verify(const DSGraph &G);
   };
 
-  RegisterAnalysis<DSGC> X("datastructure-gc", "DSA Graph Checking Pass");
+  RegisterPass<DSGC> X("datastructure-gc", "DSA Graph Checking Pass");
 }
 
 FunctionPass *llvm::createDataStructureGraphCheckerPass() {
index ecf953230dd086f7617c2efb8e10b1bb5bd8da32..c70970ac31d91e54b57a12c64c98a56c51032ce1 100644 (file)
@@ -33,7 +33,7 @@
 
 using namespace llvm;
 
-static RegisterAnalysis<LocalDataStructures>
+static RegisterPass<LocalDataStructures>
 X("datastructure", "Local Data Structure Analysis");
 
 static cl::opt<bool>
index 2271fa4c9a51bf0c4844375ce26a163c0a1173df..9fdaac3c348b4b4b9e51b4e7a51b0fef3f98f1a8 100644 (file)
@@ -32,7 +32,7 @@ using namespace llvm;
 #endif
 
 namespace {
-  RegisterAnalysis<TDDataStructures>   // Register the pass
+  RegisterPass<TDDataStructures>   // Register the pass
   Y("tddatastructure", "Top-down Data Structure Analysis");
 
   Statistic<> NumTDInlines("tddatastructures", "Number of graphs inlined");
index 725cec4c01826d9ea26e93cc868d2004e8255497..d4ea9f9489b5abb384d356c5baddea50bbc931be 100644 (file)
@@ -21,7 +21,7 @@
 #include "llvm/Support/InstIterator.h"
 using namespace llvm;
 
-static RegisterAnalysis<FindUsedTypes>
+static RegisterPass<FindUsedTypes>
 X("printusedtypes", "Find Used Types");
 
 // IncorporateType - Incorporate one type and all of its subtypes into the
index df11fc4895aa2ce4149fb3415fc02685dbc3daf2..72bc2c72387f3c2b35f41f4f3c295112a97f23ad 100644 (file)
@@ -55,8 +55,8 @@ namespace {
 
   };
 
-  RegisterAnalysis<InstCount> X("instcount",
-                                "Counts the various types of Instructions");
+  RegisterPass<InstCount> X("instcount",
+                            "Counts the various types of Instructions");
 }
 
 FunctionPass *llvm::createInstCountPass() { return new InstCount(); }
index a6b85d4b90b2ea9772a6fd3a2dde10e35f944854..2385a7d2470436991ae0073bef0e00f10f1c62a5 100644 (file)
@@ -15,7 +15,7 @@
 #include "llvm/Analysis/IntervalIterator.h"
 using namespace llvm;
 
-static RegisterAnalysis<IntervalPartition>
+static RegisterPass<IntervalPartition>
 X("intervals", "Interval Partition Construction", true);
 
 //===----------------------------------------------------------------------===//
index a91c201e0cfd1fb5fb0759c924245e72fcb79ea4..907cf5f4fe69f931b490105dc9581ed70acdc755 100644 (file)
@@ -25,7 +25,7 @@
 #include <iostream>
 using namespace llvm;
 
-static RegisterAnalysis<LoopInfo>
+static RegisterPass<LoopInfo>
 X("loops", "Natural Loop Construction", true);
 
 //===----------------------------------------------------------------------===//
index e195d7a4c77addd41b32ccfc20830332652c34af..ec7f7c75466434803f4fca9e2861539e838a777c 100644 (file)
@@ -23,7 +23,7 @@ using namespace llvm;
 //  ImmediatePostDominators Implementation
 //===----------------------------------------------------------------------===//
 
-static RegisterAnalysis<ImmediatePostDominators>
+static RegisterPass<ImmediatePostDominators>
 D("postidom", "Immediate Post-Dominators Construction", true);
 
 unsigned ImmediatePostDominators::DFSPass(BasicBlock *V, InfoRec &VInfo,
@@ -145,7 +145,7 @@ bool ImmediatePostDominators::runOnFunction(Function &F) {
 //  PostDominatorSet Implementation
 //===----------------------------------------------------------------------===//
 
-static RegisterAnalysis<PostDominatorSet>
+static RegisterPass<PostDominatorSet>
 B("postdomset", "Post-Dominator Set Construction", true);
 
 // Postdominator set construction.  This converts the specified function to only
@@ -212,7 +212,7 @@ bool PostDominatorSet::runOnFunction(Function &F) {
 //  PostDominatorTree Implementation
 //===----------------------------------------------------------------------===//
 
-static RegisterAnalysis<PostDominatorTree>
+static RegisterPass<PostDominatorTree>
 F("postdomtree", "Post-Dominator Tree Construction", true);
 
 DominatorTreeBase::Node *PostDominatorTree::getNodeForBlock(BasicBlock *BB) {
@@ -258,7 +258,7 @@ void PostDominatorTree::calculate(const ImmediatePostDominators &IPD) {
 // PostETForest Implementation
 //===----------------------------------------------------------------------===//
 
-static RegisterAnalysis<PostETForest>
+static RegisterPass<PostETForest>
 G("postetforest", "Post-ET-Forest Construction", true);
 
 ETNode *PostETForest::getNodeForBlock(BasicBlock *BB) {
@@ -322,7 +322,7 @@ void PostETForest::calculate(const ImmediatePostDominators &ID) {
 //  PostDominanceFrontier Implementation
 //===----------------------------------------------------------------------===//
 
-static RegisterAnalysis<PostDominanceFrontier>
+static RegisterPass<PostDominanceFrontier>
 H("postdomfrontier", "Post-Dominance Frontier Construction", true);
 
 const DominanceFrontier::DomSetType &
index 37c6a44ee84ee3ffa03a8a4c1337f32b25bfa49e..289297cf3a9c3b34b7f70e9c6410e95df3791bb8 100644 (file)
@@ -80,7 +80,7 @@
 using namespace llvm;
 
 namespace {
-  RegisterAnalysis<ScalarEvolution>
+  RegisterPass<ScalarEvolution>
   R("scalar-evolution", "Scalar Evolution Analysis");
 
   Statistic<>
index 7e3bec9381b11cebb83b5c7e02e51ec85676571c..4f34881cf0e49f3f128fee16064a3e244593a2b0 100644 (file)
@@ -38,7 +38,7 @@
 using namespace llvm;
 
 namespace {
-  RegisterAnalysis<LiveIntervals> X("liveintervals", "Live Interval Analysis");
+  RegisterPass<LiveIntervals> X("liveintervals", "Live Interval Analysis");
 
   static Statistic<> numIntervals
   ("liveintervals", "Number of original intervals");
index 46a8012ae3abb29f2eab5690732d2fde0e9dc666..4f203e983b72b28af0fb738afb3ff18d005e9080 100644 (file)
@@ -38,7 +38,7 @@
 #include <iostream>
 using namespace llvm;
 
-static RegisterAnalysis<LiveVariables> X("livevars", "Live Variable Analysis");
+static RegisterPass<LiveVariables> X("livevars", "Live Variable Analysis");
 
 void LiveVariables::VarInfo::dump() const {
   std::cerr << "Register Defined by: ";
index f079acfdb44fcd9ee6e6e31de82f2f1aaaa4fc6c..9f7e5d9365d11e702866b6472423146f312e7d00 100644 (file)
@@ -44,7 +44,7 @@ using namespace llvm;
 //
 //===----------------------------------------------------------------------===//
 
-static RegisterAnalysis<ImmediateDominators>
+static RegisterPass<ImmediateDominators>
 C("idom", "Immediate Dominators Construction", true);
 
 unsigned ImmediateDominators::DFSPass(BasicBlock *V, InfoRec &VInfo,
@@ -243,7 +243,7 @@ void ImmediateDominatorsBase::print(std::ostream &o, const Module* ) const {
 //  DominatorSet Implementation
 //===----------------------------------------------------------------------===//
 
-static RegisterAnalysis<DominatorSet>
+static RegisterPass<DominatorSet>
 B("domset", "Dominator Set Construction", true);
 
 // dominates - Return true if A dominates B.  This performs the special checks
@@ -343,7 +343,7 @@ void DominatorSetBase::print(std::ostream &o, const Module* ) const {
 //  DominatorTree Implementation
 //===----------------------------------------------------------------------===//
 
-static RegisterAnalysis<DominatorTree>
+static RegisterPass<DominatorTree>
 E("domtree", "Dominator Tree Construction", true);
 
 // DominatorTreeBase::reset - Free all of the tree node memory.
@@ -434,7 +434,7 @@ void DominatorTreeBase::print(std::ostream &o, const Module* ) const {
 //  DominanceFrontier Implementation
 //===----------------------------------------------------------------------===//
 
-static RegisterAnalysis<DominanceFrontier>
+static RegisterPass<DominanceFrontier>
 G("domfrontier", "Dominance Frontier Construction", true);
 
 const DominanceFrontier::DomSetType &
@@ -813,7 +813,7 @@ ETNode *ETNode::NCA(ETNode *other) {
 // ETForest implementation
 //===----------------------------------------------------------------------===//
 
-static RegisterAnalysis<ETForest>
+static RegisterPass<ETForest>
 D("etforest", "ET Forest Construction", true);
 
 void ETForestBase::reset() {
index b371d50ef330e097a1a283a38fa281b15a5318d7..5c815f2b0294a2e4e356fb0efc780791916b8302 100644 (file)
@@ -61,7 +61,7 @@ namespace {
     }
   };
 
-  RegisterAnalysis<ExternalFunctionsPassedConstants>
+  RegisterPass<ExternalFunctionsPassedConstants>
   P1("externalfnconstants", "Print external fn callsites passed constants");
   
   struct CallGraphPrinter : public ModulePass {
@@ -76,6 +76,6 @@ namespace {
     }
   };
   
-  RegisterAnalysis<CallGraphPrinter>
+  RegisterPass<CallGraphPrinter>
     P2("callgraph", "Print a call graph");
 }
index 8826cd2a777dce8cc83bae9e0714609c26ad4836..8ae0a0340ce033605e0f0f06fd416970bd180677 100644 (file)
@@ -72,6 +72,6 @@ namespace {
     }
   };
 
-  RegisterAnalysis<CallGraphPrinter> P2("print-callgraph",
-                                        "Print Call Graph to 'dot' file");
+  RegisterPass<CallGraphPrinter> P2("print-callgraph",
+                                    "Print Call Graph to 'dot' file");
 }
index c0adf5ca0342577970a8b87771eb9a66cc807140..904442d11f88069904fc1b624f458c8ab271fcff 100644 (file)
@@ -57,10 +57,10 @@ namespace {
     }
   };
 
-  RegisterAnalysis<CFGSCC>
+  RegisterPass<CFGSCC>
   Y("cfgscc", "Print SCCs of each function CFG");
 
-  RegisterAnalysis<CallGraphSCC>
+  RegisterPass<CallGraphSCC>
   Z("callscc", "Print SCCs of the Call Graph");
 }