reed kotler
2013-Apr-01 22:15 UTC
[LLVMdev] some questions about the best place to put some passes
I have two sets of features I want to add to the mips16 port. 1) A module pass that scans the IR and makes a decision as to whether to compile the given function as mips16 or mips32. Now I can specify this by adding attributes. Mips16 is just used for space optimization so the presumption is that I'm only worrying about space optimization for this pass. At a first approximation, this will make all functions compiled as mips 16 unless: a) there are floating point parameters. b) there are floating point operations in the function. Mips16 has no floating point so it's better in most cases to compile those functions as mips32 otherwise we have to use a form of soft float. I assume I would make this a module pass. How do I attach a module pass? I think that this should probably be run as early as possible in llc. I'm not sure where this place to add this is. 2) For implementing the full current hard float mechanism for mips16 as gcc does it, I need to generate stubs for many mips16 functions that can be called by mips32 functions (certainly for anything with "extern"). There is a hack in "ld" for dealing with this. If "ld" realizes that a mips32 function is calling a mips16 function, it looks to resolve the external to one of these stubs that in turn sets up the right environment for the mips16 function to b called. This is only necessary when there are floating point parameters or return values that would be normally passed in floating point registers. So I need to create stubs for all mips16 functions that have such floating point signatures that can be called from mips32 functions. There are some other cases which need this too. So I assume this would also be a module pass that would be added as early as possible in llc. I'm not sure where this place to add this is. Tia. Reed