reed kotler
2013-Mar-20 22:44 UTC
[LLVMdev] changing passes and changing subtargets on a per function basis
I'm implementing this capability to allow switching between mips32 and mips16 code generation on a per function basis (should be useful for arm to thumb switching too). The problem is that while various things are done on a per function basis, there are two passes registered on a per module basis (target lowering and instruction selection). With the new attribute scheme, we can wake up to reset target or subtarget info (well target reset is not currently a virtual function, but it could be). There are 4 pointers that need to change for us, two of which (as described above) result in passes being registered. The pointers are for register info, target info, target lowering and instruction selection. One way to fix this is to retrieve data associated with the pass and change it. This would require some change to the pass infrastructure. The pointers are to classes which are derived classes, currently we have a mips16 and a non mips16 variant but there could be others ( not sure how will handle this with micromips at this time). Thoughts?
Reed Kotler
2013-Mar-21 18:11 UTC
[LLVMdev] changing passes and changing subtargets on a per function basis
I'm starting to think that most of this can be done within the context of the existing structure by using the substitution(Substitute pass) capability of the pass manager and TargetPassConfig. I'm prototyping something now. On 03/20/2013 03:44 PM, reed kotler wrote:> I'm implementing this capability to allow switching between mips32 and > mips16 code generation on a per function basis (should be useful for arm > to thumb switching too). > > The problem is that while various things are done on a per function > basis, there are two passes registered on a per module basis (target > lowering and instruction selection). > > With the new attribute scheme, we can wake up to reset target or > subtarget info (well target reset is not currently a virtual function, > but it could be). > > There are 4 pointers that need to change for us, two of which (as > described above) result in passes being registered. The pointers are for > register info, target info, target lowering and instruction > selection. > > One way to fix this is to retrieve data associated with the pass and > change it. This would require some change to the pass infrastructure. > > The pointers are to classes which are derived classes, currently we have > a mips16 and a non mips16 variant but there could be others ( not sure > how will handle this with micromips at this time). > > Thoughts?