1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-02-01 05:01:59 +01:00

Keep track of inherited analysis. For example, if a loop pass does not

preserve dominator info then it should update parent FPPassManager's
available analysis info to reflect this.

llvm-svn: 34942
This commit is contained in:
Devang Patel 2007-03-06 01:55:46 +00:00
parent edbde240be
commit 45343b04b3
3 changed files with 44 additions and 1 deletions

View File

@ -64,7 +64,8 @@ enum PassManagerType {
PMT_CallGraphPassManager, /// CGPassManager PMT_CallGraphPassManager, /// CGPassManager
PMT_FunctionPassManager, /// FPPassManager PMT_FunctionPassManager, /// FPPassManager
PMT_LoopPassManager, /// LPPassManager PMT_LoopPassManager, /// LPPassManager
PMT_BasicBlockPassManager /// BBPassManager PMT_BasicBlockPassManager, /// BBPassManager
PMT_Last
}; };
typedef enum PassManagerType PassManagerType; typedef enum PassManagerType PassManagerType;

View File

@ -197,6 +197,7 @@ private:
/// used by pass managers. /// used by pass managers.
class PMDataManager { class PMDataManager {
public: public:
PMDataManager(int Depth) : TPM(NULL), Depth(Depth) { PMDataManager(int Depth) : TPM(NULL), Depth(Depth) {
initializeAnalysisInfo(); initializeAnalysisInfo();
} }
@ -223,6 +224,8 @@ public:
/// Initialize available analysis information. /// Initialize available analysis information.
void initializeAnalysisInfo() { void initializeAnalysisInfo() {
AvailableAnalysis.clear(); AvailableAnalysis.clear();
for (unsigned i = 0; i < PMT_Last; ++i)
InheritedAnalysis[i] = NULL;
} }
/// Populate RequiredPasses with the analysis pass that are required by /// Populate RequiredPasses with the analysis pass that are required by
@ -262,6 +265,19 @@ public:
assert ( 0 && "Invalid use of getPassManagerType"); assert ( 0 && "Invalid use of getPassManagerType");
return PMT_Unknown; return PMT_Unknown;
} }
std::map<AnalysisID, Pass*> *getAvailableAnalysis() {
return &AvailableAnalysis;
}
// Collect AvailableAnalysis from all the active Pass Managers.
void populateInheritedAnalysis(PMStack &PMS) {
unsigned Index = 0;
for (PMStack::iterator I = PMS.begin(), E = PMS.end();
I != E; ++I)
InheritedAnalysis[Index++] = (*I)->getAvailableAnalysis();
}
protected: protected:
// Top level manager. // Top level manager.
@ -270,6 +286,11 @@ protected:
// Collection of pass that are managed by this manager // Collection of pass that are managed by this manager
std::vector<Pass *> PassVector; std::vector<Pass *> PassVector;
// Collection of Analysis provided by Parent pass manager and
// used by current pass manager. At at time there can not be more
// then PMT_Last active pass mangers.
std::map<AnalysisID, Pass *> *InheritedAnalysis[PMT_Last];
private: private:
// Set of available Analysis. This information is used while scheduling // Set of available Analysis. This information is used while scheduling
// pass. If a pass requires an analysis which is not not available then // pass. If a pass requires an analysis which is not not available then

View File

@ -551,6 +551,27 @@ void PMDataManager::removeNotPreservedAnalysis(Pass *P) {
AvailableAnalysis.erase(Info); AvailableAnalysis.erase(Info);
} }
} }
// Check inherited analysis also. If P is not preserving analysis
// provided by parent manager then remove it here.
for (unsigned Index = 0; Index < PMT_Last; ++Index) {
if (!InheritedAnalysis[Index])
continue;
for (std::map<AnalysisID, Pass*>::iterator
I = InheritedAnalysis[Index]->begin(),
E = InheritedAnalysis[Index]->end(); I != E; ) {
std::map<AnalysisID, Pass *>::iterator Info = I++;
if (std::find(PreservedSet.begin(), PreservedSet.end(), Info->first) ==
PreservedSet.end()) {
// Remove this analysis
if (!dynamic_cast<ImmutablePass*>(Info->second))
InheritedAnalysis[Index]->erase(Info);
}
}
}
} }
/// Remove analysis passes that are not used any longer /// Remove analysis passes that are not used any longer