start up and clean up module passes, now that ASAN and TSAN are fixed the
tests pass
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168905
91177308-0d34-0410-b5e6-
96231b3b80d8
const MCObjectFileInfo *MOFI);
~MachineModuleInfo();
const MCObjectFileInfo *MOFI);
~MachineModuleInfo();
+ using ModulePass::doInitialization;
+
+ using ModulePass::doFinalization;
bool doFinalization();
/// EndFunction - Discard function meta information.
bool doFinalization();
/// EndFunction - Discard function meta information.
/// doInitialization - Virtual method overridden by subclasses to do
/// any necessary initialization before any pass is run.
///
/// doInitialization - Virtual method overridden by subclasses to do
/// any necessary initialization before any pass is run.
///
- virtual bool doInitialization() { return false; }
+ virtual bool doInitialization(Module &) { return false; }
/// runOnModule - Virtual method overriden by subclasses to process the module
/// being operated on.
/// runOnModule - Virtual method overriden by subclasses to process the module
/// being operated on.
/// doFinalization - Virtual method overriden by subclasses to do any
/// necessary clean up after all passes have run.
///
/// doFinalization - Virtual method overriden by subclasses to do any
/// necessary clean up after all passes have run.
///
- virtual bool doFinalization() { return false; }
+ virtual bool doFinalization(Module &) { return false; }
virtual void assignPassManager(PMStack &PMS,
PassManagerType T);
virtual void assignPassManager(PMStack &PMS,
PassManagerType T);
/// whether any of the passes modifies the module, and if so, return true.
bool run(Module &M);
/// whether any of the passes modifies the module, and if so, return true.
bool run(Module &M);
- /// doInitialization - Run all of the initializers for the module passes.
- ///
- bool doInitialization();
-
- /// doFinalization - Run all of the finalizers for the module passes.
- ///
- bool doFinalization();
-
private:
/// PassManagerImpl_New is the actual class. PassManager is just the
/// wraper to publish simple pass manager interface
private:
/// PassManagerImpl_New is the actual class. PassManager is just the
/// wraper to publish simple pass manager interface
}
bool FPPassManager::runOnModule(Module &M) {
}
bool FPPassManager::runOnModule(Module &M) {
- bool Changed = doInitialization(M);
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
Changed |= runOnFunction(*I);
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
Changed |= runOnFunction(*I);
- return doFinalization(M) || Changed;
}
bool FPPassManager::doInitialization(Module &M) {
}
bool FPPassManager::doInitialization(Module &M) {
for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index)
Changed |= getContainedPass(Index)->doInitialization(M);
for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index)
Changed |= getContainedPass(Index)->doInitialization(M);
return Changed;
}
bool FPPassManager::doFinalization(Module &M) {
bool Changed = false;
return Changed;
}
bool FPPassManager::doFinalization(Module &M) {
bool Changed = false;
for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index)
Changed |= getContainedPass(Index)->doFinalization(M);
for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index)
Changed |= getContainedPass(Index)->doFinalization(M);
Changed |= FPP->doInitialization(M);
}
Changed |= FPP->doInitialization(M);
}
+ // Initialize module passes
+ for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index)
+ Changed |= getContainedPass(Index)->doInitialization(M);
+
for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
ModulePass *MP = getContainedPass(Index);
bool LocalChanged = false;
for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
ModulePass *MP = getContainedPass(Index);
bool LocalChanged = false;
removeDeadPasses(MP, M.getModuleIdentifier(), ON_MODULE_MSG);
}
removeDeadPasses(MP, M.getModuleIdentifier(), ON_MODULE_MSG);
}
+ // Finalize module passes
+ for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index)
+ Changed |= getContainedPass(Index)->doFinalization(M);
+
// Finalize on-the-fly passes
for (std::map<Pass *, FunctionPassManagerImpl *>::iterator
I = OnTheFlyManagers.begin(), E = OnTheFlyManagers.end();
// Finalize on-the-fly passes
for (std::map<Pass *, FunctionPassManagerImpl *>::iterator
I = OnTheFlyManagers.begin(), E = OnTheFlyManagers.end();
FPP->releaseMemoryOnTheFly();
Changed |= FPP->doFinalization(M);
}
FPP->releaseMemoryOnTheFly();
Changed |= FPP->doFinalization(M);
}
-
- return Changed;
-}
-
-/// Run all of the initializers for the module passes.
-///
-bool MPPassManager::doInitialization() {
- bool Changed = false;
-
- for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index)
- Changed |= getContainedPass(Index)->doInitialization();
-
- return Changed;
-}
-
-/// Run all of the finalizers for the module passes.
-///
-bool MPPassManager::doFinalization() {
- bool Changed = false;
-
- for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index)
- Changed |= getContainedPass(Index)->doFinalization();
-
//===----------------------------------------------------------------------===//
// PassManagerImpl implementation
//===----------------------------------------------------------------------===//
// PassManagerImpl implementation
-bool PassManagerImpl::doInitialization() {
- bool Changed = false;
-
- for (unsigned Index = 0; Index < getNumContainedManagers(); ++Index)
- Changed |= getContainedManager(Index)->doInitialization();
-
- return Changed;
-}
-
-bool PassManagerImpl::doFinalization() {
- bool Changed = false;
-
- for (unsigned Index = 0; Index < getNumContainedManagers(); ++Index)
- Changed |= getContainedManager(Index)->doFinalization();
-
- return Changed;
-}
-
//
/// run - Execute all of the passes scheduled for execution. Keep track of
/// whether any of the passes modifies the module, and if so, return true.
//
/// run - Execute all of the passes scheduled for execution. Keep track of
/// whether any of the passes modifies the module, and if so, return true.
-/// doInitialization - Run all of the initializers for the module passes.
-///
-bool PassManager::doInitialization() {
- return PM->doInitialization();
-}
-
-/// doFinalization - Run all of the finalizers for the module passes.
-///
-bool PassManager::doFinalization() {
- return PM->doFinalization();
-}
-
//===----------------------------------------------------------------------===//
// TimingInfo Class - This class is used to calculate information about the
// amount of time each pass takes to execute. This only happens with
//===----------------------------------------------------------------------===//
// TimingInfo Class - This class is used to calculate information about the
// amount of time each pass takes to execute. This only happens with
// Verify that this is still valid.
PassManager Passes;
Passes.add(createVerifierPass());
// Verify that this is still valid.
PassManager Passes;
Passes.add(createVerifierPass());
- Passes.doInitialization();
- Passes.doFinalization();
// Try running on the hacked up program...
if (TestFn(BD, M)) {
// Try running on the hacked up program...
if (TestFn(BD, M)) {
// Before executing passes, print the final values of the LLVM options.
cl::PrintOptionValues();
// Before executing passes, print the final values of the LLVM options.
cl::PrintOptionValues();
else if (Force || !CheckBitcodeOutputToConsole(Out.os(), true))
Passes.add(createBitcodeWriterPass(Out.os()));
else if (Force || !CheckBitcodeOutputToConsole(Out.os(), true))
Passes.add(createBitcodeWriterPass(Out.os()));
- Passes.doInitialization();
- Passes.doFinalization();
// Declare success.
Out.keep();
// Declare success.
Out.keep();
PassManager PassMgr;
PassMgr.add(createProfileLoaderPass(ProfileDataFile));
PassMgr.add(new ProfileInfoPrinterPass(PIL));
PassManager PassMgr;
PassMgr.add(createProfileLoaderPass(ProfileDataFile));
PassMgr.add(new ProfileInfoPrinterPass(PIL));
- PassMgr.doInitialization();
- PassMgr.doFinalization();
PassManager Passes;
Passes.add(createVerifierPass());
Passes.add(createPrintModulePass(&Out->os()));
PassManager Passes;
Passes.add(createVerifierPass());
Passes.add(createPrintModulePass(&Out->os()));
- Passes.doInitialization();
- Passes.doFinalization();
passes.add(createInternalizePass(mustPreserveList));
// apply scope restrictions
passes.add(createInternalizePass(mustPreserveList));
// apply scope restrictions
- passes.doInitialization();
passes.run(*mergedModule);
passes.run(*mergedModule);
- passes.doFinalization();
_scopeRestrictionsDone = true;
}
_scopeRestrictionsDone = true;
}
}
// Run our queue of passes all at once now, efficiently.
}
// Run our queue of passes all at once now, efficiently.
- passes.doInitialization();
passes.run(*mergedModule);
passes.run(*mergedModule);
- passes.doFinalization();
// Run the code generator, and write assembly file
codeGenPasses->doInitialization();
// Run the code generator, and write assembly file
codeGenPasses->doInitialization();
cl::PrintOptionValues();
// Now that we have all of the passes ready, run them.
cl::PrintOptionValues();
// Now that we have all of the passes ready, run them.
- Passes.doInitialization();
- Passes.doFinalization();
// Declare success.
if (!NoOutput || PrintBreakpoints)
// Declare success.
if (!NoOutput || PrintBreakpoints)