mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-02 07:11:49 +00:00
Keep track of analysis required by the passes. Force use of new pass
manager if a pass does not preserve analysis that is used by other passes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31659 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
448f219fed
commit
a363a0bdef
@ -119,8 +119,8 @@ public:
|
||||
void removeDeadPasses() { /* TODO : Implement */ }
|
||||
|
||||
private:
|
||||
// Required set of analysis for the passes managed by this manager
|
||||
std::vector<AnalysisID> RequiredSet;
|
||||
// Analysis required by the passes managed by this manager
|
||||
std::vector<AnalysisID> RequiredAnalysis;
|
||||
};
|
||||
|
||||
/// PassManager_New manages ModulePassManagers
|
||||
|
@ -142,9 +142,18 @@ bool CommonPassManagerImpl::manageablePass(Pass *P) {
|
||||
AnalysisUsage AnUsage;
|
||||
P->getAnalysisUsage(AnUsage);
|
||||
|
||||
// If this pass is not preserving information that is required by the other passes
|
||||
// managed by this manager then use new manager
|
||||
// TODO
|
||||
// If this pass is not preserving information that is required by the other
|
||||
// passes managed by this manager then use new manager
|
||||
if (!AnUsage.getPreservesAll()) {
|
||||
const std::vector<AnalysisID> &PreservedSet = AnUsage.getPreservedSet();
|
||||
for (std::vector<AnalysisID>::iterator I = RequiredAnalysis.begin(),
|
||||
E = RequiredAnalysis.end(); I != E; ++I) {
|
||||
if (std::find(PreservedSet.begin(), PreservedSet.end(), *I) ==
|
||||
PreservedSet.end())
|
||||
// This analysis is not preserved. Need new manager.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -157,8 +166,12 @@ bool CommonPassManagerImpl::analysisCurrentlyAvailable(AnalysisID AID) {
|
||||
|
||||
/// Augment RequiredSet by adding analysis required by pass P.
|
||||
void CommonPassManagerImpl::noteDownRequiredAnalysis(Pass *P) {
|
||||
AnalysisUsage AnUsage;
|
||||
P->getAnalysisUsage(AnUsage);
|
||||
const std::vector<AnalysisID> &RequiredSet = AnUsage.getRequiredSet();
|
||||
|
||||
// TODO
|
||||
// FIXME: What about duplicates ?
|
||||
RequiredAnalysis.insert(RequiredAnalysis.end(), RequiredSet.begin(), RequiredSet.end());
|
||||
}
|
||||
|
||||
/// Remove AnalysisID from the RequiredSet
|
||||
@ -375,7 +388,7 @@ PassManagerImpl_New::add(Pass *P) {
|
||||
bool
|
||||
PassManagerImpl_New::addPass(Pass *P) {
|
||||
|
||||
if (!activeManager) {
|
||||
if (!activeManager || !activeManager->addPass(P)) {
|
||||
activeManager = new ModulePassManager_New();
|
||||
PassManagers.push_back(activeManager);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user