Dirk Schroetter
2013-Oct-01 05:11 UTC
[LLVMdev] 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
Andrew Trick
2013-Oct-05 04:34 UTC
[LLVMdev] How to supply a non-default constructor to RegisterPass ?
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
Dirk Schroetter
2013-Oct-07 15:40 UTC
[LLVMdev] How to supply a non-default constructor to RegisterPass ?
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>
Apparently Analagous Threads
- [LLVMdev] How to supply a non-default constructor to RegisterPass ?
- imapc - different settings for different namespaces
- Guidelines for pass initialization?
- [LLVMdev] 2.9 segfault when requesting for both LoopInfo and DominatorTree analyses.
- Two-stage build w/ ninja - Tests still use stage1 compiler / linker ?