[LLVMdev] changing passes and changing subtargets on a per function basis

reed kotler rkotler at mips.com
Wed Mar 20 15:44:00 PDT 2013

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

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).


More information about the llvm-dev mailing list