-struct RegisterPassBase {
- /// getPassInfo - Get the pass info for the registered class...
- ///
- const PassInfo *getPassInfo() const { return &PIObj; }
-
- RegisterPassBase(const char *Name, const char *Arg, const std::type_info &TI,
- Pass *(*NormalCtor)() = 0)
- : PIObj(Name, Arg, TI, NormalCtor) {
- registerPass();
- }
- RegisterPassBase(const std::type_info &TI)
- : PIObj("", "", TI) {
- // This ctor may only be used for analysis groups: it does not auto-register
- // the pass.
- PIObj.SetIsAnalysisGroup();
- }
-
- ~RegisterPassBase() { // Intentionally non-virtual.
- // Analysis groups are registered/unregistered by their dtor.
- if (!PIObj.isAnalysisGroup())
- unregisterPass();
- }
-
-protected:
- PassInfo PIObj; // The PassInfo object for this pass
- void registerPass();
- void unregisterPass();
-
- /// setOnlyUsesCFG - Notice that this pass only depends on the CFG, so
- /// transformations that do not modify the CFG do not invalidate this pass.
- ///
- void setOnlyUsesCFG() {
- PIObj.SetIsCFGOnlyPass();
- }
-};
-
-template<typename PassName>
-Pass *callDefaultCtor() { return new PassName(); }
-
-template<typename PassName>
-struct RegisterPass : public RegisterPassBase {