* Eliminate the Provided set. All Passes now finally just automatically

provide themselves.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3125 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2002-07-29 21:03:38 +00:00
parent eb702350f7
commit d472e47b6c
9 changed files with 16 additions and 37 deletions

View File

@@ -132,7 +132,6 @@ public:
// getAnalysisUsage - This obviously provides a call graph // getAnalysisUsage - This obviously provides a call graph
virtual void getAnalysisUsage(AnalysisUsage &AU) const { virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll(); AU.setPreservesAll();
AU.addProvided(ID);
} }
// releaseMemory - Data structures can be large, so free memory aggressively. // releaseMemory - Data structures can be large, so free memory aggressively.

View File

@@ -350,7 +350,6 @@ public:
// getAnalysisUsage - This obviously provides a data structure graph. // getAnalysisUsage - This obviously provides a data structure graph.
virtual void getAnalysisUsage(AnalysisUsage &AU) const { virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll(); AU.setPreservesAll();
AU.addProvided(ID);
} }
}; };
@@ -385,7 +384,6 @@ public:
// getAnalysisUsage - This obviously provides a data structure graph. // getAnalysisUsage - This obviously provides a data structure graph.
virtual void getAnalysisUsage(AnalysisUsage &AU) const { virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll(); AU.setPreservesAll();
AU.addProvided(ID);
AU.addRequired(LocalDataStructures::ID); AU.addRequired(LocalDataStructures::ID);
} }
private: private:
@@ -427,7 +425,6 @@ public:
// getAnalysisUsage - This obviously provides a data structure graph. // getAnalysisUsage - This obviously provides a data structure graph.
virtual void getAnalysisUsage(AnalysisUsage &AU) const { virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll(); AU.setPreservesAll();
AU.addProvided(ID);
AU.addRequired(BUDataStructures::ID); AU.addRequired(BUDataStructures::ID);
} }
private: private:

View File

@@ -350,7 +350,6 @@ public:
// getAnalysisUsage - This obviously provides a data structure graph. // getAnalysisUsage - This obviously provides a data structure graph.
virtual void getAnalysisUsage(AnalysisUsage &AU) const { virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll(); AU.setPreservesAll();
AU.addProvided(ID);
} }
}; };
@@ -385,7 +384,6 @@ public:
// getAnalysisUsage - This obviously provides a data structure graph. // getAnalysisUsage - This obviously provides a data structure graph.
virtual void getAnalysisUsage(AnalysisUsage &AU) const { virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll(); AU.setPreservesAll();
AU.addProvided(ID);
AU.addRequired(LocalDataStructures::ID); AU.addRequired(LocalDataStructures::ID);
} }
private: private:
@@ -427,7 +425,6 @@ public:
// getAnalysisUsage - This obviously provides a data structure graph. // getAnalysisUsage - This obviously provides a data structure graph.
virtual void getAnalysisUsage(AnalysisUsage &AU) const { virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll(); AU.setPreservesAll();
AU.addProvided(ID);
AU.addRequired(BUDataStructures::ID); AU.addRequired(BUDataStructures::ID);
} }
private: private:

View File

