llvm.org GIT mirror llvm / 5e664b8
eliminate a bunch of dynamic_cast's. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94154 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 9 years ago
2 changed file(s) with 9 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
151151 virtual void *getAdjustedAnalysisPointer(const PassInfo *PI) {
152152 return this;
153153 }
154 virtual ImmutablePass *getAsImmutablePass() { return 0; }
154155
155156 /// verifyAnalysis() - This member can be implemented by a analysis pass to
156157 /// check state of analysis information.
247248 /// these passes with getAnalysis<>.
248249 ///
249250 virtual void initializePass();
251
252 virtual ImmutablePass *getAsImmutablePass() { return this; }
250253
251254 /// ImmutablePasses are never run.
252255 ///
201201 }
202202
203203 inline void addTopLevelPass(Pass *P) {
204
205 if (ImmutablePass *IP = dynamic_cast (P)) {
206
204 if (ImmutablePass *IP = P->getAsImmutablePass()) {
207205 // P is a immutable pass and it will be managed by this
208206 // top level manager. Set up analysis resolver to connect them.
209207 AnalysisResolver *AR = new AnalysisResolver(*this);
332330 }
333331
334332 inline void addTopLevelPass(Pass *P) {
335 if (ImmutablePass *IP = dynamic_cast (P)) {
336
333 if (ImmutablePass *IP = P->getAsImmutablePass()) {
337334 // P is a immutable pass and it will be managed by this
338335 // top level manager. Set up analysis resolver to connect them.
339336 AnalysisResolver *AR = new AnalysisResolver(*this);
669666 for (SmallVector::iterator I = HigherLevelAnalysis.begin(),
670667 E = HigherLevelAnalysis.end(); I != E; ++I) {
671668 Pass *P1 = *I;
672 if (!dynamic_cast(P1) &&
669 if (P1->getAsImmutablePass() == 0 &&
673670 std::find(PreservedSet.begin(), PreservedSet.end(),
674671 P1->getPassInfo()) ==
675672 PreservedSet.end())
712709 for (std::map::iterator I = AvailableAnalysis.begin(),
713710 E = AvailableAnalysis.end(); I != E; ) {
714711 std::map::iterator Info = I++;
715 if (!dynamic_cast(Info->second)
716 && std::find(PreservedSet.begin(), PreservedSet.end(), Info->first) ==
712 if (Info->second->getAsImmutablePass() == 0 &&
713 std::find(PreservedSet.begin(), PreservedSet.end(), Info->first) ==
717714 PreservedSet.end()) {
718715 // Remove this analysis
719716 if (PassDebugging >= Details) {
736733 I = InheritedAnalysis[Index]->begin(),
737734 E = InheritedAnalysis[Index]->end(); I != E; ) {
738735 std::map::iterator Info = I++;
739 if (!dynamic_cast(Info->second) &&
736 if (Info->second->getAsImmutablePass() == 0 &&
740737 std::find(PreservedSet.begin(), PreservedSet.end(), Info->first) ==
741738 PreservedSet.end()) {
742739 // Remove this analysis