The passmgr is the only significant user of RTTI data. If we could eliminate its use, we could build all of LLVM with -fno-rtti, which is good for a 5-6% size reduction. This would also provide (slightly) faster builds for everyone! :) -Chris
The new PassManager continues to use typeid: Pass.h: return lookupPassInfo(typeid(AnalysisClass)); PassSupport.h: : RegisterPassBase(Name, PassArg, typeid(PassName), PassSupport.h: : RegisterAGBase(typeid(Interface), &RPB.getPassInfo()->getTypeInfo(), PassSupport.h: : RegisterAGBase(typeid(Interface)) { and dynamic_cast: PassAnalysisSupport.h: return dynamic_cast<AnalysisType*> PassAnalysisSupport.h: // AnalysisGroups), we must use dynamic_cast here to potentially adjust the PassAnalysisSupport.h: AnalysisType *Result = dynamic_cast<AnalysisType*>(ResultPass); PassAnalysisSupport.h: // AnalysisGroups), we must use dynamic_cast here to potentially adjust the PassAnalysisSupport.h: AnalysisType *Result = dynamic_cast<AnalysisType*>(ResultPass); It would be nice if we could get rid of these and start turning on -no-rtti.
Devang, Any chance this PR (888) could get implemented for 2.0? Reid
I have not yet thought much about this. IMO, it is impractical to use isa,classof approach used by Value and Type classes because it will require each pass to identify itself. thoughts ? ideas ? suggestions ?
Every Pass already identifies itself when it registers. I don't see it as being a big deal.
One suggested implementation approach: Whenever a pass registration object's static ctor triggers, it could assign a unique ID to the pass. The passmgr could use this. Another approach: we could use the address of the pass registration object as a unique ID.
I eliminated typeid uses.
Cool! Thanks. When I get a chance to test it, I'll turn typeid support off in the Makefiles and see if we're "clean" without it. If so, I'll resolve this PR. Thanks, Devang! Reid
Thanks Reid. I still need to deal with two remaining dynamic_cast in PassAnalysisSupport.h though.
Okay, I'll watch for the commits. :)
FYI, I turned off typeid support when building llvm-gcc and all hell broke loose. It seems there are many other subtle uses. I'm just going on memory right now but will provide details (or a fix) next week.
Passmanager no longer uses RTTI.