mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-07 14:33:15 +00:00
Check currently available anlysis in active managers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31709 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c9dcf28955
commit
be6d515f48
@ -33,7 +33,9 @@ public:
|
|||||||
bool manageablePass(Pass *P);
|
bool manageablePass(Pass *P);
|
||||||
|
|
||||||
/// Return true IFF AnalysisID AID is currently available.
|
/// Return true IFF AnalysisID AID is currently available.
|
||||||
bool analysisCurrentlyAvailable(AnalysisID AID);
|
bool isAnalysisAvailable(AnalysisID AID) {
|
||||||
|
return (AvailableAnalysis.count(AID) != 0);
|
||||||
|
}
|
||||||
|
|
||||||
/// Augment RequiredAnalysis by adding analysis required by pass P.
|
/// Augment RequiredAnalysis by adding analysis required by pass P.
|
||||||
void noteDownRequiredAnalysis(Pass *P);
|
void noteDownRequiredAnalysis(Pass *P);
|
||||||
@ -85,6 +87,9 @@ public:
|
|||||||
/// whether any of the passes modifies the function, and if so, return true.
|
/// whether any of the passes modifies the function, and if so, return true.
|
||||||
bool runOnFunction(Function &F);
|
bool runOnFunction(Function &F);
|
||||||
|
|
||||||
|
/// Return true IFF AnalysisID AID is currently available.
|
||||||
|
bool analysisCurrentlyAvailable(AnalysisID AID);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -115,6 +120,9 @@ public:
|
|||||||
/// so, return true.
|
/// so, return true.
|
||||||
bool runOnModule(Module &M);
|
bool runOnModule(Module &M);
|
||||||
|
|
||||||
|
/// Return true IFF AnalysisID AID is currently available.
|
||||||
|
bool analysisCurrentlyAvailable(AnalysisID AID);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Active Pass Managers
|
// Active Pass Managers
|
||||||
BasicBlockPassManager_New *activeBBPassManager;
|
BasicBlockPassManager_New *activeBBPassManager;
|
||||||
@ -135,6 +143,9 @@ public:
|
|||||||
/// whether any of the passes modifies the module, and if so, return true.
|
/// whether any of the passes modifies the module, and if so, return true.
|
||||||
bool runOnModule(Module &M);
|
bool runOnModule(Module &M);
|
||||||
|
|
||||||
|
/// Return true IFF AnalysisID AID is currently available.
|
||||||
|
bool analysisCurrentlyAvailable(AnalysisID AID);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Active Pass Manager
|
// Active Pass Manager
|
||||||
FunctionPassManagerImpl_New *activeFunctionPassManager;
|
FunctionPassManagerImpl_New *activeFunctionPassManager;
|
||||||
@ -155,6 +166,9 @@ public:
|
|||||||
/// whether any of the passes modifies the module, and if so, return true.
|
/// whether any of the passes modifies the module, and if so, return true.
|
||||||
bool run(Module &M);
|
bool run(Module &M);
|
||||||
|
|
||||||
|
/// Return true IFF AnalysisID AID is currently available.
|
||||||
|
bool analysisCurrentlyAvailable(AnalysisID AID);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/// Add a pass into a passmanager queue. This is used by schedulePasses
|
/// Add a pass into a passmanager queue. This is used by schedulePasses
|
||||||
@ -202,13 +216,6 @@ bool CommonPassManagerImpl::manageablePass(Pass *P) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return true IFF AnalysisID AID is currently available.
|
|
||||||
bool CommonPassManagerImpl::analysisCurrentlyAvailable(AnalysisID AID) {
|
|
||||||
|
|
||||||
// TODO
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Augment RequiredAnalysis by adding analysis required by pass P.
|
/// Augment RequiredAnalysis by adding analysis required by pass P.
|
||||||
void CommonPassManagerImpl::noteDownRequiredAnalysis(Pass *P) {
|
void CommonPassManagerImpl::noteDownRequiredAnalysis(Pass *P) {
|
||||||
AnalysisUsage AnUsage;
|
AnalysisUsage AnUsage;
|
||||||
@ -308,6 +315,11 @@ BasicBlockPassManager_New::runOnFunction(Function &F) {
|
|||||||
return Changed;
|
return Changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Return true IFF AnalysisID AID is currently available.
|
||||||
|
bool BasicBlockPassManager_New::analysisCurrentlyAvailable(AnalysisID AID) {
|
||||||
|
return isAnalysisAvailable(AID);
|
||||||
|
}
|
||||||
|
|
||||||
// FunctionPassManager_New implementation
|
// FunctionPassManager_New implementation
|
||||||
/// Create new Function pass manager
|
/// Create new Function pass manager
|
||||||
FunctionPassManager_New::FunctionPassManager_New() {
|
FunctionPassManager_New::FunctionPassManager_New() {
|
||||||
@ -387,6 +399,19 @@ FunctionPassManagerImpl_New::runOnModule(Module &M) {
|
|||||||
return Changed;
|
return Changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Return true IFF AnalysisID AID is currently available.
|
||||||
|
bool FunctionPassManagerImpl_New::analysisCurrentlyAvailable(AnalysisID AID) {
|
||||||
|
|
||||||
|
if (isAnalysisAvailable(AID))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (activeBBPassManager &&
|
||||||
|
activeBBPassManager->isAnalysisAvailable(AID))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// TODO : Check inactive managers
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// ModulePassManager implementation
|
// ModulePassManager implementation
|
||||||
|
|
||||||
@ -442,6 +467,27 @@ ModulePassManager_New::runOnModule(Module &M) {
|
|||||||
return Changed;
|
return Changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Return true IFF AnalysisID AID is currently available.
|
||||||
|
bool ModulePassManager_New::analysisCurrentlyAvailable(AnalysisID AID) {
|
||||||
|
|
||||||
|
if (isAnalysisAvailable(AID))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (activeFunctionPassManager &&
|
||||||
|
activeFunctionPassManager->isAnalysisAvailable(AID))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// TODO : Check inactive managers
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Return true IFF AnalysisID AID is currently available.
|
||||||
|
bool PassManagerImpl_New::analysisCurrentlyAvailable(AnalysisID AID) {
|
||||||
|
|
||||||
|
// TODO : Check inactive managers
|
||||||
|
return activeManager->analysisCurrentlyAvailable(AID);
|
||||||
|
}
|
||||||
|
|
||||||
/// Schedule pass P for execution. Make sure that passes required by
|
/// Schedule pass P for execution. Make sure that passes required by
|
||||||
/// P are run before P is run. Update analysis info maintained by
|
/// P are run before P is run. Update analysis info maintained by
|
||||||
/// the manager. Remove dead passes. This is a recursive function.
|
/// the manager. Remove dead passes. This is a recursive function.
|
||||||
@ -453,9 +499,7 @@ void PassManagerImpl_New::schedulePass(Pass *P) {
|
|||||||
for (std::vector<AnalysisID>::const_iterator I = RequiredSet.begin(),
|
for (std::vector<AnalysisID>::const_iterator I = RequiredSet.begin(),
|
||||||
E = RequiredSet.end(); I != E; ++I) {
|
E = RequiredSet.end(); I != E; ++I) {
|
||||||
|
|
||||||
// TODO Check if Analysis is currently available or not.
|
if (!analysisCurrentlyAvailable(*I)) {
|
||||||
bool available = false;
|
|
||||||
if (!available) {
|
|
||||||
// Schedule this analysis run first.
|
// Schedule this analysis run first.
|
||||||
Pass *AP = (*I)->createPass();
|
Pass *AP = (*I)->createPass();
|
||||||
schedulePass(AP);
|
schedulePass(AP);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user