- // getDataCtor - Return a pointer to a function that creates an instance of
- // the pass and returns it. This returns a constructor for a version of the
- // pass that takes a TArgetData object as a parameter.
- //
- Pass *(*getDataCtor() const)(const TargetData &) {
- return DataCtor;
- }
-};
-
-
-//===---------------------------------------------------------------------------
-// RegisterPass<t> template - This template class is used to notify the system
-// that a Pass is available for use, and registers it into the internal database
-// maintained by the PassManager. Unless this template is used, opt, for
-// example will not be able to see the pass and attempts to create the pass will
-// fail. This template is used in the follow manner (at global scope, in your
-// .cpp file):
-//
-// static RegisterPass<YourPassClassName> tmp("passopt", "My Pass Name");
-//
-// This statement will cause your pass to be created by calling the default
-// constructor exposed by the pass. If you have a different constructor that
-// must be called, create a global constructor function (which takes the
-// arguments you need and returns a Pass*) and register your pass like this:
-//
-// Pass *createMyPass(foo &opt) { return new MyPass(opt); }
-// static RegisterPass<PassClassName> tmp("passopt", "My Name", createMyPass);
-//
-struct RegisterPassBase {
- // getPassInfo - Get the pass info for the registered class...
- const PassInfo *getPassInfo() const { return PIObj; }
-
- ~RegisterPassBase(); // Intentionally non-virtual...
-
- inline operator PassInfo* () const { return PIObj; }
-
-protected:
- PassInfo *PIObj; // The PassInfo object for this pass
- void registerPass(PassInfo *);
-};
-
-template<typename PassName>
-Pass *callDefaultCtor() { return new PassName(); }