Re: -fuse-caller-save - Collect register usage information

2014-10-20 Thread Eric Botcazou
But, given the preference of a number of others for fipa-ra, could you live with that? Yes, IMO that's too vague a name but still better than the existing one. :-) -- Eric Botcazou

Re: -fuse-caller-save - Collect register usage information

2014-10-19 Thread Tom de Vries
On 17-10-14 21:24, Eric Botcazou wrote: Let's look at the effect of the option (after the recent fix for PR61605) on gcc.target/i386/fuse-calller-save.c: ... foo: .LFB1: .cfi_startproc - pushq %rbx - .cfi_def_cfa_offset 16 - .cfi_offset 3, -16 - movl

Re: -fuse-caller-save - Collect register usage information

2014-10-17 Thread Tom de Vries
On 16-10-14 23:46, Eric Botcazou wrote: Having said that, in my mind, what is confusing about the name -fuse-caller-save, is that in fact the caller-save registers are already used in register allocation. It's just that they're used across calls without the need to save them, but

Re: -fuse-caller-save - Collect register usage information

2014-10-17 Thread Richard Biener
On Fri, Oct 17, 2014 at 12:47 PM, Tom de Vries tom_devr...@mentor.com wrote: On 16-10-14 23:46, Eric Botcazou wrote: Having said that, in my mind, what is confusing about the name -fuse-caller-save, is that in fact the caller-save registers are already used in register allocation. It's just

Re: -fuse-caller-save - Collect register usage information

2014-10-17 Thread Jeff Law
On 10/17/14 05:00, Richard Biener wrote: I'm starting to lean towards -foptimize-call-clobbers or similar. Well, it is really some form of IPA driven register allocation. Whether you want to call it -fipa-ra or not is another question - but if we had such option then enabling it with that

Re: -fuse-caller-save - Collect register usage information

2014-10-17 Thread Mike Stump
On Oct 17, 2014, at 8:50 AM, Jeff Law l...@redhat.com wrote: So - I like -fipa-ra more. Similarly. Yeah, I was going to say I liked the ipa tag in there some place but didn’t cause I didn’t want to bikeshed, but, since a few others like that, dogpiling seems ok. :-)

Re: -fuse-caller-save - Collect register usage information

2014-10-17 Thread Eric Botcazou
Let's look at the effect of the option (after the recent fix for PR61605) on gcc.target/i386/fuse-calller-save.c: ... foo: .LFB1: .cfi_startproc - pushq %rbx - .cfi_def_cfa_offset 16 - .cfi_offset 3, -16 - movl%edi, %ebx callbar - addl

Re: -fuse-caller-save - Collect register usage information

2014-10-16 Thread Tom de Vries
On 11-10-14 12:46, Eric Botcazou wrote: So, I hate the name of the option, and the documentation seems wrong to me. It doesn’t use the caller saved registers for allocation, it uses the call clobbered registers for allocation. Or, one could say it uses the callee saved registers for allocation.

Re: -fuse-caller-save - Collect register usage information

2014-10-16 Thread Eric Botcazou
Having said that, in my mind, what is confusing about the name -fuse-caller-save, is that in fact the caller-save registers are already used in register allocation. It's just that they're used across calls without the need to save them, but

Re: -fuse-caller-save - Collect register usage information

2014-10-16 Thread Mike Stump
On Oct 16, 2014, at 2:28 PM, Tom de Vries tom_devr...@mentor.com wrote: So I'd say the documentation is in fact correct. Agreed. I was confused. Apparently my mind likes to think in volatile and non-volatile (call-clobbered and non-call-clobbered) and I managed to map it wrong in my mind and

Re: -fuse-caller-save - Collect register usage information

2014-10-11 Thread Eric Botcazou
So, I hate the name of the option, and the documentation seems wrong to me. It doesn’t use the caller saved registers for allocation, it uses the call clobbered registers for allocation. Or, one could say it uses the callee saved registers for allocation. Seconded, the description is a bit

Re: -fuse-caller-save - Collect register usage information

2014-10-10 Thread Mike Stump
On Apr 23, 2014, at 3:41 AM, Tom de Vries tom_devr...@mentor.com wrot On 22-04-14 17:05, Tom de Vries wrote: I've updated the fuse-caller-save patch series to model non-callee call clobbers in CALL_INSN_FUNCTION_USAGE. @item -fuse-caller-save Use caller save registers for allocation if

Re: -fuse-caller-save - Collect register usage information

2014-07-13 Thread Tom de Vries
On 19-06-14 21:45, Richard Henderson wrote: 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 t...@codesourcery.com * final.c (collect_fn_hard_reg_usage): Don't save function_used_regs if it contains all

Re: -fuse-caller-save - Collect register usage information

2014-07-13 Thread Jan Hubicka
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

Re: -fuse-caller-save - Collect register usage information

