Cosmetic changes, based on Chris's review.

llvm-svn: 32618
This commit is contained in:
Devang Patel 2006-12-15 22:57:49 +00:00
parent 03161dd132
commit fb82dcf9ee

View File

@ -221,7 +221,7 @@ namespace llvm {
/// used by pass managers. /// used by pass managers.
class PMDataManager { class PMDataManager {
public: public:
PMDataManager(int D) : TPM(NULL), Depth(D) { PMDataManager(int Depth) : TPM(NULL), Depth(Depth) {
initializeAnalysisInfo(); initializeAnalysisInfo();
} }
@ -331,7 +331,7 @@ class VISIBILITY_HIDDEN BasicBlockPassManager : public PMDataManager,
public FunctionPass { public FunctionPass {
public: public:
BasicBlockPassManager(int D) : PMDataManager(D) { } BasicBlockPassManager(int Depth) : PMDataManager(Depth) { }
/// Add a pass into a passmanager queue. /// Add a pass into a passmanager queue.
bool addPass(Pass *p); bool addPass(Pass *p);
@ -372,7 +372,7 @@ class FunctionPassManagerImpl_New : public ModulePass,
public PMDataManager, public PMDataManager,
public PMTopLevelManager { public PMTopLevelManager {
public: public:
FunctionPassManagerImpl_New(int D) : PMDataManager(D) { FunctionPassManagerImpl_New(int Depth) : PMDataManager(Depth) {
activeBBPassManager = NULL; activeBBPassManager = NULL;
} }
~FunctionPassManagerImpl_New() { /* TODO */ }; ~FunctionPassManagerImpl_New() { /* TODO */ };
@ -449,7 +449,7 @@ private:
class ModulePassManager : public Pass, public PMDataManager { class ModulePassManager : public Pass, public PMDataManager {
public: public:
ModulePassManager(int D) : PMDataManager(D) { ModulePassManager(int Depth) : PMDataManager(Depth) {
activeFunctionPassManager = NULL; activeFunctionPassManager = NULL;
} }
@ -490,7 +490,7 @@ class PassManagerImpl_New : public Pass,
public: public:
PassManagerImpl_New(int D) : PMDataManager(D) { PassManagerImpl_New(int Depth) : PMDataManager(Depth) {
activeManager = NULL; activeManager = NULL;
} }
@ -674,12 +674,9 @@ Pass *PMTopLevelManager::findAnalysisPass(AnalysisID AID) {
// If Pass not found then check the interfaces implemented by Immutable Pass // If Pass not found then check the interfaces implemented by Immutable Pass
if (!P) { if (!P) {
const std::vector<const PassInfo*> &ImmPI = const std::vector<const PassInfo*> &ImmPI = PI->getInterfacesImplemented();
PI->getInterfacesImplemented(); if (std::find(ImmPI.begin(), ImmPI.end(), AID) != ImmPI.end())
for (unsigned Index = 0, End = ImmPI.size(); P = *I;
P == NULL && Index != End; ++Index)
if (ImmPI[Index] == AID)
P = *I;
} }
} }
@ -756,16 +753,13 @@ void PMDataManager::removeNotPreservedAnalysis(Pass *P) {
const std::vector<AnalysisID> &PreservedSet = AnUsage.getPreservedSet(); const std::vector<AnalysisID> &PreservedSet = AnUsage.getPreservedSet();
for (std::map<AnalysisID, Pass*>::iterator I = AvailableAnalysis.begin(), for (std::map<AnalysisID, Pass*>::iterator I = AvailableAnalysis.begin(),
E = AvailableAnalysis.end(); I != E; ) { E = AvailableAnalysis.end(); I != E; ) {
if (std::find(PreservedSet.begin(), PreservedSet.end(), I->first) == std::map<AnalysisID, Pass*>::iterator Info = I++;
if (std::find(PreservedSet.begin(), PreservedSet.end(), Info->first) ==
PreservedSet.end()) { PreservedSet.end()) {
// Remove this analysis // Remove this analysis
if (!dynamic_cast<ImmutablePass*>(I->second)) { if (!dynamic_cast<ImmutablePass*>(Info->second))
std::map<AnalysisID, Pass*>::iterator J = I++; AvailableAnalysis.erase(Info);
AvailableAnalysis.erase(J); }
} else
++I;
} else
++I;
} }
} }
@ -975,8 +969,8 @@ BasicBlockPassManager::addPass(Pass *P) {
if (!BP) if (!BP)
return false; return false;
// If this pass does not preserve anlysis that is used by other passes // If this pass does not preserve analysis that is used by other passes
// managed by this manager than it is not a suiable pass for this manager. // managed by this manager than it is not a suitable pass for this manager.
if (!manageablePass(P)) if (!manageablePass(P))
return false; return false;
@ -1026,7 +1020,7 @@ BasicBlockPassManager::runOnFunction(Function &F) {
recordAvailableAnalysis(P); recordAvailableAnalysis(P);
removeDeadPasses(P, Msg2); removeDeadPasses(P, Msg2);
} }
return Changed | doFinalization(F); return Changed |= doFinalization(F);
} }
// Implement doInitialization and doFinalization // Implement doInitialization and doFinalization
@ -1197,8 +1191,8 @@ FunctionPassManagerImpl_New::addPass(Pass *P) {
if (!FP) if (!FP)
return false; return false;
// If this pass does not preserve anlysis that is used by other passes // If this pass does not preserve analysis that is used by other passes
// managed by this manager than it is not a suiable pass for this manager. // managed by this manager than it is not a suitable pass for this manager.
if (!manageablePass(P)) if (!manageablePass(P))
return false; return false;
@ -1224,7 +1218,7 @@ bool FunctionPassManagerImpl_New::runOnModule(Module &M) {
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
this->runOnFunction(*I); this->runOnFunction(*I);
return Changed | doFinalization(M); return Changed |= doFinalization(M);
} }
/// Execute all of the passes scheduled for execution by invoking /// Execute all of the passes scheduled for execution by invoking
@ -1366,8 +1360,8 @@ ModulePassManager::addPass(Pass *P) {
if (!MP) if (!MP)
return false; return false;
// If this pass does not preserve anlysis that is used by other passes // If this pass does not preserve analysis that is used by other passes
// managed by this manager than it is not a suiable pass for this manager. // managed by this manager than it is not a suitable pass for this manager.
if (!manageablePass(P)) if (!manageablePass(P))
return false; return false;