(I'm using LLVM 3.7.)
I'm trying to pass non-global data to passes when I create them, so the usual cl::opt isn't what I'm looking for.
My first solution was to have a callDefaultCtor<P> that returned nullptr, and create my pass with a parameterized constructor; however, I have a CallGraphSCCPass that addRequired's a parameterized ModulePass, and even though it was already added to the pass manager, it can't seem to find it (and tries to create a new one, which fails).
The same technique apparently works if the required pass is immutable, so I'm considering creating an ImmutablePass that has the varying parameters and refer to that one from the ModulePass. Does that sound insane, or will that go horribly wrong once the new PassManager infrastructure lands? Is there a better solution?