[LLVMdev] How to supply a non-default constructor to RegisterPass ?

Dirk Schroetter dschroetter at googlemail.com
Mon Oct 7 08:40:01 PDT 2013


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


On Sat, Oct 5, 2013 at 6:34 AM, Andrew Trick <atrick at apple.com> wrote:

>
> On Sep 30, 2013, at 10:11 PM, Dirk Schroetter <dschroetter at googlemail.com>
> wrote:
>
> > 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 ?
>
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131007/bcf7c912/attachment.html>


More information about the llvm-dev mailing list