Best way to require a pass from a dynamically loaded module?

Hi, I have a situation where I built an analysis pass as a loadable
module, but I'd like to require it from other passes, to make it
available if it's been loaded.
Is there a clean way to do this, or am I stretching it too far?
If there isn't a nice way, I'd be interested in discussion about what
would be the least ugly hack just to get it working.

Thanks!
-mike

Hi, I have a situation where I built an analysis pass as a loadable
module, but I'd like to require it from other passes, to make it
available if it's been loaded.

Does this mean that the "other passes" are not part of the loadable module?

Is there a clean way to do this, or am I stretching it too far?
If there isn't a nice way, I'd be interested in discussion about what
would be the least ugly hack just to get it working.

One thing you could use/abuse is the AnalysisGroup mechanism. You could define an analysis group MyAG, with a default (empty) implementation. The loadable module could implement another implementation of MyAG. Other passes could use MyAG without knowing whether they are getting the default ("empty") implementation or the loaded one.

Analysis groups are how the AliasAnalysis itf works for example. The HowToWriteAPass guide should explain how it works,

-Chris