mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-02 22:04:55 +00:00
Extract the code for releasing a pass into a separate function, and
tidy it up a little. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82944 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c261df9fab
commit
27a8fb8a54
@ -285,10 +285,14 @@ public:
|
|||||||
/// Remove Analysis that is not preserved by the pass
|
/// Remove Analysis that is not preserved by the pass
|
||||||
void removeNotPreservedAnalysis(Pass *P);
|
void removeNotPreservedAnalysis(Pass *P);
|
||||||
|
|
||||||
/// Remove dead passes
|
/// Remove dead passes used by P.
|
||||||
void removeDeadPasses(Pass *P, const StringRef &Msg,
|
void removeDeadPasses(Pass *P, const StringRef &Msg,
|
||||||
enum PassDebuggingString);
|
enum PassDebuggingString);
|
||||||
|
|
||||||
|
/// Remove P.
|
||||||
|
void freePass(Pass *P, const StringRef &Msg,
|
||||||
|
enum PassDebuggingString);
|
||||||
|
|
||||||
/// Add pass P into the PassVector. Update
|
/// Add pass P into the PassVector. Update
|
||||||
/// AvailableAnalysis appropriately if ProcessAnalysis is true.
|
/// AvailableAnalysis appropriately if ProcessAnalysis is true.
|
||||||
void add(Pass *P, bool ProcessAnalysis = true);
|
void add(Pass *P, bool ProcessAnalysis = true);
|
||||||
|
@ -815,36 +815,37 @@ void PMDataManager::removeDeadPasses(Pass *P, const StringRef &Msg,
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (SmallVector<Pass *, 12>::iterator I = DeadPasses.begin(),
|
for (SmallVector<Pass *, 12>::iterator I = DeadPasses.begin(),
|
||||||
E = DeadPasses.end(); I != E; ++I) {
|
E = DeadPasses.end(); I != E; ++I)
|
||||||
|
freePass(*I, Msg, DBG_STR);
|
||||||
|
}
|
||||||
|
|
||||||
dumpPassInfo(*I, FREEING_MSG, DBG_STR, Msg);
|
void PMDataManager::freePass(Pass *P, const StringRef &Msg,
|
||||||
|
enum PassDebuggingString DBG_STR) {
|
||||||
|
dumpPassInfo(P, FREEING_MSG, DBG_STR, Msg);
|
||||||
|
|
||||||
{
|
{
|
||||||
// If the pass crashes releasing memory, remember this.
|
// If the pass crashes releasing memory, remember this.
|
||||||
PassManagerPrettyStackEntry X(*I);
|
PassManagerPrettyStackEntry X(P);
|
||||||
|
|
||||||
if (TheTimeInfo) TheTimeInfo->passStarted(*I);
|
if (TheTimeInfo) TheTimeInfo->passStarted(P);
|
||||||
(*I)->releaseMemory();
|
P->releaseMemory();
|
||||||
if (TheTimeInfo) TheTimeInfo->passEnded(*I);
|
if (TheTimeInfo) TheTimeInfo->passEnded(P);
|
||||||
}
|
}
|
||||||
if (const PassInfo *PI = (*I)->getPassInfo()) {
|
|
||||||
std::map<AnalysisID, Pass*>::iterator Pos =
|
|
||||||
AvailableAnalysis.find(PI);
|
|
||||||
|
|
||||||
// It is possible that pass is already removed from the AvailableAnalysis
|
if (const PassInfo *PI = P->getPassInfo()) {
|
||||||
if (Pos != AvailableAnalysis.end())
|
// Remove the pass itself (if it is not already removed).
|
||||||
AvailableAnalysis.erase(Pos);
|
AvailableAnalysis.erase(PI);
|
||||||
|
|
||||||
// Remove all interfaces this pass implements, for which it is also
|
// Remove all interfaces this pass implements, for which it is also
|
||||||
// listed as the available implementation.
|
// listed as the available implementation.
|
||||||
const std::vector<const PassInfo*> &II = PI->getInterfacesImplemented();
|
const std::vector<const PassInfo*> &II = PI->getInterfacesImplemented();
|
||||||
for (unsigned i = 0, e = II.size(); i != e; ++i) {
|
for (unsigned i = 0, e = II.size(); i != e; ++i) {
|
||||||
Pos = AvailableAnalysis.find(II[i]);
|
std::map<AnalysisID, Pass*>::iterator Pos =
|
||||||
if (Pos != AvailableAnalysis.end() && Pos->second == *I)
|
AvailableAnalysis.find(II[i]);
|
||||||
|
if (Pos != AvailableAnalysis.end() && Pos->second == P)
|
||||||
AvailableAnalysis.erase(Pos);
|
AvailableAnalysis.erase(Pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Add pass P into the PassVector. Update
|
/// Add pass P into the PassVector. Update
|
||||||
|
Loading…
Reference in New Issue
Block a user