Patchwork [05/10] -fuse-caller-save - Implement TARGET_FN_OTHER_HARD_REG_USAGE hook for ARM

login
register
mail settings
Submitter Tom de Vries
Date March 30, 2013, 5:11 p.m.
Message ID <20130330171125.76877421213@build1-lucid-cs>
Download mbox | patch
Permalink /patch/232537/
State New
Headers show

Comments

Tom de Vries - March 30, 2013, 5:11 p.m.
Richard,

This patch series adds analysis of register usage of functions for usage by IRA.
The original post is here
( http://gcc.gnu.org/ml/gcc-patches/2013-01/msg01234.html ).

This patch implements the target hook TARGET_FN_OTHER_HARD_REG_USAGE for ARM.
The target hook TARGET_FN_OTHER_HARD_REG_USAGE was introduced in the previous
patch in this patch series.

Build and reg-tested on ARM.

OK for trunk?

Thanks,
  -Tom

2013-03-30  Radovan Obradovic  <robradovic@mips.com>
            Tom de Vries  <tom@codesourcery.com>

	* config/arm/arm.c (TARGET_FN_OTHER_HARD_REG_USAGE): Redefine as
	arm_fn_other_hard_reg_usage.
	(arm_fn_other_hard_reg_usage): New function.
Tom de Vries - Dec. 6, 2013, 12:54 a.m.
On 30-03-13 18:11, Tom de Vries wrote:
> Richard,
>
> This patch series adds analysis of register usage of functions for usage by IRA.
> The original post is here
> ( http://gcc.gnu.org/ml/gcc-patches/2013-01/msg01234.html ).
>
> This patch implements the target hook TARGET_FN_OTHER_HARD_REG_USAGE for ARM.
> The target hook TARGET_FN_OTHER_HARD_REG_USAGE was introduced in the previous
> patch in this patch series.
>
> Build and reg-tested on ARM.
>
> OK for trunk?
>

Richard,

Ping. OK for stage1?

Thanks,
- Tom

> Thanks,
>    -Tom
>
> 2013-03-30  Radovan Obradovic  <robradovic@mips.com>
>              Tom de Vries  <tom@codesourcery.com>
>
> 	* config/arm/arm.c (TARGET_FN_OTHER_HARD_REG_USAGE): Redefine as
> 	arm_fn_other_hard_reg_usage.
> 	(arm_fn_other_hard_reg_usage): New function.
>
Richard Earnshaw - Dec. 9, 2013, 10:03 a.m.
On 06/12/13 00:54, Tom de Vries wrote:
> On 30-03-13 18:11, Tom de Vries wrote:
>> Richard,
>>
>> This patch series adds analysis of register usage of functions for usage by IRA.
>> The original post is here
>> ( http://gcc.gnu.org/ml/gcc-patches/2013-01/msg01234.html ).
>>
>> This patch implements the target hook TARGET_FN_OTHER_HARD_REG_USAGE for ARM.
>> The target hook TARGET_FN_OTHER_HARD_REG_USAGE was introduced in the previous
>> patch in this patch series.
>>
>> Build and reg-tested on ARM.
>>
>> OK for trunk?
>>
> 
> Richard,
> 
> Ping. OK for stage1?
> 
> Thanks,
> - Tom
> 
>> Thanks,
>>    -Tom
>>
>> 2013-03-30  Radovan Obradovic  <robradovic@mips.com>
>>              Tom de Vries  <tom@codesourcery.com>
>>
>> 	* config/arm/arm.c (TARGET_FN_OTHER_HARD_REG_USAGE): Redefine as
>> 	arm_fn_other_hard_reg_usage.
>> 	(arm_fn_other_hard_reg_usage): New function.
>>
> 
> 

OK.

R.

Patch

diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 5f63a2e..341fa86 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -280,6 +280,7 @@  static unsigned arm_add_stmt_cost (void *data, int count,
 
 static void arm_canonicalize_comparison (int *code, rtx *op0, rtx *op1,
 					 bool op0_preserve_value);
+static void arm_fn_other_hard_reg_usage (struct hard_reg_set_container *);
 
 /* Table of machine attributes.  */
 static const struct attribute_spec arm_attribute_table[] =
@@ -649,6 +650,10 @@  static const struct attribute_spec arm_attribute_table[] =
 #define TARGET_CANONICALIZE_COMPARISON \
   arm_canonicalize_comparison
 
+#undef TARGET_FN_OTHER_HARD_REG_USAGE
+#define TARGET_FN_OTHER_HARD_REG_USAGE \
+  arm_fn_other_hard_reg_usage
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 /* Obstack for minipool constant handling.  */
@@ -3762,6 +3767,19 @@  arm_canonicalize_comparison (int *code, rtx *op0, rtx *op1,
     }
 }
 
+/* Implement TARGET_FN_OTHER_HARD_REG_USAGE.  */
+
+static void
+arm_fn_other_hard_reg_usage (struct hard_reg_set_container *regs)
+{
+  if (TARGET_AAPCS_BASED)
+    {
+      /* For AAPCS, IP and CC can be clobbered by veneers inserted by the
+	 linker.  */
+      SET_HARD_REG_BIT (regs->set, IP_REGNUM);
+      SET_HARD_REG_BIT (regs->set, CC_REGNUM);
+    }
+}
 
 /* Define how to find the value returned by a function.  */