mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-05 13:09:10 +00:00
eliminate dynamic_cast from this file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94157 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
77c95ed74a
commit
5a66cb9a44
@ -93,7 +93,10 @@ char CGPassManager::ID = 0;
|
||||
bool CGPassManager::RunPassOnSCC(Pass *P, std::vector<CallGraphNode*> &CurSCC,
|
||||
CallGraph &CG, bool &CallGraphUpToDate) {
|
||||
bool Changed = false;
|
||||
if (CallGraphSCCPass *CGSP = dynamic_cast<CallGraphSCCPass*>(P)) {
|
||||
PMDataManager *PM = P->getAsPMDataManager();
|
||||
|
||||
if (PM == 0) {
|
||||
CallGraphSCCPass *CGSP = (CallGraphSCCPass*)P;
|
||||
if (!CallGraphUpToDate) {
|
||||
RefreshCallGraph(CurSCC, CG, false);
|
||||
CallGraphUpToDate = true;
|
||||
@ -113,8 +116,10 @@ bool CGPassManager::RunPassOnSCC(Pass *P, std::vector<CallGraphNode*> &CurSCC,
|
||||
return Changed;
|
||||
}
|
||||
|
||||
FPPassManager *FPP = dynamic_cast<FPPassManager *>(P);
|
||||
assert(FPP && "Invalid CGPassManager member");
|
||||
|
||||
assert(PM->getPassManagerType() == PMT_FunctionPassManager &&
|
||||
"Invalid CGPassManager member");
|
||||
FPPassManager *FPP = (FPPassManager*)P;
|
||||
|
||||
// Run pass P on all functions in the current SCC.
|
||||
for (unsigned i = 0, e = CurSCC.size(); i != e; ++i) {
|
||||
@ -363,14 +368,13 @@ bool CGPassManager::runOnModule(Module &M) {
|
||||
/// Initialize CG
|
||||
bool CGPassManager::doInitialization(CallGraph &CG) {
|
||||
bool Changed = false;
|
||||
for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
|
||||
Pass *P = getContainedPass(Index);
|
||||
if (CallGraphSCCPass *CGSP = dynamic_cast<CallGraphSCCPass *>(P)) {
|
||||
Changed |= CGSP->doInitialization(CG);
|
||||
for (unsigned i = 0, e = getNumContainedPasses(); i != e; ++i) {
|
||||
if (PMDataManager *PM = getContainedPass(i)->getAsPMDataManager()) {
|
||||
assert(PM->getPassManagerType() == PMT_FunctionPassManager &&
|
||||
"Invalid CGPassManager member");
|
||||
Changed |= ((FPPassManager*)PM)->doInitialization(CG.getModule());
|
||||
} else {
|
||||
FPPassManager *FP = dynamic_cast<FPPassManager *>(P);
|
||||
assert (FP && "Invalid CGPassManager member");
|
||||
Changed |= FP->doInitialization(CG.getModule());
|
||||
Changed |= ((CallGraphSCCPass*)getContainedPass(i))->doInitialization(CG);
|
||||
}
|
||||
}
|
||||
return Changed;
|
||||
@ -379,14 +383,13 @@ bool CGPassManager::doInitialization(CallGraph &CG) {
|
||||
/// Finalize CG
|
||||
bool CGPassManager::doFinalization(CallGraph &CG) {
|
||||
bool Changed = false;
|
||||
for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
|
||||
Pass *P = getContainedPass(Index);
|
||||
if (CallGraphSCCPass *CGSP = dynamic_cast<CallGraphSCCPass *>(P)) {
|
||||
Changed |= CGSP->doFinalization(CG);
|
||||
for (unsigned i = 0, e = getNumContainedPasses(); i != e; ++i) {
|
||||
if (PMDataManager *PM = getContainedPass(i)->getAsPMDataManager()) {
|
||||
assert(PM->getPassManagerType() == PMT_FunctionPassManager &&
|
||||
"Invalid CGPassManager member");
|
||||
Changed |= ((FPPassManager*)PM)->doFinalization(CG.getModule());
|
||||
} else {
|
||||
FPPassManager *FP = dynamic_cast<FPPassManager *>(P);
|
||||
assert (FP && "Invalid CGPassManager member");
|
||||
Changed |= FP->doFinalization(CG.getModule());
|
||||
Changed |= ((CallGraphSCCPass*)getContainedPass(i))->doFinalization(CG);
|
||||
}
|
||||
}
|
||||
return Changed;
|
||||
|
Loading…
Reference in New Issue
Block a user