Hi, This patch moves mips to TARGET_MOVE_BY_PIECES_PROFITABLE_P.
I tried building a compiler and there were no fires, I don't have access to any MIPS hardware, so if one of the MIPS maintainers wanted to pick this up and test it, that would be very much appreciated. OK? Thanks, James --- gcc/ 2014-10-28 James Greenhalgh <james.greenha...@arm.com> * config/mips/mips.h (MOVE_BY_PIECES_P): Remove. * config/mips/mips.c (TARGET_MOVE_BY_PIECES_PROFITABLE_P): New. (mips_move_by_pieces_p): Rename to... (mips_move_by_pieces_profitable_p): ...this, use new hook parameters, use the default hook implementation as a fall-back.
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index 2f9d2da..4d7ef81 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -7172,7 +7172,9 @@ mips_function_ok_for_sibcall (tree decl, tree exp ATTRIBUTE_UNUSED) /* Implement MOVE_BY_PIECES_P. */ bool -mips_move_by_pieces_p (unsigned HOST_WIDE_INT size, unsigned int align) +mips_move_by_pieces_profitable_p (unsigned int size, + unsigned int align, + bool speed_p) { if (HAVE_movmemsi) { @@ -7191,10 +7193,8 @@ mips_move_by_pieces_p (unsigned HOST_WIDE_INT size, unsigned int align) return size < UNITS_PER_WORD; return size <= MIPS_MAX_MOVE_BYTES_STRAIGHT; } - /* The default value. If this becomes a target hook, we should - call the default definition instead. */ - return (move_by_pieces_ninsns (size, align, MOVE_MAX_PIECES + 1) - < (unsigned int) MOVE_RATIO (optimize_insn_for_speed_p ())); + + return default_move_by_pieces_profitable_p (size, align, speed_p); } /* Implement STORE_BY_PIECES_P. */ @@ -19116,6 +19116,9 @@ mips_lra_p (void) #undef TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS #define TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS true +#undef TARGET_MOVE_BY_PIECES_PROFITABLE_P +#define TARGET_MOVE_BY_PIECES_PROFITABLE_P mips_move_by_pieces_profitable_p + #undef TARGET_SPILL_CLASS #define TARGET_SPILL_CLASS mips_spill_class #undef TARGET_LRA_P diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h index c7b998b..6872940 100644 --- a/gcc/config/mips/mips.h +++ b/gcc/config/mips/mips.h @@ -2872,9 +2872,6 @@ while (0) ? MIPS_MAX_MOVE_BYTES_STRAIGHT / MOVE_MAX \ : MIPS_CALL_RATIO / 2) -#define MOVE_BY_PIECES_P(SIZE, ALIGN) \ - mips_move_by_pieces_p (SIZE, ALIGN) - /* For CLEAR_RATIO, when optimizing for size, give a better estimate of the length of a memset call, but use the default otherwise. */