How to supply a non-default constructor to RegisterPass ?

Folks,

I did read the documentation but I am at a loss still.

I do have the following:

Pass *createFooPass (char *foo1) {
  return new FooPass (foo1);
}

static RegisterPass<FooPass> X("foo-pass", "foo", false, true);

Where exactly do I supply the non-default crore in this example ?

Thanks

/Dirk

Sorry for the non-answer, but AFAIK the pass registry can’t understand a non-default ctor. I personally don’t like non-default pass ctors anyway. You have at least three better options
- If you have different versions of a pass, just make them different passes that share implementation.
- If you have a pass that can be configured in different modes, get the mode from the current context within the pass. Maybe a Function attribute can be used, or ask TargetMachine/TargetOptions within backend passes.
- Get what you need from an existing ImmutablePass, like TargetTransformInfo, TargetPassConfig, or create your own Immutable pass.

-Andy

Hello Andy,

thank you very much for your reply. And while it does not solve my immediate problem, it at least limits the solution space. So, it is a useful answer.

I will go back to the drawing board and explore your suggestions and try to map it to the problem at hand. I am trying to implement a scripting pass akin to Shang for the 3.4 release.

In any case, I was wondering if anyone is actively looking into such a scripting pass.

Thanks again,

/Dirk