diff mbox

[ARM] Enable fuse-caller-save for ARM

Message ID 53AB27B3.2010105@mentor.com
State New
Headers show

Commit Message

Tom de Vries June 25, 2014, 7:49 p.m. UTC
On 19-06-14 18:43, Richard Henderson wrote:
> On 06/19/2014 09:37 AM, Tom de Vries wrote:
>> On 19-06-14 05:59, Richard Henderson wrote:
>>> On 06/01/2014 04:27 AM, Tom de Vries wrote:
>>>> +  if (TARGET_AAPCS_BASED)
>>>> +    {
>>>> +      /* For AAPCS, IP and CC can be clobbered by veneers inserted by the
>>>> +     linker.  We need to add these to allow
>>>> +     arm_call_fusage_contains_non_callee_clobbers to return true.  */
>>>> +      rtx *fusage = &CALL_INSN_FUNCTION_USAGE (insn);
>>>> +      clobber_reg (fusage, gen_rtx_REG (word_mode, IP_REGNUM));
>>>> +      clobber_reg (fusage, gen_rtx_REG (word_mode, CC_REGNUM));
>>>
>>> Why are you adding CC_REGNUM if fixed registers are automatically included?
>>>
>>
>> Richard,
>>
>> You're right, setting a fixed register here is not required for
>> fuse-caller-save to work safely.
>>
>> But it fits the definition of the hook
>> TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS:
>> ...
>> Set to true if all the calls in the current function contain clobbers in
>> CALL_INSN_FUNCTION_USAGE for the registers that are clobbered by the call
>> rather than by the callee, and are not already set or clobbered in the call
>> pattern.
>> ...
>>
>> We can adapt the definition to not include fixed registers. I can make a patch
>> for that, if you like.
>
> I think that would be best.  It'll save just a bit of memory and scanning time.
>

Richard,

Now that the definition is updated not to include fixed registers, I've removed 
the superfluous clobber of cc.

Build and reg-tested on arm, and committed.

Thanks,
- Tom
diff mbox

Patch

2014-06-25  Tom de Vries  <tom@codesourcery.com>

	* config/arm/arm.c (arm_emit_call_insn): Remove clobber of CC_REGNUM.

diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 464dec1..0146fe8 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -17642,11 +17642,11 @@  arm_emit_call_insn (rtx pat, rtx addr, bool sibcall)
   if (TARGET_AAPCS_BASED)
     {
       /* For AAPCS, IP and CC can be clobbered by veneers inserted by the
-	 linker.  We need to add these to allow setting
-	 TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS to true.  */
+	 linker.  We need to add an IP clobber to allow setting
+	 TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS to true.  A CC clobber
+	 is not needed since it's a fixed register.  */
       rtx *fusage = &CALL_INSN_FUNCTION_USAGE (insn);
       clobber_reg (fusage, gen_rtx_REG (word_mode, IP_REGNUM));
-      clobber_reg (fusage, gen_rtx_REG (word_mode, CC_REGNUM));
     }
 }
 
-- 
1.9.1