llvm.org GIT mirror llvm / 1cee94f
Identify Analysis pass. Do not run analysis pass again if analysis info is still available. This fixes PR1441. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48476 91177308-0d34-0410-b5e6-96231b3b80d8 Devang Patel 12 years ago
19 changed file(s) with 83 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
299299 // FIXME: Should remove this
300300 virtual bool runOnFunction(Function &F) { return false; }
301301
302 /// isAnalysis - Return true if this pass is implementing an analysis pass.
303 virtual bool isAnalysis() const { return true; }
304
302305 virtual void releaseMemory() { reset(); }
303306
304307 /// getNode - return the (Post)DominatorTree node for the specified basic
690693 return DT->getRootNode();
691694 }
692695
696 /// isAnalysis - Return true if this pass is implementing an analysis pass.
697 virtual bool isAnalysis() const { return true; }
698
693699 virtual bool runOnFunction(Function &F);
694700
695701 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
908914 assert(Roots.size() == 1 && "Should always have entry node!");
909915 return Roots[0];
910916 }
917
918 /// isAnalysis - Return true if this pass is implementing an analysis pass.
919 virtual bool isAnalysis() const { return true; }
911920
912921 virtual bool runOnFunction(Function &) {
913922 Frontiers.clear();
4949 void IncorporateValue(const Value *V);
5050
5151 public:
52
53 /// isAnalysis - Return true if this pass is implementing an analysis pass.
54 virtual bool isAnalysis() const { return true; }
55
5256 /// run - This incorporates all types used by the specified module
5357 bool runOnModule(Module &M);
5458
4747 static char ID; // Pass identification, replacement for typeid
4848
4949 IntervalPartition() : FunctionPass((intptr_t)&ID), RootInterval(0) {}
50
51 /// isAnalysis - Return true if this pass is implementing an analysis pass.
52 virtual bool isAnalysis() const { return true; }
5053
5154 // run - Calculate the interval partition for this function
5255 virtual bool runOnFunction(Function &F);
579579 LoopInfoBase() { }
580580 ~LoopInfoBase() { releaseMemory(); }
581581
582 /// isAnalysis - Return true if this pass is implementing an analysis pass.
583 virtual bool isAnalysis() const { return true; }
584
582585 void releaseMemory() {
583586 for (typename std::vector* >::iterator I =
584587 TopLevelLoops.begin(), E = TopLevelLoops.end(); I != E; ++I)
6767 static char ID; // Class identification, replacement for typeinfo
6868 MemoryDependenceAnalysis() : FunctionPass((intptr_t)&ID) {}
6969
70 /// isAnalysis - Return true if this pass is implementing an analysis pass.
71 virtual bool isAnalysis() const { return true; }
72
7073 /// Pass Implementation stuff. This doesn't do any analysis.
7174 ///
7275 bool runOnFunction(Function &) {return false; }
2727 PostDominatorTree() : FunctionPass((intptr_t)&ID) {
2828 DT = new DominatorTreeBase(true);
2929 }
30
31 /// isAnalysis - Return true if this pass is implementing an analysis pass.
32 virtual bool isAnalysis() const { return true; }
3033
3134 virtual bool runOnFunction(Function &F);
3235
6871 PostDominanceFrontier()
6972 : DominanceFrontierBase((intptr_t) &ID, true) {}
7073
74 /// isAnalysis - Return true if this pass is implementing an analysis pass.
75 virtual bool isAnalysis() const { return true; }
76
7177 virtual bool runOnFunction(Function &) {
7278 Frontiers.clear();
7379 PostDominatorTree &DT = getAnalysis();
290290 /// that no dangling references are left around.
291291 void deleteValueFromRecords(Value *V) const;
292292
293 /// isAnalysis - Return true if this pass is implementing an analysis pass.
294 virtual bool isAnalysis() const { return true; }
295
293296 virtual bool runOnFunction(Function &F);
294297 virtual void releaseMemory();
295298 virtual void getAnalysisUsage(AnalysisUsage &AU) const;
129129 return Resolver;
130130 }
131131
132 /// isAnalysis - Return true if this pass is implementing an analysis pass.
133 virtual bool isAnalysis() const {
134 return false;
135 }
136
132137 /// getAnalysisUsage - This function should be overriden by passes that need
133138 /// analysis information to do their job. If a pass specifies that it uses a
134139 /// particular analysis result to this function, it can then use the
7070 }
7171 }
7272 }
73
74 /// isAnalysis - Return true if this pass is implementing an analysis pass.
75 virtual bool isAnalysis() const { return true; }
7376
7477 bool runOnModule(Module &M) {
7578 this->M = &M;
6868 }
6969 return false;
7070 }
71
72 /// isAnalysis - Return true if this pass is implementing an analysis pass.
73 virtual bool isAnalysis() const { return true; }
7174
7275 bool runOnFunction(Function &F);
7376 bool doFinalization(Module &M);
4141 public:
4242 static char ID; // Class identification, replacement for typeinfo
4343 AliasDebugger() : ModulePass((intptr_t)&ID) {}
44
45 /// isAnalysis - Return true if this pass is implementing an analysis pass.
46 virtual bool isAnalysis() const { return true; }
4447
4548 bool runOnModule(Module &M) {
4649 InitializeAliasAnalysis(this); // set up super class
557557 AU.addRequired();
558558 }
559559
560 /// isAnalysis - Return true if this pass is implementing an analysis pass.
561 virtual bool isAnalysis() const { return true; }
562
560563 virtual bool runOnFunction(Function &F) {
561564 Tracker = new AliasSetTracker(getAnalysis());
562565
9393 static char ID; // Pass identifcation, replacement for typeid
9494 CFGViewer() : FunctionPass((intptr_t)&ID) {}
9595
96 /// isAnalysis - Return true if this pass is implementing an analysis pass.
97 virtual bool isAnalysis() const { return true; }
98
9699 virtual bool runOnFunction(Function &F) {
97100 F.viewCFG();
98101 return false;
112115 struct VISIBILITY_HIDDEN CFGOnlyViewer : public FunctionPass {
113116 static char ID; // Pass identifcation, replacement for typeid
114117 CFGOnlyViewer() : FunctionPass((intptr_t)&ID) {}
118
119 /// isAnalysis - Return true if this pass is implementing an analysis pass.
120 virtual bool isAnalysis() const { return true; }
115121
116122 virtual bool runOnFunction(Function &F) {
117123 CFGOnly = true;
135141 static char ID; // Pass identification, replacement for typeid
136142 CFGPrinter() : FunctionPass((intptr_t)&ID) {}
137143 explicit CFGPrinter(intptr_t pid) : FunctionPass(pid) {}
144
145 /// isAnalysis - Return true if this pass is implementing an analysis pass.
146 virtual bool isAnalysis() const { return true; }
138147
139148 virtual bool runOnFunction(Function &F) {
140149 std::string Filename = "cfg." + F.getName() + ".dot";
163172 struct VISIBILITY_HIDDEN CFGOnlyPrinter : public CFGPrinter {
164173 static char ID; // Pass identification, replacement for typeid
165174 CFGOnlyPrinter() : CFGPrinter((intptr_t)&ID) {}
175
176 /// isAnalysis - Return true if this pass is implementing an analysis pass.
177 virtual bool isAnalysis() const { return true; }
178
166179 virtual bool runOnFunction(Function &F) {
167180 bool OldCFGOnly = CFGOnly;
168181 CFGOnly = true;
431431 static char ID;
432432 Andersens() : ModulePass((intptr_t)&ID) {}
433433
434 /// isAnalysis - Return true if this pass is implementing an analysis pass.
435 virtual bool isAnalysis() const { return true; }
436
434437 bool runOnModule(Module &M) {
435438 InitializeAliasAnalysis(this);
436439 IdentifyObjects(M);
8484 public:
8585 static char ID;
8686 GlobalsModRef() : ModulePass((intptr_t)&ID) {}
87
88 /// isAnalysis - Return true if this pass is implementing an analysis pass.
89 virtual bool isAnalysis() const { return true; }
8790
8891 bool runOnModule(Module &M) {
8992 InitializeAliasAnalysis(this); // set up super class
5050 abort();
5151 }
5252 public:
53
54 /// isAnalysis - Return true if this pass is implementing an analysis pass.
55 virtual bool isAnalysis() const { return true; }
56
5357 static char ID; // Pass identification, replacement for typeid
5458 InstCount() : FunctionPass((intptr_t)&ID) {}
5559
4141 struct VISIBILITY_HIDDEN LoadVN : public FunctionPass, public ValueNumbering {
4242 static char ID; // Class identification, replacement for typeinfo
4343 LoadVN() : FunctionPass((intptr_t)&ID) {}
44
45 /// isAnalysis - Return true if this pass is implementing an analysis pass.
46 virtual bool isAnalysis() const { return true; }
4447
4548 /// Pass Implementation stuff. This doesn't do any analysis.
4649 ///
4545 return "Profiling information loader";
4646 }
4747
48 /// isAnalysis - Return true if this pass is implementing an analysis pass.
49 virtual bool isAnalysis() const { return true; }
50
4851 /// run - Load the profile information from the specified file.
4952 virtual bool runOnModule(Module &M);
5053 };
424424
425425 // Give pass a chance to prepare the stage.
426426 P->preparePassManager(activeStack);
427
428 // If P is an analysis pass and it is available then do not
429 // generate the analysis again. Stale analysis info should not be
430 // available at this point.
431 if (P->isAnalysis() && findAnalysisPass(P->getPassInfo()))
432 return;
427433
428434 AnalysisUsage AnUsage;
429435 P->getAnalysisUsage(AnUsage);