2014-06-19 Thread Tom de Vries
On 19-06-14 07:13, Richard Henderson wrote: On 05/19/2014 07:30 AM, Tom de Vries wrote: + for (insn = get_insns (); insn != NULL_RTX; insn = next_insn (insn)) +{ + HARD_REG_SET insn_used_regs; + + if (!NONDEBUG_INSN_P (insn)) + continue; + + find_all_hard_reg_sets (insn,

Re: -fuse-caller-save - Collect register usage information

2014-06-19 Thread Richard Henderson
On 06/19/2014 05:39 AM, Tom de Vries wrote: 2014-06-19 Tom de Vries t...@codesourcery.com * final.c (collect_fn_hard_reg_usage): Add and use variable function_used_regs. Looks good, thanks. r~

Re: -fuse-caller-save - Collect register usage information

2014-06-19 Thread Tom de Vries
On 19-06-14 07:13, Richard Henderson wrote: On 05/19/2014 07:30 AM, Tom de Vries wrote: + for (insn = get_insns (); insn != NULL_RTX; insn = next_insn (insn)) +{ + HARD_REG_SET insn_used_regs; + + if (!NONDEBUG_INSN_P (insn)) + continue; + + find_all_hard_reg_sets

Re: -fuse-caller-save - Collect register usage information

2014-06-19 Thread Richard Henderson
On 06/19/2014 09:06 AM, Tom de Vries wrote: 2014-06-19 Tom de Vries t...@codesourcery.com * final.c (collect_fn_hard_reg_usage): Don't save function_used_regs if it contains all call_used_regs. Ok. r~

Re: -fuse-caller-save - Collect register usage information

2014-06-19 Thread Jan Hubicka
On 06/19/2014 09:06 AM, Tom de Vries wrote: 2014-06-19 Tom de Vries t...@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,

Re: -fuse-caller-save - Collect register usage information

2014-06-19 Thread Richard Henderson
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 t...@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

Re: -fuse-caller-save - Collect register usage information

2014-06-18 Thread Richard Henderson
On 05/19/2014 07:30 AM, Tom de Vries wrote: + for (insn = get_insns (); insn != NULL_RTX; insn = next_insn (insn)) +{ + HARD_REG_SET insn_used_regs; + + if (!NONDEBUG_INSN_P (insn)) + continue; + + find_all_hard_reg_sets (insn, insn_used_regs, false); + + if

Re: -fuse-caller-save - Collect register usage information

2014-05-29 Thread Tom de Vries
On 29-05-14 00:42, Bill Schmidt wrote: Tom, the final version of this patch that you committed breaks bootstrap on powerpc64le-linux-gnu. The problem is that all uses of the variable i are guarded by #ifdef STACK_REGS, but the declaration of i is unconditional. We get an unused variable

Re: -fuse-caller-save - Collect register usage information

2014-05-28 Thread Bill Schmidt
Tom, the final version of this patch that you committed breaks bootstrap on powerpc64le-linux-gnu. The problem is that all uses of the variable i are guarded by #ifdef STACK_REGS, but the declaration of i is unconditional. We get an unused variable warning that becomes an error during stage 3.

Re: -fuse-caller-save - Collect register usage information

2014-05-24 Thread Jan Hubicka
2013-04-29 Radovan Obradovic robrado...@mips.com Tom de Vries t...@codesourcery.com * cgraph.h (struct cgraph_node): Add function_used_regs, function_used_regs_initialized and function_used_regs_valid fields. * final.c: Move include of hard-reg-set.h to

Re: -fuse-caller-save - Collect register usage information

2014-05-24 Thread Jan Hubicka
+/* Get the declaration of the function called by INSN. */ + +static tree +get_call_fndecl (rtx insn) +{ + rtx note, datum; + + note = find_reg_note (insn, REG_CALL_DECL, NULL_RTX); + if (note == NULL_RTX) +return NULL_TREE; + + datum = XEXP (note, 0); + if (datum !=

Re: -fuse-caller-save - Collect register usage information

2014-05-20 Thread Eric Botcazou
The test in get_call_reg_set_usage for flag_use_caller_save and the hook is strictly speaking not necessary. But it's the interface function to retrieve the collected register usage information, so it seems a good location to do an early-out. I've left it in for now. But the test for

Re: -fuse-caller-save - Collect register usage information

2014-05-19 Thread Tom de Vries
On 17-05-14 12:51, Eric Botcazou wrote: This is the updated version of the previously approved patch submitted here (http://gcc.gnu.org/ml/gcc-patches/2013-03/msg01320.html ). The changes are: - using a new hook call_fusage_contains_non_callee_clobbers, - incorporating minor review comments from

Re: -fuse-caller-save - Collect register usage information

2014-05-17 Thread Eric Botcazou
This is the updated version of the previously approved patch submitted here (http://gcc.gnu.org/ml/gcc-patches/2013-03/msg01320.html ). The changes are: - using a new hook call_fusage_contains_non_callee_clobbers, - incorporating minor review comments from Richard Sandiford (

Re: -fuse-caller-save - Collect register usage information

2014-04-26 Thread Tom de Vries
Eric, Honza, This patch adds analysis in pass_final to track which hard registers are set or clobbered by the function body, and stores that information in a struct cgraph_node, to be used in the fuse-caller-save optmization. This is the updated version of the previously approved patch

Re: -fuse-caller-save - Collect register usage information

2014-04-23 Thread Vladimir Makarov
On 2014-04-23, 6:41 AM, Tom de Vries wrote: On 22-04-14 17:05, Tom de Vries wrote: I've updated the fuse-caller-save patch series to model non-callee call clobbers in CALL_INSN_FUNCTION_USAGE. Vladimir, This is the updated version of the previously approved patch

Re: -fuse-caller-save - Collect register usage information

2014-04-23 Thread Richard Sandiford
Tom de Vries tom_devr...@mentor.com writes: +/* Collect hard register usage for the current function. */ + +static void +collect_fn_hard_reg_usage (void) +{ + rtx insn; + int i; + struct cgraph_node *node; + + if (!flag_use_caller_save) +return; + + node = cgraph_get_node