mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-24 23:28:41 +00:00
Current pass manager, not the parent pass manager, assumes the role of
last user when one of the managed pass uses info provided by parent pass manager. This was exposed by LPPassManager work. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34936 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -158,7 +158,6 @@ public:
|
||||
recordAvailableAnalysis(IP);
|
||||
} else {
|
||||
P->assignPassManager(activeStack);
|
||||
activeStack.handleLastUserOverflow();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -259,7 +258,6 @@ public:
|
||||
recordAvailableAnalysis(IP);
|
||||
} else {
|
||||
P->assignPassManager(activeStack);
|
||||
activeStack.handleLastUserOverflow();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -587,6 +585,10 @@ void PMDataManager::add(Pass *P,
|
||||
AnalysisResolver *AR = new AnalysisResolver(*this);
|
||||
P->setResolver(AR);
|
||||
|
||||
// If a FunctionPass F is the last user of ModulePass info M
|
||||
// then the F's manager, not F, records itself as a last user of M.
|
||||
std::vector<Pass *> TransferLastUses;
|
||||
|
||||
if (ProcessAnalysis) {
|
||||
|
||||
// At the moment, this pass is the last user of all required passes.
|
||||
@@ -622,6 +624,12 @@ void PMDataManager::add(Pass *P,
|
||||
LastUses.push_back(P);
|
||||
TPM->setLastUser(LastUses, P);
|
||||
|
||||
if (!TransferLastUses.empty()) {
|
||||
Pass *My_PM = dynamic_cast<Pass *>(this);
|
||||
TPM->setLastUser(TransferLastUses, My_PM);
|
||||
TransferLastUses.clear();
|
||||
}
|
||||
|
||||
// Take a note of analysis required and made available by this pass.
|
||||
// Remove the analysis not preserved by this pass
|
||||
removeNotPreservedAnalysis(P);
|
||||
@@ -1231,26 +1239,6 @@ void PMStack::dump() {
|
||||
printf ("\n");
|
||||
}
|
||||
|
||||
// Walk Pass Manager stack and set LastUse markers if any
|
||||
// manager is transfering this priviledge to its parent manager
|
||||
void PMStack::handleLastUserOverflow() {
|
||||
|
||||
for(PMStack::iterator I = this->begin(), E = this->end(); I != E;) {
|
||||
|
||||
PMDataManager *Child = *I++;
|
||||
if (I != E) {
|
||||
PMDataManager *Parent = *I++;
|
||||
PMTopLevelManager *TPM = Parent->getTopLevelManager();
|
||||
std::vector<Pass *> &TLU = Child->getTransferredLastUses();
|
||||
if (!TLU.empty()) {
|
||||
Pass *P = dynamic_cast<Pass *>(Parent);
|
||||
TPM->setLastUser(TLU, P);
|
||||
TLU.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Find appropriate Module Pass Manager in the PM Stack and
|
||||
/// add self into that manager.
|
||||
void ModulePass::assignPassManager(PMStack &PMS,
|
||||
|
Reference in New Issue
Block a user