Message ID | 53A30A69.7060905@mentor.com |
---|---|
State | New |
Headers | show |
On 06/19/2014 09:06 AM, Tom de Vries wrote: > > 2014-06-19 Tom de Vries <tom@codesourcery.com> > > * final.c (collect_fn_hard_reg_usage): Don't save function_used_regs if > it contains all call_used_regs. Ok. r~
> On 06/19/2014 09:06 AM, Tom de Vries wrote: > > > > 2014-06-19 Tom de Vries <tom@codesourcery.com> > > > > * final.c (collect_fn_hard_reg_usage): Don't save function_used_regs if > > it contains all call_used_regs. > > Ok. When we now have way to represent different reg usages for functions, what would be best way to make local functions to default into saving some SSE registers on x86/x86-64? Honza
On 06/19/2014 12:36 PM, Jan Hubicka wrote: >> On 06/19/2014 09:06 AM, Tom de Vries wrote: >>> >>> 2014-06-19 Tom de Vries <tom@codesourcery.com> >>> >>> * final.c (collect_fn_hard_reg_usage): Don't save function_used_regs if >>> it contains all call_used_regs. >> >> Ok. > > When we now have way to represent different reg usages for functions, what would be best > way to make local functions to default into saving some SSE registers on x86/x86-64? I wouldn't do that at all. Leave all sse registers call-clobbered. This way you don't need to have different entry points (or one possibly less efficient entry point) when a function is used both locally and globally. What I would investigate is how to use this hard reg usage data in the register allocator. If we know that the callee only uses xmm0-xmm4, then we can keep xmm5-xmm15 live across the call. r~
2014-06-19 Tom de Vries <tom@codesourcery.com> * final.c (collect_fn_hard_reg_usage): Don't save function_used_regs if it contains all call_used_regs. diff --git a/gcc/final.c b/gcc/final.c index e39930d..e67e84b 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -4795,6 +4795,11 @@ collect_fn_hard_reg_usage (void) SET_HARD_REG_BIT (function_used_regs, i); #endif + /* The information we have gathered is only interesting if it exposes a + register from the call_used_regs that is not used in this function. */ + if (hard_reg_set_subset_p (call_used_reg_set, function_used_regs)) + return; + node = cgraph_rtl_info (current_function_decl); gcc_assert (node != NULL); -- 1.9.1