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 <robrado...@mips.com> Tom de Vries <t...@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.
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. */