parent
87052bc86f
commit
9d9fc90952
|
@ -228,6 +228,11 @@ public:
|
||||||
InheritedAnalysis[i] = NULL;
|
InheritedAnalysis[i] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Return true if P preserves high level analysis used by other
|
||||||
|
// passes that are managed by this manager.
|
||||||
|
bool preserveHigherLevelAnalysis(Pass *P);
|
||||||
|
|
||||||
|
|
||||||
/// Populate RequiredPasses with the analysis pass that are required by
|
/// Populate RequiredPasses with the analysis pass that are required by
|
||||||
/// pass P.
|
/// pass P.
|
||||||
void collectRequiredAnalysisPasses(std::vector<Pass *> &RequiredPasses,
|
void collectRequiredAnalysisPasses(std::vector<Pass *> &RequiredPasses,
|
||||||
|
@ -298,6 +303,10 @@ private:
|
||||||
// scheduled to run.
|
// scheduled to run.
|
||||||
std::map<AnalysisID, Pass*> AvailableAnalysis;
|
std::map<AnalysisID, Pass*> AvailableAnalysis;
|
||||||
|
|
||||||
|
// Collection of higher level analysis used by the pass managed by
|
||||||
|
// this manager.
|
||||||
|
std::vector<Pass *> HigherLevelAnalysis;
|
||||||
|
|
||||||
unsigned Depth;
|
unsigned Depth;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -532,6 +532,30 @@ void PMDataManager::recordAvailableAnalysis(Pass *P) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Return true if P preserves high level analysis used by other
|
||||||
|
// passes managed by this manager
|
||||||
|
bool PMDataManager::preserveHigherLevelAnalysis(Pass *P) {
|
||||||
|
|
||||||
|
AnalysisUsage AnUsage;
|
||||||
|
P->getAnalysisUsage(AnUsage);
|
||||||
|
|
||||||
|
if (AnUsage.getPreservesAll())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
const std::vector<AnalysisID> &PreservedSet = AnUsage.getPreservedSet();
|
||||||
|
for (std::vector<Pass *>::iterator I = HigherLevelAnalysis.begin(),
|
||||||
|
E = HigherLevelAnalysis.end(); I != E; ++I) {
|
||||||
|
Pass *P1 = *I;
|
||||||
|
if (std::find(PreservedSet.begin(), PreservedSet.end(), P1->getPassInfo()) ==
|
||||||
|
PreservedSet.end()) {
|
||||||
|
if (!dynamic_cast<ImmutablePass*>(P1))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/// Remove Analyss not preserved by Pass P
|
/// Remove Analyss not preserved by Pass P
|
||||||
void PMDataManager::removeNotPreservedAnalysis(Pass *P) {
|
void PMDataManager::removeNotPreservedAnalysis(Pass *P) {
|
||||||
AnalysisUsage AnUsage;
|
AnalysisUsage AnUsage;
|
||||||
|
@ -634,6 +658,8 @@ void PMDataManager::add(Pass *P,
|
||||||
else if (PDepth > RDepth) {
|
else if (PDepth > RDepth) {
|
||||||
// Let the parent claim responsibility of last use
|
// Let the parent claim responsibility of last use
|
||||||
TransferLastUses.push_back(PRequired);
|
TransferLastUses.push_back(PRequired);
|
||||||
|
// Keep track of higher level analysis used by this manager.
|
||||||
|
HigherLevelAnalysis.push_back(PRequired);
|
||||||
} else {
|
} else {
|
||||||
// Note : This feature is not yet implemented
|
// Note : This feature is not yet implemented
|
||||||
assert (0 &&
|
assert (0 &&
|
||||||
|
|
Loading…
Reference in New Issue