On Thu, Aug 05, 2010 at 03:48:55PM +0200, Claudiu Zissulescu wrote: > Hi, > > I want to use a different CALL_USED_REGISTER set per individual > function. The issue here is to inform a caller about the callee > CALL_USED_REGISTERS and save/restore at caller level the possible > altered registers. This should reduce the number of saved/restored > operation in a function. > > Can someone give me some pointers in this direction?
In the x86 they use TARGET_EXPAND_TO_RTL_HOOK which points to the ix86_maybe_switch_abi function. That function is: /* MS and SYSV ABI have different set of call used registers. Avoid expensive re-initialization of init_regs each time we switch function context since this is needed only during RTL expansion. */ static void ix86_maybe_switch_abi (void) { if (TARGET_64BIT && call_used_regs[SI_REG] == (cfun->machine->call_abi == MS_ABI)) reinit_regs (); } Going beyond the above, about 2 years ago, I and another programmer wrote the function specific support that allows you to use attributes and pragmas to say a particular function is compiled with non-standard options. My intention was that you could declare one function normally, another with SSE2 support, and a third with SSE4 support, and that at runtime you could switch to use the function that supported the instruction set. This was done via the TARGET_SET_CURRENT_FUNCTION callback, which in the x86 case is ix86_set_current_function. This does the target_reinit and eventually reinit_regs. Now, unfortunately, I've been away from the code for about 2 years, and I don't know whether it has bit-rotted or not. -- Michael Meissner, IBM 5 Technology Place Drive, M/S 2757, Westford, MA 01886-3141, USA meiss...@linux.vnet.ibm.com