llvm.org GIT mirror llvm / 5d8925c
Eliminate RegisterAnalysis. RegisterPass now does all that is necessary. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29921 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 14 years ago
22 changed file(s) with 52 addition(s) and 59 deletion(s). Raw diff Collapse all Expand all
178178 struct RegisterPass : public RegisterPassBase {
179179
180180 // Register Pass using default constructor...
181 RegisterPass(const char *PassArg, const char *Name)
181 RegisterPass(const char *PassArg, const char *Name, bool CFGOnly = false)
182182 : RegisterPassBase(Name, PassArg, typeid(PassName),
183 callDefaultCtor) {}
183 callDefaultCtor) {
184 if (CFGOnly) setOnlyUsesCFG();
185 }
184186
185187 // Register Pass using default constructor explicitly...
186188 RegisterPass(const char *PassArg, const char *Name,
187 Pass *(*ctor)())
188 : RegisterPassBase(Name, PassArg, typeid(PassName), ctor) {}
189 Pass *(*ctor)(), bool CFGOnly = false)
190 : RegisterPassBase(Name, PassArg, typeid(PassName), ctor) {
191 if (CFGOnly) setOnlyUsesCFG();
192 }
189193
190194 // Register Pass using TargetMachine constructor...
191195 RegisterPass(const char *PassArg, const char *Name,
192 Pass *(*targetctor)(TargetMachine &))
193 : RegisterPassBase(Name, PassArg, typeid(PassName), 0, targetctor) {}
196 Pass *(*targetctor)(TargetMachine &), bool CFGOnly = false)
197 : RegisterPassBase(Name, PassArg, typeid(PassName), 0, targetctor) {
198 if (CFGOnly) setOnlyUsesCFG();
199 }
194200
195201 // Generic constructor version that has an unknown ctor type...
196202 template
197 RegisterPass(const char *PassArg, const char *Name, CtorType *Fn)
198 : RegisterPassBase(Name, PassArg, typeid(PassName), 0) {}
203 RegisterPass(const char *PassArg, const char *Name, CtorType *Fn,
204 bool CFGOnly = false)
205 : RegisterPassBase(Name, PassArg, typeid(PassName), 0) {
206 if (CFGOnly) setOnlyUsesCFG();
207 }
199208 };
200209
201210 /// RegisterOpt - Register something that is to show up in Opt, this is just a
241250 bool CFGOnly = false)
242251 : RegisterPassBase(Name, PassArg, typeid(PassName), 0,
243252 static_cast(targetctor)) {
244 if (CFGOnly) setOnlyUsesCFG();
245 }
246 };
247
248 /// RegisterAnalysis - Register something that is to show up in Analysis, this
249 /// is just a shortcut for specifying RegisterPass... Analyses take a special
250 /// argument that, when set to true, tells the system that the analysis ONLY
251 /// depends on the shape of the CFG, so if a transformation preserves the CFG
252 /// that the analysis is not invalidated.
253 ///
254 template
255 struct RegisterAnalysis : public RegisterPassBase {
256 RegisterAnalysis(const char *PassArg, const char *Name,
257 bool CFGOnly = false)
258 : RegisterPassBase(Name, PassArg, typeid(PassName),
259 callDefaultCtor) {
260253 if (CFGOnly) setOnlyUsesCFG();
261254 }
262255 };
108108 }
109109 };
110110
111 RegisterAnalysis P1("print-cfg",
112 "Print CFG of function to 'dot' file");
111 RegisterPass P1("print-cfg",
112 "Print CFG of function to 'dot' file");
113113
114114 struct CFGOnlyPrinter : public CFGPrinter {
115115 virtual bool runOnFunction(Function &F) {
126126 }
127127 };
128128
129 RegisterAnalysis
129 RegisterPass
130130 P2("print-cfg-only",
131131 "Print CFG of function to 'dot' file (with no function bodies)");
132132 }
3636 UpdateGlobals("budatastructures-update-from-globals",
3737 cl::desc("Update local graph from global graph when processing function"));
3838
39 RegisterAnalysis
39 RegisterPass
4040 X("budatastructure", "Bottom-up Data Structure Analysis");
4141 }
4242
3333 Statistic<> CompleteInd("calltarget", "Number of complete indirect calls");
3434 Statistic<> CompleteEmpty("calltarget", "Number of complete empty calls");
3535
36 RegisterAnalysis X("calltarget", "Find Call Targets (uses DSA)");
36 RegisterPass X("calltarget","Find Call Targets (uses DSA)");
3737 }
3838
3939 void CallTargetFinder::findIndTargets(Module &M)
2424 using namespace llvm;
2525
2626 namespace {
27 RegisterAnalysis
27 RegisterPass
2828 X("cbudatastructure", "'Complete' Bottom-up Data Structure Analysis");
2929 Statistic<> NumCBUInlines("cbudatastructures", "Number of graphs inlined");
3030 }
5959 void print(std::ostream &O, const Module* = 0) const { }
6060 };
6161
62 static RegisterAnalysis Z("dsstats", "DS Graph Statistics");
62 static RegisterPass Z("dsstats", "DS Graph Statistics");
6363 }
6464
6565 FunctionPass *llvm::createDataStructureStatsPass() {
2929 using namespace llvm;
3030
3131 namespace {
32 RegisterAnalysis X("eqdatastructure",
32 RegisterPass X("eqdatastructure",
3333 "Equivalence-class Bottom-up Data Structure Analysis");
3434 Statistic<> NumEquivBUInlines("equivdatastructures",
3535 "Number of graphs inlined");
7373 void verify(const DSGraph &G);
7474 };
7575
76 RegisterAnalysis X("datastructure-gc", "DSA Graph Checking Pass");
76 RegisterPass X("datastructure-gc", "DSA Graph Checking Pass");
7777 }
7878
7979 FunctionPass *llvm::createDataStructureGraphCheckerPass() {
3232
3333 using namespace llvm;
3434
35 static RegisterAnalysis
35 static RegisterPass
3636 X("datastructure", "Local Data Structure Analysis");
3737
3838 static cl::opt
3131 #endif
3232
3333 namespace {
34 RegisterAnalysis // Register the pass
34 RegisterPass // Register the pass
3535 Y("tddatastructure", "Top-down Data Structure Analysis");
3636
3737 Statistic<> NumTDInlines("tddatastructures", "Number of graphs inlined");
2020 #include "llvm/Support/InstIterator.h"
2121 using namespace llvm;
2222
23 static RegisterAnalysis
23 static RegisterPass
2424 X("printusedtypes", "Find Used Types");
2525
2626 // IncorporateType - Incorporate one type and all of its subtypes into the
5454
5555 };
5656
57 RegisterAnalysis X("instcount",
58 "Counts the various types of Instructions");
57 RegisterPass X("instcount",
58 "Counts the various types of Instructions");
5959 }
6060
6161 FunctionPass *llvm::createInstCountPass() { return new InstCount(); }
1414 #include "llvm/Analysis/IntervalIterator.h"
1515 using namespace llvm;
1616
17 static RegisterAnalysis
17 static RegisterPass
1818 X("intervals", "Interval Partition Construction", true);
1919
2020 //===----------------------------------------------------------------------===//
2424 #include
2525 using namespace llvm;
2626
27 static RegisterAnalysis
27 static RegisterPass
2828 X("loops", "Natural Loop Construction", true);
2929
3030 //===----------------------------------------------------------------------===//
2222 // ImmediatePostDominators Implementation
2323 //===----------------------------------------------------------------------===//
2424
25 static RegisterAnalysis
25 static RegisterPass
2626 D("postidom", "Immediate Post-Dominators Construction", true);
2727
2828 unsigned ImmediatePostDominators::DFSPass(BasicBlock *V, InfoRec &VInfo,
144144 // PostDominatorSet Implementation
145145 //===----------------------------------------------------------------------===//
146146
147 static RegisterAnalysis
147 static RegisterPass
148148 B("postdomset", "Post-Dominator Set Construction", true);
149149
150150 // Postdominator set construction. This converts the specified function to only
211211 // PostDominatorTree Implementation
212212 //===----------------------------------------------------------------------===//
213213
214 static RegisterAnalysis
214 static RegisterPass
215215 F("postdomtree", "Post-Dominator Tree Construction", true);
216216
217217 DominatorTreeBase::Node *PostDominatorTree::getNodeForBlock(BasicBlock *BB) {
257257 // PostETForest Implementation
258258 //===----------------------------------------------------------------------===//
259259
260 static RegisterAnalysis
260 static RegisterPass
261261 G("postetforest", "Post-ET-Forest Construction", true);
262262
263263 ETNode *PostETForest::getNodeForBlock(BasicBlock *BB) {
321321 // PostDominanceFrontier Implementation
322322 //===----------------------------------------------------------------------===//
323323
324 static RegisterAnalysis
324 static RegisterPass
325325 H("postdomfrontier", "Post-Dominance Frontier Construction", true);
326326
327327 const DominanceFrontier::DomSetType &
7979 using namespace llvm;
8080
8181 namespace {
82 RegisterAnalysis
82 RegisterPass
8383 R("scalar-evolution", "Scalar Evolution Analysis");
8484
8585 Statistic<>
3737 using namespace llvm;
3838
3939 namespace {
40 RegisterAnalysis X("liveintervals", "Live Interval Analysis");
40 RegisterPass X("liveintervals", "Live Interval Analysis");
4141
4242 static Statistic<> numIntervals
4343 ("liveintervals", "Number of original intervals");
3737 #include
3838 using namespace llvm;
3939
40 static RegisterAnalysis X("livevars", "Live Variable Analysis");
40 static RegisterPass X("livevars", "Live Variable Analysis");
4141
4242 void LiveVariables::VarInfo::dump() const {
4343 std::cerr << "Register Defined by: ";
4343 //
4444 //===----------------------------------------------------------------------===//
4545
46 static RegisterAnalysis
46 static RegisterPass
4747 C("idom", "Immediate Dominators Construction", true);
4848
4949 unsigned ImmediateDominators::DFSPass(BasicBlock *V, InfoRec &VInfo,
242242 // DominatorSet Implementation
243243 //===----------------------------------------------------------------------===//
244244
245 static RegisterAnalysis
245 static RegisterPass
246246 B("domset", "Dominator Set Construction", true);
247247
248248 // dominates - Return true if A dominates B. This performs the special checks
342342 // DominatorTree Implementation
343343 //===----------------------------------------------------------------------===//
344344
345 static RegisterAnalysis
345 static RegisterPass
346346 E("domtree", "Dominator Tree Construction", true);
347347
348348 // DominatorTreeBase::reset - Free all of the tree node memory.
433433 // DominanceFrontier Implementation
434434 //===----------------------------------------------------------------------===//
435435
436 static RegisterAnalysis
436 static RegisterPass
437437 G("domfrontier", "Dominance Frontier Construction", true);
438438
439439 const DominanceFrontier::DomSetType &
812812 // ETForest implementation
813813 //===----------------------------------------------------------------------===//
814814
815 static RegisterAnalysis
815 static RegisterPass
816816 D("etforest", "ET Forest Construction", true);
817817
818818 void ETForestBase::reset() {
6060 }
6161 };
6262
63 RegisterAnalysis
63 RegisterPass
6464 P1("externalfnconstants", "Print external fn callsites passed constants");
6565
6666 struct CallGraphPrinter : public ModulePass {
7575 }
7676 };
7777
78 RegisterAnalysis
78 RegisterPass
7979 P2("callgraph", "Print a call graph");
8080 }
7171 }
7272 };
7373
74 RegisterAnalysis P2("print-callgraph",
75 "Print Call Graph to 'dot' file");
74 RegisterPass P2("print-callgraph",
75 "Print Call Graph to 'dot' file");
7676 }
5656 }
5757 };
5858
59 RegisterAnalysis
59 RegisterPass
6060 Y("cfgscc", "Print SCCs of each function CFG");
6161
62 RegisterAnalysis
62 RegisterPass
6363 Z("callscc", "Print SCCs of the Call Graph");
6464 }
6565