not in this case. the architecture is changing on a per function pass. mips32->mips16->mips16.... same issue would be for arm->thumb1->arm On 03/29/2013 04:26 PM, Chuck Zhao wrote:> Can you do this instead: > > PassManager pm = ...; > pm.add(other needed passes); > ... > if(arch you are interested) > pm.add(your pass); > ... > pm.run(); > > > Chuck > > > On 3/29/2013 4:15 PM, Reed Kotler wrote: >> This is what I'm doing right now and the only issues that came up in >> internal review is that we have to create the pass object now for things >> that we are unlikely to need. >> >> On 03/29/2013 04:05 PM, Chuck Zhao wrote: >>> I think you will have to add the passes anyway before asking the pass >>> manager object to run. >>> In addition, you can specify some dependency, so that that non relevant >>> pass will not have a chance to run. The PassManager should be able to >>> figure that out given the runtime conditions. >>> >>> Chuck >>> >>> On 3/29/2013 3:38 PM, reed kotler wrote: >>>> Is it possible to dynamically add and remove passes once llc starts to >>>> run? >>>> >>>> Currently I have to add some machine function passes and only once >>>> they are running, I have them return right away because they are not >>>> relevant at that time. For example, mips16 does not use the delay slot >>>> optimizer but now I would need to add the pass all the time just in >>>> case someone specified that a particular function be compiled as >>>> mips32. >>>> >>>> It seems from the pass manager that you can add and subtract passes >>>> but I was unclear as to whether this was something you have to do >>>> before the pass manager starts to run passes. >>>> >>>> Tia. >>>> >>>> Reed >>>> >>>> >>>> >>>> >>>> _______________________________________________ >>>> LLVM Developers mailing list >>>> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >>>> >> >> >> >
In this case, you can specialize a few pass manager objects, each for a specific sub target type. E.g. PassManager pm0 = .. ; // for mips32; PassManager pm1 = .. ; // for mips16; ... if(function needs to run on mips32) pm0.run(); else if(function needs to run on mips16) pm1.run(); ... Of course, you have to figure out the suitable sets of functions for each sub target. Hope it helps. Chuck On 3/29/2013 4:28 PM, reed kotler wrote:> not in this case. > > the architecture is changing on a per function pass. > > mips32->mips16->mips16.... > > same issue would be for > > arm->thumb1->arm > > On 03/29/2013 04:26 PM, Chuck Zhao wrote: >> Can you do this instead: >> >> PassManager pm = ...; >> pm.add(other needed passes); >> ... >> if(arch you are interested) >> pm.add(your pass); >> ... >> pm.run(); >> >> >> Chuck >> >> >> On 3/29/2013 4:15 PM, Reed Kotler wrote: >>> This is what I'm doing right now and the only issues that came up in >>> internal review is that we have to create the pass object now for >>> things >>> that we are unlikely to need. >>> >>> On 03/29/2013 04:05 PM, Chuck Zhao wrote: >>>> I think you will have to add the passes anyway before asking the pass >>>> manager object to run. >>>> In addition, you can specify some dependency, so that that non >>>> relevant >>>> pass will not have a chance to run. The PassManager should be able to >>>> figure that out given the runtime conditions. >>>> >>>> Chuck >>>> >>>> On 3/29/2013 3:38 PM, reed kotler wrote: >>>>> Is it possible to dynamically add and remove passes once llc >>>>> starts to >>>>> run? >>>>> >>>>> Currently I have to add some machine function passes and only once >>>>> they are running, I have them return right away because they are not >>>>> relevant at that time. For example, mips16 does not use the delay >>>>> slot >>>>> optimizer but now I would need to add the pass all the time just in >>>>> case someone specified that a particular function be compiled as >>>>> mips32. >>>>> >>>>> It seems from the pass manager that you can add and subtract passes >>>>> but I was unclear as to whether this was something you have to do >>>>> before the pass manager starts to run passes. >>>>> >>>>> Tia. >>>>> >>>>> Reed >>>>> >>>>> >>>>> >>>>> >>>>> _______________________________________________ >>>>> LLVM Developers mailing list >>>>> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >>>>> >>> >>> >>> >> > > >
I already have this working but I don't know until right before the pass runs if it's relevant. The passes are machine function passes. So I have to ask the question in runOnMachineFunction. It works fine except that I have to have already added the pass. This can change from function to function. These are major passes like instruction selection. Anyway, I think that so far it seems that you can't dynamically add passes and without that, I think all the other solutions are roughly equivalent. On 03/29/2013 04:34 PM, Chuck Zhao wrote:> In this case, you can specialize a few pass manager objects, each for > a specific sub target type. > > E.g. > PassManager pm0 = .. ; // for mips32; > PassManager pm1 = .. ; // for mips16; > > ... > if(function needs to run on mips32) > pm0.run(); > else > if(function needs to run on mips16) > pm1.run(); > ... > > Of course, you have to figure out the suitable sets of functions for > each sub target. > > Hope it helps. > > Chuck > > On 3/29/2013 4:28 PM, reed kotler wrote: >> not in this case. >> >> the architecture is changing on a per function pass. >> >> mips32->mips16->mips16.... >> >> same issue would be for >> >> arm->thumb1->arm >> >> On 03/29/2013 04:26 PM, Chuck Zhao wrote: >>> Can you do this instead: >>> >>> PassManager pm = ...; >>> pm.add(other needed passes); >>> ... >>> if(arch you are interested) >>> pm.add(your pass); >>> ... >>> pm.run(); >>> >>> >>> Chuck >>> >>> >>> On 3/29/2013 4:15 PM, Reed Kotler wrote: >>>> This is what I'm doing right now and the only issues that came up >>>> in internal review is that we have to create the pass object now >>>> for things >>>> that we are unlikely to need. >>>> >>>> On 03/29/2013 04:05 PM, Chuck Zhao wrote: >>>>> I think you will have to add the passes anyway before asking the pass >>>>> manager object to run. >>>>> In addition, you can specify some dependency, so that that non >>>>> relevant >>>>> pass will not have a chance to run. The PassManager should be able to >>>>> figure that out given the runtime conditions. >>>>> >>>>> Chuck >>>>> >>>>> On 3/29/2013 3:38 PM, reed kotler wrote: >>>>>> Is it possible to dynamically add and remove passes once llc >>>>>> starts to >>>>>> run? >>>>>> >>>>>> Currently I have to add some machine function passes and only once >>>>>> they are running, I have them return right away because they are not >>>>>> relevant at that time. For example, mips16 does not use the delay >>>>>> slot >>>>>> optimizer but now I would need to add the pass all the time just in >>>>>> case someone specified that a particular function be compiled as >>>>>> mips32. >>>>>> >>>>>> It seems from the pass manager that you can add and subtract passes >>>>>> but I was unclear as to whether this was something you have to do >>>>>> before the pass manager starts to run passes. >>>>>> >>>>>> Tia. >>>>>> >>>>>> Reed >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> _______________________________________________ >>>>>> LLVM Developers mailing list >>>>>> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >>>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >>>>>> >>>> >>>> >>>> >>> >> >> >> >