@@ -106,7 +106,6 @@ struct DominatorSet : public DominatorSetBase {
// getAnalysisUsage - This simply provides a dominator set // getAnalysisUsage - This simply provides a dominator set
virtual void getAnalysisUsage(AnalysisUsage &AU) const { virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll(); AU.setPreservesAll();
AU.addProvided(ID);
} }
}; };
@@ -184,7 +183,6 @@ struct ImmediateDominators : public ImmediateDominatorsBase {
virtual void getAnalysisUsage(AnalysisUsage &AU) const { virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll(); AU.setPreservesAll();
AU.addProvided(ID);
AU.addRequired(DominatorSet::ID); AU.addRequired(DominatorSet::ID);
} }
}; };
@@ -210,7 +208,6 @@ struct ImmediatePostDominators : public ImmediateDominatorsBase {
virtual void getAnalysisUsage(AnalysisUsage &AU) const { virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll(); AU.setPreservesAll();
AU.addRequired(PostDominatorSet::ID); AU.addRequired(PostDominatorSet::ID);
AU.addProvided(ID);
} }
}; };
@@ -290,7 +287,6 @@ struct DominatorTree : public DominatorTreeBase {
virtual void getAnalysisUsage(AnalysisUsage &AU) const { virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll(); AU.setPreservesAll();
AU.addProvided(ID);
AU.addRequired(DominatorSet::ID); AU.addRequired(DominatorSet::ID);
} }
private: private:
@@ -318,7 +314,6 @@ struct PostDominatorTree : public DominatorTreeBase {
virtual void getAnalysisUsage(AnalysisUsage &AU) const { virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll(); AU.setPreservesAll();
AU.addRequired(PostDominatorSet::ID); AU.addRequired(PostDominatorSet::ID);
AU.addProvided(ID);
} }
private: private:
void calculate(const PostDominatorSet &DS); void calculate(const PostDominatorSet &DS);
@@ -370,7 +365,6 @@ struct DominanceFrontier : public DominanceFrontierBase {
virtual void getAnalysisUsage(AnalysisUsage &AU) const { virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll(); AU.setPreservesAll();
AU.addProvided(ID);
AU.addRequired(DominatorTree::ID); AU.addRequired(DominatorTree::ID);
} }
private: private:
@@ -400,7 +394,6 @@ struct PostDominanceFrontier : public DominanceFrontierBase {
virtual void getAnalysisUsage(AnalysisUsage &AU) const { virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll(); AU.setPreservesAll();
AU.addRequired(PostDominatorTree::ID); AU.addRequired(PostDominatorTree::ID);
AU.addProvided(ID);
} }
private: private:
const DomSetType &calculate(const PostDominatorTree &DT, const DomSetType &calculate(const PostDominatorTree &DT,

View File

@@ -47,7 +47,6 @@ public:
// //
virtual void getAnalysisUsage(AnalysisUsage &AU) const { virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll(); AU.setPreservesAll();
AU.addProvided(ID);
} }
}; };

View File

@@ -46,7 +46,6 @@ public:
// //
virtual void getAnalysisUsage(AnalysisUsage &AU) const { virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll(); AU.setPreservesAll();
AU.addProvided(ID);
} }
}; };

View File

@@ -73,7 +73,6 @@ public:
// getAnalysisUsage - Implement the Pass API // getAnalysisUsage - Implement the Pass API
virtual void getAnalysisUsage(AnalysisUsage &AU) const { virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll(); AU.setPreservesAll();
AU.addProvided(ID);
} }
private: private:

View File

