mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-11 13:46:13 +00: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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34942 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
22a1cf9d3a
commit
fe613905b3
@ -64,7 +64,8 @@ enum PassManagerType {
|
||||
PMT_CallGraphPassManager, /// CGPassManager
|
||||
PMT_FunctionPassManager, /// FPPassManager
|
||||
PMT_LoopPassManager, /// LPPassManager
|
||||
PMT_BasicBlockPassManager /// BBPassManager
|
||||
PMT_BasicBlockPassManager, /// BBPassManager
|
||||
PMT_Last
|
||||
};
|
||||
|
||||
typedef enum PassManagerType PassManagerType;
|
||||
|
@ -197,6 +197,7 @@ private:
|
||||
/// used by pass managers.
|
||||
class PMDataManager {
|
||||
public:
|
||||
|
||||
PMDataManager(int Depth) : TPM(NULL), Depth(Depth) {
|
||||
initializeAnalysisInfo();
|
||||
}
|
||||
@ -223,6 +224,8 @@ public:
|
||||
/// Initialize available analysis information.
|
||||
void initializeAnalysisInfo() {
|
||||
AvailableAnalysis.clear();
|
||||
for (unsigned i = 0; i < PMT_Last; ++i)
|
||||
InheritedAnalysis[i] = NULL;
|
||||
}
|
||||
|
||||
/// Populate RequiredPasses with the analysis pass that are required by
|
||||
@ -262,6 +265,19 @@ public:
|
||||
assert ( 0 && "Invalid use of getPassManagerType");
|
||||
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:
|
||||
|
||||
// Top level manager.
|
||||
@ -270,6 +286,11 @@ protected:
|
||||
// Collection of pass that are managed by this manager
|
||||
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:
|
||||
// Set of available Analysis. This information is used while scheduling
|
||||
// pass. If a pass requires an analysis which is not not available then
|
||||
|
@ -551,6 +551,27 @@ void PMDataManager::removeNotPreservedAnalysis(Pass *P) {
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user