While adding pass into the manager, process Analysis only if it is

required to do so.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31669 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Devang Patel 2006-11-11 02:04:19 +00:00
parent f13dc1b9e8
commit 893a5a6815

View File

@ -48,8 +48,8 @@ public:
void removeDeadPasses() { /* TODO : Implement */ }
/// Add pass P into the PassVector. Update RequiredAnalysis and
/// AvailableAnalysis appropriately
void addPassToManager (Pass *P);
/// AvailableAnalysis appropriately if ProcessAnalysis is true.
void addPassToManager (Pass *P, bool ProcessAnalysis = true);
inline std::vector<Pass *>::iterator passVectorBegin() {
return PassVector.begin();
@ -248,18 +248,21 @@ void CommonPassManagerImpl::removeNotPreservedAnalysis(Pass *P) {
}
/// Add pass P into the PassVector. Update RequiredAnalysis and
/// AvailableAnalysis appropriately
void CommonPassManagerImpl::addPassToManager (Pass *P) {
/// AvailableAnalysis appropriately if ProcessAnalysis is true.
void CommonPassManagerImpl::addPassToManager (Pass *P,
bool ProcessAnalysis) {
// Take a note of analysis required and made available by this pass
noteDownRequiredAnalysis(P);
noteDownAvailableAnalysis(P);
if (ProcessAnalysis) {
// Take a note of analysis required and made available by this pass
noteDownRequiredAnalysis(P);
noteDownAvailableAnalysis(P);
// Remove the analysis not preserved by this pass
removeNotPreservedAnalysis(P);
}
// Add pass
PassVector.push_back(P);
// Remove the analysis not preserved by this pass
removeNotPreservedAnalysis(P);
}
/// BasicBlockPassManager implementation
@ -341,7 +344,7 @@ FunctionPassManagerImpl_New::addPass(Pass *P) {
|| !activeBBPassManager->addPass(BP)) {
activeBBPassManager = new BasicBlockPassManager_New();
addPassToManager(activeBBPassManager);
addPassToManager(activeBBPassManager, false);
if (!activeBBPassManager->addPass(BP))
assert(0 && "Unable to add Pass");
}
@ -397,7 +400,7 @@ ModulePassManager_New::addPass(Pass *P) {
|| !activeFunctionPassManager->addPass(P)) {
activeFunctionPassManager = new FunctionPassManagerImpl_New();
addPassToManager(activeFunctionPassManager);
addPassToManager(activeFunctionPassManager, false);
if (!activeFunctionPassManager->addPass(FP))
assert(0 && "Unable to add pass");
}