blob: b6f855d017e7e09371844a361e036e1667518d57 [file] [log] [blame]
Chris Lattner26e4f892002-01-21 07:37:31 +00001//===- Pass.cpp - LLVM Pass Infrastructure Impementation ------------------===//
2//
3// This file implements the LLVM Pass infrastructure. It is primarily
4// responsible with ensuring that passes are executed and batched together
5// optimally.
6//
7//===----------------------------------------------------------------------===//
8
Chris Lattnercdd09c22002-01-31 00:45:31 +00009#include "llvm/PassManager.h"
Chris Lattner37c86672002-04-28 20:46:05 +000010#include "PassManagerT.h" // PassManagerT implementation
Chris Lattnercdd09c22002-01-31 00:45:31 +000011#include "llvm/Module.h"
Chris Lattner26e4f892002-01-21 07:37:31 +000012#include "Support/STLExtras.h"
Chris Lattner37d3c952002-07-23 18:08:00 +000013#include "Support/TypeInfo.h"
Chris Lattnere2eb99e2002-04-29 04:04:29 +000014#include <stdio.h>
Chris Lattner6a33d6f2002-08-01 19:33:09 +000015#include <sys/resource.h>
16#include <sys/unistd.h>
Chris Lattnerd013ba92002-01-23 05:49:41 +000017
Chris Lattner7e0dbe62002-05-06 19:31:52 +000018//===----------------------------------------------------------------------===//
19// AnalysisID Class Implementation
20//
21
Chris Lattner198cf422002-07-30 16:27:02 +000022static std::vector<const PassInfo*> CFGOnlyAnalyses;
Chris Lattnercdd09c22002-01-31 00:45:31 +000023
Chris Lattner198cf422002-07-30 16:27:02 +000024void RegisterPassBase::setPreservesCFG() {
25 CFGOnlyAnalyses.push_back(PIObj);
Chris Lattner7e0dbe62002-05-06 19:31:52 +000026}
27
28//===----------------------------------------------------------------------===//
29// AnalysisResolver Class Implementation
30//
31
Chris Lattnercdd09c22002-01-31 00:45:31 +000032void AnalysisResolver::setAnalysisResolver(Pass *P, AnalysisResolver *AR) {
33 assert(P->Resolver == 0 && "Pass already in a PassManager!");
34 P->Resolver = AR;
35}
36
Chris Lattner7e0dbe62002-05-06 19:31:52 +000037//===----------------------------------------------------------------------===//
38// AnalysisUsage Class Implementation
39//
Chris Lattneree2ff5d2002-04-28 21:25:41 +000040
41// preservesCFG - This function should be called to by the pass, iff they do
42// not:
43//
44// 1. Add or remove basic blocks from the function
45// 2. Modify terminator instructions in any way.
46//
47// This function annotates the AnalysisUsage info object to say that analyses
48// that only depend on the CFG are preserved by this pass.
49//
50void AnalysisUsage::preservesCFG() {
Chris Lattner7e0dbe62002-05-06 19:31:52 +000051 // Since this transformation doesn't modify the CFG, it preserves all analyses
52 // that only depend on the CFG (like dominators, loop info, etc...)
53 //
54 Preserved.insert(Preserved.end(),
55 CFGOnlyAnalyses.begin(), CFGOnlyAnalyses.end());
Chris Lattneree2ff5d2002-04-28 21:25:41 +000056}
57
58
Chris Lattner37c86672002-04-28 20:46:05 +000059//===----------------------------------------------------------------------===//
60// PassManager implementation - The PassManager class is a simple Pimpl class
61// that wraps the PassManagerT template.
62//
63PassManager::PassManager() : PM(new PassManagerT<Module>()) {}
64PassManager::~PassManager() { delete PM; }
65void PassManager::add(Pass *P) { PM->add(P); }
Chris Lattner113f4f42002-06-25 16:13:24 +000066bool PassManager::run(Module &M) { return PM->run(M); }
Chris Lattnercdd09c22002-01-31 00:45:31 +000067
Chris Lattner37c86672002-04-28 20:46:05 +000068
69//===----------------------------------------------------------------------===//
Chris Lattnere2eb99e2002-04-29 04:04:29 +000070// TimingInfo Class - This class is used to calculate information about the
71// amount of time each pass takes to execute. This only happens with
72// -time-passes is enabled on the command line.
73//
Chris Lattnerf5cad152002-07-22 02:10:13 +000074static cl::opt<bool>
75EnableTiming("time-passes",
76 cl::desc("Time each pass, printing elapsed time for each on exit"));
Chris Lattnere2eb99e2002-04-29 04:04:29 +000077
Chris Lattner6a33d6f2002-08-01 19:33:09 +000078static TimeRecord getTimeRecord() {
79 static unsigned long PageSize = 0;
80
81 if (PageSize == 0) {
82#ifdef _SC_PAGE_SIZE
83 PageSize = sysconf(_SC_PAGE_SIZE);
84#else
85#ifdef _SC_PAGESIZE
86 PageSize = sysconf(_SC_PAGESIZE);
87#else
88 PageSize = getpagesize();
89#endif
90#endif
91 }
92
93 struct rusage RU;
Chris Lattnere2eb99e2002-04-29 04:04:29 +000094 struct timeval T;
95 gettimeofday(&T, 0);
Chris Lattner6a33d6f2002-08-01 19:33:09 +000096 if (getrusage(RUSAGE_SELF, &RU)) {
97 perror("getrusage call failed: -time-passes info incorrect!");
98 }
99
100 TimeRecord Result;
101 Result.Elapsed = T.tv_sec + T.tv_usec/1000000.0;
102 Result.UserTime = RU.ru_utime.tv_sec + RU.ru_utime.tv_usec/1000000.0;
103 Result.SystemTime = RU.ru_stime.tv_sec + RU.ru_stime.tv_usec/1000000.0;
104 Result.MaxRSS = RU.ru_maxrss*PageSize;
105
106 return Result;
Chris Lattnere2eb99e2002-04-29 04:04:29 +0000107}
108
Chris Lattnere821d782002-08-20 18:47:53 +0000109bool TimeRecord::operator<(const TimeRecord &TR) const {
110 // Primary sort key is User+System time
111 if (UserTime+SystemTime < TR.UserTime+TR.SystemTime)
112 return true;
113 if (UserTime+SystemTime > TR.UserTime+TR.SystemTime)
114 return false;
115
116 // Secondary sort key is Wall Time
117 return Elapsed < TR.Elapsed;
118}
119
Chris Lattner6a33d6f2002-08-01 19:33:09 +0000120void TimeRecord::passStart(const TimeRecord &T) {
121 Elapsed -= T.Elapsed;
122 UserTime -= T.UserTime;
123 SystemTime -= T.SystemTime;
124 RSSTemp = T.MaxRSS;
125}
126
127void TimeRecord::passEnd(const TimeRecord &T) {
128 Elapsed += T.Elapsed;
129 UserTime += T.UserTime;
130 SystemTime += T.SystemTime;
131 RSSTemp = T.MaxRSS - RSSTemp;
132 MaxRSS = std::max(MaxRSS, RSSTemp);
133}
134
Chris Lattner5ec216b2002-08-19 15:43:33 +0000135static void printVal(double Val, double Total) {
136 if (Total < 1e-7) // Avoid dividing by zero...
Chris Lattnerca5afe72002-08-19 20:42:12 +0000137 fprintf(stderr, " ----- ");
Chris Lattner5ec216b2002-08-19 15:43:33 +0000138 else
139 fprintf(stderr, " %7.4f (%5.1f%%)", Val, Val*100/Total);
140}
141
Chris Lattner6a33d6f2002-08-01 19:33:09 +0000142void TimeRecord::print(const char *PassName, const TimeRecord &Total) const {
Chris Lattner5ec216b2002-08-19 15:43:33 +0000143 printVal(UserTime, Total.UserTime);
144 printVal(SystemTime, Total.SystemTime);
145 printVal(UserTime+SystemTime, Total.UserTime+Total.SystemTime);
146 printVal(Elapsed, Total.Elapsed);
147
148 fprintf(stderr, " ");
Chris Lattner6a33d6f2002-08-01 19:33:09 +0000149
150 if (Total.MaxRSS)
151 std::cerr << MaxRSS << "\t";
152 std::cerr << PassName << "\n";
153}
154
155
Chris Lattnere2eb99e2002-04-29 04:04:29 +0000156// Create method. If Timing is enabled, this creates and returns a new timing
157// object, otherwise it returns null.
158//
159TimingInfo *TimingInfo::create() {
160 return EnableTiming ? new TimingInfo() : 0;
161}
162
Chris Lattner6a33d6f2002-08-01 19:33:09 +0000163void TimingInfo::passStarted(Pass *P) {
164 TimingData[P].passStart(getTimeRecord());
165}
166void TimingInfo::passEnded(Pass *P) {
167 TimingData[P].passEnd(getTimeRecord());
168}
169void TimeRecord::sum(const TimeRecord &TR) {
170 Elapsed += TR.Elapsed;
171 UserTime += TR.UserTime;
172 SystemTime += TR.SystemTime;
173 MaxRSS += TR.MaxRSS;
174}
Chris Lattnere2eb99e2002-04-29 04:04:29 +0000175
176// TimingDtor - Print out information about timing information
177TimingInfo::~TimingInfo() {
178 // Iterate over all of the data, converting it into the dual of the data map,
179 // so that the data is sorted by amount of time taken, instead of pointer.
180 //
Chris Lattner6a33d6f2002-08-01 19:33:09 +0000181 std::vector<std::pair<TimeRecord, Pass*> > Data;
182 TimeRecord Total;
183 for (std::map<Pass*, TimeRecord>::iterator I = TimingData.begin(),
Chris Lattnere2eb99e2002-04-29 04:04:29 +0000184 E = TimingData.end(); I != E; ++I)
185 // Throw out results for "grouping" pass managers...
186 if (!dynamic_cast<AnalysisResolver*>(I->first)) {
187 Data.push_back(std::make_pair(I->second, I->first));
Chris Lattner6a33d6f2002-08-01 19:33:09 +0000188 Total.sum(I->second);
Chris Lattnere2eb99e2002-04-29 04:04:29 +0000189 }
190
191 // Sort the data by time as the primary key, in reverse order...
Chris Lattner6a33d6f2002-08-01 19:33:09 +0000192 std::sort(Data.begin(), Data.end(),
193 std::greater<std::pair<TimeRecord, Pass*> >());
Chris Lattnere2eb99e2002-04-29 04:04:29 +0000194
195 // Print out timing header...
Anand Shukla8c377892002-06-25 22:07:38 +0000196 std::cerr << std::string(79, '=') << "\n"
Chris Lattner6a33d6f2002-08-01 19:33:09 +0000197 << " ... Pass execution timing report ...\n"
198 << std::string(79, '=') << "\n Total Execution Time: "
199 << (Total.UserTime+Total.SystemTime) << " seconds ("
200 << Total.Elapsed << " wall clock)\n\n ---User Time--- "
201 << "--System Time-- --User+System-- ---Wall Time---";
202
203 if (Total.MaxRSS)
204 std::cerr << " ---Mem---";
205 std::cerr << " --- Pass Name ---\n";
Chris Lattnere2eb99e2002-04-29 04:04:29 +0000206
207 // Loop through all of the timing data, printing it out...
Chris Lattner6a33d6f2002-08-01 19:33:09 +0000208 for (unsigned i = 0, e = Data.size(); i != e; ++i)
209 Data[i].first.print(Data[i].second->getPassName(), Total);
210
211 Total.print("TOTAL", Total);
Chris Lattnere2eb99e2002-04-29 04:04:29 +0000212}
213
214
Chris Lattner1e4867f2002-07-30 19:51:02 +0000215void PMDebug::PrintArgumentInformation(const Pass *P) {
216 // Print out passes in pass manager...
217 if (const AnalysisResolver *PM = dynamic_cast<const AnalysisResolver*>(P)) {
218 for (unsigned i = 0, e = PM->getNumContainedPasses(); i != e; ++i)
219 PrintArgumentInformation(PM->getContainedPass(i));
220
221 } else { // Normal pass. Print argument information...
222 // Print out arguments for registered passes that are _optimizations_
223 if (const PassInfo *PI = P->getPassInfo())
224 if (PI->getPassType() & PassInfo::Optimization)
225 std::cerr << " -" << PI->getPassArgument();
226 }
227}
Chris Lattnercdd09c22002-01-31 00:45:31 +0000228
229void PMDebug::PrintPassInformation(unsigned Depth, const char *Action,
Chris Lattnera454b5b2002-04-28 05:14:06 +0000230 Pass *P, Annotable *V) {
Chris Lattnerf5cad152002-07-22 02:10:13 +0000231 if (PassDebugging >= Executions) {
Chris Lattnerac3e0602002-01-31 18:32:27 +0000232 std::cerr << (void*)P << std::string(Depth*2+1, ' ') << Action << " '"
Chris Lattner37104aa2002-04-29 14:57:45 +0000233 << P->getPassName();
Chris Lattnercdd09c22002-01-31 00:45:31 +0000234 if (V) {
235 std::cerr << "' on ";
Chris Lattnera454b5b2002-04-28 05:14:06 +0000236
237 if (dynamic_cast<Module*>(V)) {
Chris Lattnercdd09c22002-01-31 00:45:31 +0000238 std::cerr << "Module\n"; return;
Chris Lattnera454b5b2002-04-28 05:14:06 +0000239 } else if (Function *F = dynamic_cast<Function*>(V))
240 std::cerr << "Function '" << F->getName();
241 else if (BasicBlock *BB = dynamic_cast<BasicBlock*>(V))
242 std::cerr << "BasicBlock '" << BB->getName();
243 else if (Value *Val = dynamic_cast<Value*>(V))
244 std::cerr << typeid(*Val).name() << " '" << Val->getName();
Chris Lattnercdd09c22002-01-31 00:45:31 +0000245 }
246 std::cerr << "'...\n";
247 }
248}
249
250void PMDebug::PrintAnalysisSetInfo(unsigned Depth, const char *Msg,
Chris Lattnerc8e66542002-04-27 06:56:12 +0000251 Pass *P, const std::vector<AnalysisID> &Set){
Chris Lattnerf5cad152002-07-22 02:10:13 +0000252 if (PassDebugging >= Details && !Set.empty()) {
Chris Lattnerac3e0602002-01-31 18:32:27 +0000253 std::cerr << (void*)P << std::string(Depth*2+3, ' ') << Msg << " Analyses:";
Chris Lattner198cf422002-07-30 16:27:02 +0000254 for (unsigned i = 0; i != Set.size(); ++i)
255 std::cerr << " " << Set[i]->getPassName();
Chris Lattnercdd09c22002-01-31 00:45:31 +0000256 std::cerr << "\n";
257 }
258}
259
Chris Lattnercdd09c22002-01-31 00:45:31 +0000260//===----------------------------------------------------------------------===//
261// Pass Implementation
Chris Lattner654b5bc2002-01-22 00:17:48 +0000262//
Chris Lattnercdd09c22002-01-31 00:45:31 +0000263
Chris Lattnerc8e66542002-04-27 06:56:12 +0000264void Pass::addToPassManager(PassManagerT<Module> *PM, AnalysisUsage &AU) {
265 PM->addPass(this, AU);
Chris Lattner654b5bc2002-01-22 00:17:48 +0000266}
Chris Lattner26e4f892002-01-21 07:37:31 +0000267
Chris Lattner198cf422002-07-30 16:27:02 +0000268// dumpPassStructure - Implement the -debug-passes=Structure option
269void Pass::dumpPassStructure(unsigned Offset) {
270 std::cerr << std::string(Offset*2, ' ') << getPassName() << "\n";
271}
Chris Lattner37104aa2002-04-29 14:57:45 +0000272
273// getPassName - Use C++ RTTI to get a SOMEWHAT intelligable name for the pass.
274//
Chris Lattner071577d2002-07-29 21:02:31 +0000275const char *Pass::getPassName() const {
276 if (const PassInfo *PI = getPassInfo())
277 return PI->getPassName();
278 return typeid(*this).name();
279}
Chris Lattner37104aa2002-04-29 14:57:45 +0000280
Chris Lattner26750072002-07-27 01:12:17 +0000281// print - Print out the internal state of the pass. This is called by Analyse
282// to print out the contents of an analysis. Otherwise it is not neccesary to
283// implement this method.
284//
285void Pass::print(std::ostream &O) const {
286 O << "Pass::print not implemented for pass: '" << getPassName() << "'!\n";
287}
288
289// dump - call print(std::cerr);
290void Pass::dump() const {
291 print(std::cerr, 0);
292}
293
Chris Lattnercdd09c22002-01-31 00:45:31 +0000294//===----------------------------------------------------------------------===//
Chris Lattnerc8e66542002-04-27 06:56:12 +0000295// FunctionPass Implementation
Chris Lattner26e4f892002-01-21 07:37:31 +0000296//
Chris Lattnercdd09c22002-01-31 00:45:31 +0000297
Chris Lattnerc8e66542002-04-27 06:56:12 +0000298// run - On a module, we run this pass by initializing, runOnFunction'ing once
299// for every function in the module, then by finalizing.
Chris Lattnercdd09c22002-01-31 00:45:31 +0000300//
Chris Lattner113f4f42002-06-25 16:13:24 +0000301bool FunctionPass::run(Module &M) {
Chris Lattnercdd09c22002-01-31 00:45:31 +0000302 bool Changed = doInitialization(M);
303
Chris Lattner113f4f42002-06-25 16:13:24 +0000304 for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
305 if (!I->isExternal()) // Passes are not run on external functions!
Chris Lattnerc8e66542002-04-27 06:56:12 +0000306 Changed |= runOnFunction(*I);
Chris Lattnercdd09c22002-01-31 00:45:31 +0000307
308 return Changed | doFinalization(M);
Chris Lattner26e4f892002-01-21 07:37:31 +0000309}
310
Chris Lattnerc8e66542002-04-27 06:56:12 +0000311// run - On a function, we simply initialize, run the function, then finalize.
Chris Lattnercdd09c22002-01-31 00:45:31 +0000312//
Chris Lattner113f4f42002-06-25 16:13:24 +0000313bool FunctionPass::run(Function &F) {
314 if (F.isExternal()) return false;// Passes are not run on external functions!
Chris Lattnercdd09c22002-01-31 00:45:31 +0000315
Chris Lattner113f4f42002-06-25 16:13:24 +0000316 return doInitialization(*F.getParent()) | runOnFunction(F)
317 | doFinalization(*F.getParent());
Chris Lattner26e4f892002-01-21 07:37:31 +0000318}
Chris Lattnerd013ba92002-01-23 05:49:41 +0000319
Chris Lattnerc8e66542002-04-27 06:56:12 +0000320void FunctionPass::addToPassManager(PassManagerT<Module> *PM,
321 AnalysisUsage &AU) {
322 PM->addPass(this, AU);
Chris Lattnerd013ba92002-01-23 05:49:41 +0000323}
Chris Lattnercdd09c22002-01-31 00:45:31 +0000324
Chris Lattnerc8e66542002-04-27 06:56:12 +0000325void FunctionPass::addToPassManager(PassManagerT<Function> *PM,
326 AnalysisUsage &AU) {
327 PM->addPass(this, AU);
Chris Lattnercdd09c22002-01-31 00:45:31 +0000328}
329
330//===----------------------------------------------------------------------===//
331// BasicBlockPass Implementation
332//
333
Chris Lattnerc8e66542002-04-27 06:56:12 +0000334// To run this pass on a function, we simply call runOnBasicBlock once for each
335// function.
Chris Lattnercdd09c22002-01-31 00:45:31 +0000336//
Chris Lattner113f4f42002-06-25 16:13:24 +0000337bool BasicBlockPass::runOnFunction(Function &F) {
Chris Lattnercdd09c22002-01-31 00:45:31 +0000338 bool Changed = false;
Chris Lattner113f4f42002-06-25 16:13:24 +0000339 for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I)
Chris Lattnercdd09c22002-01-31 00:45:31 +0000340 Changed |= runOnBasicBlock(*I);
341 return Changed;
342}
343
344// To run directly on the basic block, we initialize, runOnBasicBlock, then
345// finalize.
346//
Chris Lattner113f4f42002-06-25 16:13:24 +0000347bool BasicBlockPass::run(BasicBlock &BB) {
348 Module &M = *BB.getParent()->getParent();
Chris Lattnercdd09c22002-01-31 00:45:31 +0000349 return doInitialization(M) | runOnBasicBlock(BB) | doFinalization(M);
350}
351
Chris Lattner57698e22002-03-26 18:01:55 +0000352void BasicBlockPass::addToPassManager(PassManagerT<Function> *PM,
Chris Lattnerc8e66542002-04-27 06:56:12 +0000353 AnalysisUsage &AU) {
354 PM->addPass(this, AU);
Chris Lattnercdd09c22002-01-31 00:45:31 +0000355}
356
357void BasicBlockPass::addToPassManager(PassManagerT<BasicBlock> *PM,
Chris Lattnerc8e66542002-04-27 06:56:12 +0000358 AnalysisUsage &AU) {
359 PM->addPass(this, AU);
Chris Lattnercdd09c22002-01-31 00:45:31 +0000360}
361
Chris Lattner37d3c952002-07-23 18:08:00 +0000362
363//===----------------------------------------------------------------------===//
364// Pass Registration mechanism
365//
366static std::map<TypeInfo, PassInfo*> *PassInfoMap = 0;
367static std::vector<PassRegistrationListener*> *Listeners = 0;
368
369// getPassInfo - Return the PassInfo data structure that corresponds to this
370// pass...
371const PassInfo *Pass::getPassInfo() const {
Chris Lattner071577d2002-07-29 21:02:31 +0000372 if (PassInfoCache) return PassInfoCache;
Chris Lattner4b169632002-08-21 17:08:37 +0000373 return lookupPassInfo(typeid(*this));
374}
375
376const PassInfo *Pass::lookupPassInfo(const std::type_info &TI) {
Chris Lattner071577d2002-07-29 21:02:31 +0000377 if (PassInfoMap == 0) return 0;
Chris Lattner4b169632002-08-21 17:08:37 +0000378 std::map<TypeInfo, PassInfo*>::iterator I = PassInfoMap->find(TI);
Chris Lattner071577d2002-07-29 21:02:31 +0000379 return (I != PassInfoMap->end()) ? I->second : 0;
Chris Lattner37d3c952002-07-23 18:08:00 +0000380}
381
382void RegisterPassBase::registerPass(PassInfo *PI) {
383 if (PassInfoMap == 0)
384 PassInfoMap = new std::map<TypeInfo, PassInfo*>();
385
386 assert(PassInfoMap->find(PI->getTypeInfo()) == PassInfoMap->end() &&
387 "Pass already registered!");
388 PIObj = PI;
389 PassInfoMap->insert(std::make_pair(TypeInfo(PI->getTypeInfo()), PI));
390
391 // Notify any listeners...
392 if (Listeners)
393 for (std::vector<PassRegistrationListener*>::iterator
394 I = Listeners->begin(), E = Listeners->end(); I != E; ++I)
395 (*I)->passRegistered(PI);
396}
397
398RegisterPassBase::~RegisterPassBase() {
399 assert(PassInfoMap && "Pass registered but not in map!");
400 std::map<TypeInfo, PassInfo*>::iterator I =
401 PassInfoMap->find(PIObj->getTypeInfo());
402 assert(I != PassInfoMap->end() && "Pass registered but not in map!");
403
404 // Remove pass from the map...
405 PassInfoMap->erase(I);
406 if (PassInfoMap->empty()) {
407 delete PassInfoMap;
408 PassInfoMap = 0;
409 }
410
411 // Notify any listeners...
412 if (Listeners)
413 for (std::vector<PassRegistrationListener*>::iterator
414 I = Listeners->begin(), E = Listeners->end(); I != E; ++I)
415 (*I)->passUnregistered(PIObj);
416
417 // Delete the PassInfo object itself...
418 delete PIObj;
419}
420
421
422
423//===----------------------------------------------------------------------===//
424// PassRegistrationListener implementation
425//
426
427// PassRegistrationListener ctor - Add the current object to the list of
428// PassRegistrationListeners...
429PassRegistrationListener::PassRegistrationListener() {
430 if (!Listeners) Listeners = new std::vector<PassRegistrationListener*>();
431 Listeners->push_back(this);
432}
433
434// dtor - Remove object from list of listeners...
435PassRegistrationListener::~PassRegistrationListener() {
436 std::vector<PassRegistrationListener*>::iterator I =
437 std::find(Listeners->begin(), Listeners->end(), this);
438 assert(Listeners && I != Listeners->end() &&
439 "PassRegistrationListener not registered!");
440 Listeners->erase(I);
441
442 if (Listeners->empty()) {
443 delete Listeners;
444 Listeners = 0;
445 }
446}
447
448// enumeratePasses - Iterate over the registered passes, calling the
449// passEnumerate callback on each PassInfo object.
450//
451void PassRegistrationListener::enumeratePasses() {
452 if (PassInfoMap)
453 for (std::map<TypeInfo, PassInfo*>::iterator I = PassInfoMap->begin(),
454 E = PassInfoMap->end(); I != E; ++I)
455 passEnumerate(I->second);
456}