@@ -23,7 +23,6 @@ public:
BasicBlock *getExitNode() const { return ExitNode; } BasicBlock *getExitNode() const { return ExitNode; }
virtual bool runOnFunction(Function &F); virtual bool runOnFunction(Function &F);
virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.addProvided(ID); }
}; };
static inline Pass *createUnifyFunctionExitNodesPass() { static inline Pass *createUnifyFunctionExitNodesPass() {

View File

@@ -81,7 +81,7 @@ class PassManagerT : public PassManagerTraits<UnitType>,public AnalysisResolver{
friend typename Traits::SubPassClass; friend typename Traits::SubPassClass;
friend class Traits; friend class Traits;
std::vector<PassClass*> Passes; // List of pass's to run std::vector<PassClass*> Passes; // List of passes to run
// The parent of this pass manager... // The parent of this pass manager...
ParentClass * const Parent; ParentClass * const Parent;
@@ -160,8 +160,6 @@ public:
(Annotable*)M); (Annotable*)M);
PMDebug::PrintAnalysisSetInfo(getDepth(), "Preserved", P, PMDebug::PrintAnalysisSetInfo(getDepth(), "Preserved", P,
AnUsage.getPreservedSet()); AnUsage.getPreservedSet());
PMDebug::PrintAnalysisSetInfo(getDepth(), "Provided", P,
AnUsage.getProvidedSet());
// Erase all analyses not in the preserved set... // Erase all analyses not in the preserved set...
@@ -183,11 +181,11 @@ public:
} }
} }
// Add all analyses in the provided set... // Add the current pass to the set of passes that have been run, and are
for (std::vector<AnalysisID>::const_iterator // thus available to users.
I = AnUsage.getProvidedSet().begin(), //
E = AnUsage.getProvidedSet().end(); I != E; ++I) if (const PassInfo *PI = P->getPassInfo())
CurrentAnalyses[*I] = P; CurrentAnalyses[PI] = P;
// Free memory for any passes that we are the last use of... // Free memory for any passes that we are the last use of...
std::vector<Pass*> &DeadPass = LastUserOf[P]; std::vector<Pass*> &DeadPass = LastUserOf[P];
@@ -214,7 +212,7 @@ public:
for (std::map<Pass*, Pass*>::iterator I = LastUseOf.begin(), for (std::map<Pass*, Pass*>::iterator I = LastUseOf.begin(),
E = LastUseOf.end(); I != E; ++I) { E = LastUseOf.end(); I != E; ++I) {
if (P == I->second) { if (P == I->second) {
std::cerr << "Fr" << std::string(Offset*2, ' '); std::cerr << "--" << std::string(Offset*2, ' ');
I->first->dumpPassStructure(0); I->first->dumpPassStructure(0);
} }
} }
@@ -321,13 +319,13 @@ private:
// //
void addPass(PassClass *P, AnalysisUsage &AnUsage) { void addPass(PassClass *P, AnalysisUsage &AnUsage) {
const std::vector<AnalysisID> &RequiredSet = AnUsage.getRequiredSet(); const std::vector<AnalysisID> &RequiredSet = AnUsage.getRequiredSet();
const std::vector<AnalysisID> &ProvidedSet = AnUsage.getProvidedSet();
// Providers are analysis classes which are forbidden to modify the module // FIXME: If this pass being added isn't killed by any of the passes in the
// they are operating on, so they are allowed to be reordered to before the // batcher class then we can reorder to pass to execute before the batcher
// batcher... // does, which will potentially allow us to batch more passes!
// //
if (Batcher && ProvidedSet.empty()) //const std::vector<AnalysisID> &ProvidedSet = AnUsage.getProvidedSet();
if (Batcher /*&& ProvidedSet.empty()*/)
closeBatcher(); // This pass cannot be batched! closeBatcher(); // This pass cannot be batched!
// Set the Resolver instance variable in the Pass so that it knows where to // Set the Resolver instance variable in the Pass so that it knows where to
@@ -362,10 +360,9 @@ private:
} }
} }
// Add all analyses in the provided set... // Add this pass to the currently available set...
for (std::vector<AnalysisID>::const_iterator I = ProvidedSet.begin(), if (const PassInfo *PI = P->getPassInfo())
E = ProvidedSet.end(); I != E; ++I) CurrentAnalyses[PI] = P;
CurrentAnalyses[*I] = P;
// For now assume that our results are never used... // For now assume that our results are never used...
LastUseOf[P] = P; LastUseOf[P] = P;
@@ -378,7 +375,7 @@ private:
void addPass(SubPassClass *MP, AnalysisUsage &AnUsage) { void addPass(SubPassClass *MP, AnalysisUsage &AnUsage) {
if (Batcher == 0) // If we don't have a batcher yet, make one now. if (Batcher == 0) // If we don't have a batcher yet, make one now.
Batcher = new BatcherClass(this); Batcher = new BatcherClass(this);
// The Batcher will queue them passes up // The Batcher will queue the passes up
MP->addToPassManager(Batcher, AnUsage); MP->addToPassManager(Batcher, AnUsage);
} }