-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 *(*Normal)() = 0,
- Pass *(*TargetCtor)(TargetMachine &) = 0)
- : PIObj(Name, Arg, TI, Normal, TargetCtor) {
- registerPass();
- }
- RegisterPassBase(const std::type_info &TI)
- : PIObj("", "", TI, 0, 0) {
- // 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();
-};
-
-template<typename PassName>
-Pass *callDefaultCtor() { return new PassName(); }
-
-template<typename PassName>
-struct RegisterPass : public RegisterPassBase {