mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-19 04:32:19 +00:00
Manage analysis passes during run.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31716 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
01d3e38267
commit
c1d6e1fc9c
@ -53,6 +53,13 @@ public:
|
||||
/// AvailableAnalysis appropriately if ProcessAnalysis is true.
|
||||
void addPassToManager (Pass *P, bool ProcessAnalysis = true);
|
||||
|
||||
/// Clear analysis vectors RequiredAnalysis and AvailableAnalysis.
|
||||
/// This is used before running passes managed by the manager.
|
||||
void clearAnalysis() {
|
||||
RequiredAnalysis.clear();
|
||||
AvailableAnalysis.clear();
|
||||
}
|
||||
|
||||
inline std::vector<Pass *>::iterator passVectorBegin() {
|
||||
return PassVector.begin();
|
||||
}
|
||||
@ -311,12 +318,18 @@ bool
|
||||
BasicBlockPassManager_New::runOnFunction(Function &F) {
|
||||
|
||||
bool Changed = false;
|
||||
clearAnalysis();
|
||||
|
||||
for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I)
|
||||
for (std::vector<Pass *>::iterator itr = passVectorBegin(),
|
||||
e = passVectorEnd(); itr != e; ++itr) {
|
||||
Pass *P = *itr;
|
||||
|
||||
noteDownAvailableAnalysis(P);
|
||||
BasicBlockPass *BP = dynamic_cast<BasicBlockPass*>(P);
|
||||
Changed |= BP->runOnBasicBlock(*I);
|
||||
removeNotPreservedAnalysis(P);
|
||||
removeDeadPasses();
|
||||
}
|
||||
return Changed;
|
||||
}
|
||||
@ -395,12 +408,18 @@ bool
|
||||
FunctionPassManagerImpl_New::runOnModule(Module &M) {
|
||||
|
||||
bool Changed = false;
|
||||
clearAnalysis();
|
||||
|
||||
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
|
||||
for (std::vector<Pass *>::iterator itr = passVectorBegin(),
|
||||
e = passVectorEnd(); itr != e; ++itr) {
|
||||
Pass *P = *itr;
|
||||
|
||||
noteDownAvailableAnalysis(P);
|
||||
FunctionPass *FP = dynamic_cast<FunctionPass*>(P);
|
||||
Changed |= FP->runOnFunction(*I);
|
||||
removeNotPreservedAnalysis(P);
|
||||
removeDeadPasses();
|
||||
}
|
||||
return Changed;
|
||||
}
|
||||
@ -464,11 +483,17 @@ ModulePassManager_New::addPass(Pass *P) {
|
||||
bool
|
||||
ModulePassManager_New::runOnModule(Module &M) {
|
||||
bool Changed = false;
|
||||
clearAnalysis();
|
||||
|
||||
for (std::vector<Pass *>::iterator itr = passVectorBegin(),
|
||||
e = passVectorEnd(); itr != e; ++itr) {
|
||||
Pass *P = *itr;
|
||||
|
||||
noteDownAvailableAnalysis(P);
|
||||
ModulePass *MP = dynamic_cast<ModulePass*>(P);
|
||||
Changed |= MP->runOnModule(M);
|
||||
removeNotPreservedAnalysis(P);
|
||||
removeDeadPasses();
|
||||
}
|
||||
return Changed;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user