1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00

Pull out r108755. After offline discussion with Chris, we're going to go a different direction with this.

llvm-svn: 108856
This commit is contained in:
Owen Anderson 2010-07-20 16:55:05 +00:00
parent 61bb92a5ff
commit e5f3371961
2 changed files with 13 additions and 27 deletions

View File

@ -36,10 +36,6 @@ class TargetMachine;
class PassInfo {
public:
typedef Pass* (*NormalCtor_t)();
struct InterfaceInfo {
const PassInfo *interface;
const InterfaceInfo *next;
};
private:
const char *const PassName; // Nice name for Pass
@ -48,7 +44,7 @@ private:
const bool IsCFGOnlyPass; // Pass only looks at the CFG.
const bool IsAnalysis; // True if an analysis pass.
const bool IsAnalysisGroup; // True if an analysis group.
const InterfaceInfo *ItfImpl;// Interfaces implemented by this pass
std::vector<const PassInfo*> ItfImpl;// Interfaces implemented by this pass
NormalCtor_t NormalCtor;
@ -120,16 +116,13 @@ public:
/// template.
///
void addInterfaceImplemented(const PassInfo *ItfPI) {
InterfaceInfo *NewInfo = new InterfaceInfo();
NewInfo->interface = ItfPI;
NewInfo->next = ItfImpl;
ItfImpl = NewInfo;
ItfImpl.push_back(ItfPI);
}
/// getInterfacesImplemented - Return a list of all of the analysis group
/// interfaces implemented by this pass.
///
const InterfaceInfo *getInterfacesImplemented() const {
const std::vector<const PassInfo*> &getInterfacesImplemented() const {
return ItfImpl;
}

View File

@ -638,14 +638,10 @@ Pass *PMTopLevelManager::findAnalysisPass(AnalysisID AID) {
// If Pass not found then check the interfaces implemented by Immutable Pass
if (!P) {
const PassInfo::InterfaceInfo *ImmPI = PI->getInterfacesImplemented();
while (ImmPI) {
if (ImmPI->interface == AID) {
P = *I;
break;
} else
ImmPI = ImmPI->next;
}
const std::vector<const PassInfo*> &ImmPI =
PI->getInterfacesImplemented();
if (std::find(ImmPI.begin(), ImmPI.end(), AID) != ImmPI.end())
P = *I;
}
}
@ -735,11 +731,9 @@ void PMDataManager::recordAvailableAnalysis(Pass *P) {
//This pass is the current implementation of all of the interfaces it
//implements as well.
const PassInfo::InterfaceInfo *II = PI->getInterfacesImplemented();
while (II) {
AvailableAnalysis[II->interface] = P;
II = II->next;
}
const std::vector<const PassInfo*> &II = PI->getInterfacesImplemented();
for (unsigned i = 0, e = II.size(); i != e; ++i)
AvailableAnalysis[II[i]] = P;
}
// Return true if P preserves high level analysis used by other
@ -873,13 +867,12 @@ void PMDataManager::freePass(Pass *P, StringRef Msg,
// Remove all interfaces this pass implements, for which it is also
// listed as the available implementation.
const PassInfo::InterfaceInfo *II = PI->getInterfacesImplemented();
while (II) {
const std::vector<const PassInfo*> &II = PI->getInterfacesImplemented();
for (unsigned i = 0, e = II.size(); i != e; ++i) {
std::map<AnalysisID, Pass*>::iterator Pos =
AvailableAnalysis.find(II->interface);
AvailableAnalysis.find(II[i]);
if (Pos != AvailableAnalysis.end() && Pos->second == P)
AvailableAnalysis.erase(Pos);
II = II->next;
}
}
}