mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-03-15 22:32:35 +00:00
set Last User.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32342 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
eb63b0a9d5
commit
e166340650
@ -243,6 +243,7 @@ public:
|
|||||||
|
|
||||||
/// Initialize available analysis information.
|
/// Initialize available analysis information.
|
||||||
void initializeAnalysisInfo() {
|
void initializeAnalysisInfo() {
|
||||||
|
ForcedLastUses.clear();
|
||||||
AvailableAnalysis.clear();
|
AvailableAnalysis.clear();
|
||||||
|
|
||||||
// Include immutable passes into AvailableAnalysis vector.
|
// Include immutable passes into AvailableAnalysis vector.
|
||||||
@ -277,6 +278,17 @@ public:
|
|||||||
|
|
||||||
unsigned getDepth() { return Depth; }
|
unsigned getDepth() { return Depth; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Collection of pass whose last user asked this manager to claim
|
||||||
|
// last use. 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 *> ForcedLastUses;
|
||||||
|
|
||||||
|
// Top level manager.
|
||||||
|
// TODO : Make it a reference.
|
||||||
|
PMTopLevelManager *TPM;
|
||||||
|
|
||||||
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
|
||||||
@ -287,10 +299,6 @@ private:
|
|||||||
// 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;
|
||||||
|
|
||||||
// Top level manager.
|
|
||||||
// TODO : Make it a reference.
|
|
||||||
PMTopLevelManager *TPM;
|
|
||||||
|
|
||||||
unsigned Depth;
|
unsigned Depth;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -384,7 +392,8 @@ private:
|
|||||||
/// ModulePassManager_New manages ModulePasses and function pass managers.
|
/// ModulePassManager_New manages ModulePasses and function pass managers.
|
||||||
/// It batches all Module passes passes and function pass managers together and
|
/// It batches all Module passes passes and function pass managers together and
|
||||||
/// sequence them to process one module.
|
/// sequence them to process one module.
|
||||||
class ModulePassManager_New : public PMDataManager {
|
class ModulePassManager_New : public Pass,
|
||||||
|
public PMDataManager {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ModulePassManager_New(int D) : PMDataManager(D) {
|
ModulePassManager_New(int D) : PMDataManager(D) {
|
||||||
@ -522,6 +531,33 @@ void PMDataManager::addPassToManager(Pass *P,
|
|||||||
bool ProcessAnalysis) {
|
bool ProcessAnalysis) {
|
||||||
|
|
||||||
if (ProcessAnalysis) {
|
if (ProcessAnalysis) {
|
||||||
|
|
||||||
|
// At the moment, this pass is the last user of all required passes.
|
||||||
|
std::vector<Pass *> LastUses;
|
||||||
|
std::vector<Pass *> RequiredPasses;
|
||||||
|
unsigned PDepth = this->getDepth();
|
||||||
|
|
||||||
|
collectRequiredAnalysisPasses(RequiredPasses, P);
|
||||||
|
for (std::vector<Pass *>::iterator I = RequiredPasses.begin(),
|
||||||
|
E = RequiredPasses.end(); I != E; ++I) {
|
||||||
|
Pass *PRequired = *I;
|
||||||
|
unsigned RDepth = 0;
|
||||||
|
//FIXME: RDepth = PRequired->getResolver()->getDepth();
|
||||||
|
if (PDepth == RDepth)
|
||||||
|
LastUses.push_back(PRequired);
|
||||||
|
else if (PDepth > RDepth) {
|
||||||
|
// Let the parent claim responsibility of last use
|
||||||
|
ForcedLastUses.push_back(PRequired);
|
||||||
|
} else {
|
||||||
|
// Note : This feature is not yet implemented
|
||||||
|
assert (0 &&
|
||||||
|
"Unable to handle Pass that requires lower level Analysis pass");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!LastUses.empty())
|
||||||
|
TPM->setLastUser(LastUses, P);
|
||||||
|
|
||||||
// Take a note of analysis required and made available by this pass.
|
// Take a note of analysis required and made available by this pass.
|
||||||
// Remove the analysis not preserved by this pass
|
// Remove the analysis not preserved by this pass
|
||||||
initializeAnalysisImpl(P);
|
initializeAnalysisImpl(P);
|
||||||
@ -696,6 +732,10 @@ FunctionPassManagerImpl_New::addPass(Pass *P) {
|
|||||||
if (!activeBBPassManager->addPass(BP))
|
if (!activeBBPassManager->addPass(BP))
|
||||||
assert(0 && "Unable to add Pass");
|
assert(0 && "Unable to add Pass");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!ForcedLastUses.empty())
|
||||||
|
TPM->setLastUser(ForcedLastUses, this);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -836,6 +876,10 @@ ModulePassManager_New::addPass(Pass *P) {
|
|||||||
if (!activeFunctionPassManager->addPass(FP))
|
if (!activeFunctionPassManager->addPass(FP))
|
||||||
assert(0 && "Unable to add pass");
|
assert(0 && "Unable to add pass");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!ForcedLastUses.empty())
|
||||||
|
TPM->setLastUser(ForcedLastUses, this);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user