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 29, 2013, 1:06 p.m.
Message ID <20130329130609.2E0FA4213AB@build1-lucid-cs>
Download mbox | patch
Permalink /patch/232398/
State New
Headers show

Comments

Tom de Vries - March 29, 2013, 1:06 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-29  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.

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.  */