mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-26 21:47:07 +00:00
* PassInfo is allowed to be missing now (ie, not all passes need be registered)
* getPassName uses PassInfo if it's available * PassInfo is now cached in the pass so that it is only looked up once, maximum llvm-svn: 3123
This commit is contained in:
parent
27795f655b
commit
fd9fefa8f6
@ -217,7 +217,11 @@ void Pass::addToPassManager(PassManagerT<Module> *PM, AnalysisUsage &AU) {
|
|||||||
|
|
||||||
// getPassName - Use C++ RTTI to get a SOMEWHAT intelligable name for the pass.
|
// getPassName - Use C++ RTTI to get a SOMEWHAT intelligable name for the pass.
|
||||||
//
|
//
|
||||||
const char *Pass::getPassName() const { return typeid(*this).name(); }
|
const char *Pass::getPassName() const {
|
||||||
|
if (const PassInfo *PI = getPassInfo())
|
||||||
|
return PI->getPassName();
|
||||||
|
return typeid(*this).name();
|
||||||
|
}
|
||||||
|
|
||||||
// print - Print out the internal state of the pass. This is called by Analyse
|
// print - Print out the internal state of the pass. This is called by Analyse
|
||||||
// to print out the contents of an analysis. Otherwise it is not neccesary to
|
// to print out the contents of an analysis. Otherwise it is not neccesary to
|
||||||
@ -310,11 +314,10 @@ static std::vector<PassRegistrationListener*> *Listeners = 0;
|
|||||||
// getPassInfo - Return the PassInfo data structure that corresponds to this
|
// getPassInfo - Return the PassInfo data structure that corresponds to this
|
||||||
// pass...
|
// pass...
|
||||||
const PassInfo *Pass::getPassInfo() const {
|
const PassInfo *Pass::getPassInfo() const {
|
||||||
assert(PassInfoMap && "PassInfoMap not constructed yet??");
|
if (PassInfoCache) return PassInfoCache;
|
||||||
std::map<TypeInfo, PassInfo*>::iterator I =
|
if (PassInfoMap == 0) return 0;
|
||||||
PassInfoMap->find(typeid(*this));
|
std::map<TypeInfo, PassInfo*>::iterator I = PassInfoMap->find(typeid(*this));
|
||||||
assert(I != PassInfoMap->end() && "Pass has not been registered!");
|
return (I != PassInfoMap->end()) ? I->second : 0;
|
||||||
return I->second;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RegisterPassBase::registerPass(PassInfo *PI) {
|
void RegisterPassBase::registerPass(PassInfo *PI) {
|
||||||
|
Loading…
Reference in New Issue
Block a user