Print and delete on the fly pass managers.

llvm-svn: 36157
This commit is contained in:
Devang Patel 2007-04-16 20:39:59 +00:00
parent 660fa7b6b7
commit 2ff4492a2c

View File

@ -181,6 +181,16 @@ class MPPassManager : public Pass, public PMDataManager {
public: public:
MPPassManager(int Depth) : PMDataManager(Depth) { } MPPassManager(int Depth) : PMDataManager(Depth) { }
// Delete on the fly managers.
virtual ~MPPassManager() {
for (std::map<Pass *, FPPassManager *>::iterator
I = OnTheFlyManagers.begin(), E = OnTheFlyManagers.end();
I != E; ++I) {
FPPassManager *FPP = I->second;
delete FPP;
}
}
/// run - Execute all of the passes scheduled for execution. Keep track of /// 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. /// whether any of the passes modifies the module, and if so, return true.
bool runOnModule(Module &M); bool runOnModule(Module &M);
@ -210,6 +220,8 @@ public:
for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) { for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
ModulePass *MP = getContainedPass(Index); ModulePass *MP = getContainedPass(Index);
MP->dumpPassStructure(Offset + 1); MP->dumpPassStructure(Offset + 1);
if (FPPassManager *FPP = OnTheFlyManagers[MP])
FPP->dumpPassStructure(Offset + 2);
dumpLastUses(MP, Offset+1); dumpLastUses(MP, Offset+1);
} }
} }
@ -625,6 +637,7 @@ void PMDataManager::removeDeadPasses(Pass *P, std::string Msg,
std::vector<Pass *> DeadPasses; std::vector<Pass *> DeadPasses;
// If this is a on the fly manager then it does not have TPM.
if (!TPM) if (!TPM)
return; return;
@ -796,7 +809,10 @@ void PMDataManager::dumpLastUses(Pass *P, unsigned Offset) const{
std::vector<Pass *> LUses; std::vector<Pass *> LUses;
assert (TPM && "Top Level Manager is missing"); // If this is a on the fly manager then it does not have TPM.
if (!TPM)
return;
TPM->collectLastUses(LUses, P); TPM->collectLastUses(LUses, P);
for (std::vector<Pass *>::iterator I = LUses.begin(), for (std::vector<Pass *>::iterator I = LUses.begin(),