mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
Change PMTopLevelManager's PassManagers vector element type from
Pass* to PMDataManager*. PMDataManager is more specific than Pass, so this more accurately describes the objects that are being stored. This eliminates the need for several dynamic_casts to PMDataManager*. It does introduce one dynamic_cast though, in dumpPasses(). Give this one a comment describing why a dynamic_cast is being used. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48315 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c2f12ab5e5
commit
0961ec1afe
@ -150,7 +150,7 @@ public:
|
||||
return ImmutablePasses;
|
||||
}
|
||||
|
||||
void addPassManager(Pass *Manager) {
|
||||
void addPassManager(PMDataManager *Manager) {
|
||||
PassManagers.push_back(Manager);
|
||||
}
|
||||
|
||||
@ -172,7 +172,7 @@ public:
|
||||
protected:
|
||||
|
||||
/// Collection of pass managers
|
||||
std::vector<Pass *> PassManagers;
|
||||
std::vector<PMDataManager *> PassManagers;
|
||||
|
||||
private:
|
||||
|
||||
|
@ -455,10 +455,9 @@ Pass *PMTopLevelManager::findAnalysisPass(AnalysisID AID) {
|
||||
|
||||
Pass *P = NULL;
|
||||
// Check pass managers
|
||||
for (std::vector<Pass *>::iterator I = PassManagers.begin(),
|
||||
for (std::vector<PMDataManager *>::iterator I = PassManagers.begin(),
|
||||
E = PassManagers.end(); P == NULL && I != E; ++I) {
|
||||
PMDataManager *PMD = dynamic_cast<PMDataManager *>(*I);
|
||||
assert(PMD && "This is not a PassManager");
|
||||
PMDataManager *PMD = *I;
|
||||
P = PMD->findAnalysisPass(AID, false);
|
||||
}
|
||||
|
||||
@ -496,9 +495,13 @@ void PMTopLevelManager::dumpPasses() const {
|
||||
ImmutablePasses[i]->dumpPassStructure(0);
|
||||
}
|
||||
|
||||
for (std::vector<Pass *>::const_iterator I = PassManagers.begin(),
|
||||
// Every class that derives from PMDataManager also derives from Pass
|
||||
// (sometimes indirectly), but there's no inheritance relationship
|
||||
// between PMDataManager and Pass, so we have to dynamic_cast to get
|
||||
// from a PMDataManager* to a Pass*.
|
||||
for (std::vector<PMDataManager *>::const_iterator I = PassManagers.begin(),
|
||||
E = PassManagers.end(); I != E; ++I)
|
||||
(*I)->dumpPassStructure(1);
|
||||
dynamic_cast<Pass *>(*I)->dumpPassStructure(1);
|
||||
}
|
||||
|
||||
void PMTopLevelManager::dumpArguments() const {
|
||||
@ -507,10 +510,9 @@ void PMTopLevelManager::dumpArguments() const {
|
||||
return;
|
||||
|
||||
cerr << "Pass Arguments: ";
|
||||
for (std::vector<Pass *>::const_iterator I = PassManagers.begin(),
|
||||
for (std::vector<PMDataManager *>::const_iterator I = PassManagers.begin(),
|
||||
E = PassManagers.end(); I != E; ++I) {
|
||||
PMDataManager *PMD = dynamic_cast<PMDataManager *>(*I);
|
||||
assert(PMD && "This is not a PassManager");
|
||||
PMDataManager *PMD = *I;
|
||||
PMD->dumpPassArguments();
|
||||
}
|
||||
cerr << "\n";
|
||||
@ -518,10 +520,9 @@ void PMTopLevelManager::dumpArguments() const {
|
||||
|
||||
void PMTopLevelManager::initializeAllAnalysisInfo() {
|
||||
|
||||
for (std::vector<Pass *>::iterator I = PassManagers.begin(),
|
||||
for (std::vector<PMDataManager *>::iterator I = PassManagers.begin(),
|
||||
E = PassManagers.end(); I != E; ++I) {
|
||||
PMDataManager *PMD = dynamic_cast<PMDataManager *>(*I);
|
||||
assert(PMD && "This is not a PassManager");
|
||||
PMDataManager *PMD = *I;
|
||||
PMD->initializeAnalysisInfo();
|
||||
}
|
||||
|
||||
@ -533,7 +534,7 @@ void PMTopLevelManager::initializeAllAnalysisInfo() {
|
||||
|
||||
/// Destructor
|
||||
PMTopLevelManager::~PMTopLevelManager() {
|
||||
for (std::vector<Pass *>::iterator I = PassManagers.begin(),
|
||||
for (std::vector<PMDataManager *>::iterator I = PassManagers.begin(),
|
||||
E = PassManagers.end(); I != E; ++I)
|
||||
delete *I;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user