From: Ian Bolton Date: Tue, 13 May 2014 09:28:35 +0000 (+0000) Subject: Implement HARD_REGNO_CALLER_SAVE_MODE for AArch64 X-Git-Tag: upstream/12.2.0~63334 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=73d9ac6a6a221b0bf3f2246004f323a1a353a3aa;p=platform%2Fupstream%2Fgcc.git Implement HARD_REGNO_CALLER_SAVE_MODE for AArch64 * config/aarch64/aarch64-protos.h (aarch64_hard_regno_caller_save_mode): New prototype. * config/aarch64/aarch64.c (aarch64_hard_regno_caller_save_mode): New function. * config/aarch64/aarch64.h (HARD_REGNO_CALLER_SAVE_MODE): New macro. From-SVN: r210355 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 456f740..8352d09 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2014-05-13 Ian Bolton + + * config/aarch64/aarch64-protos.h + (aarch64_hard_regno_caller_save_mode): New prototype. + * config/aarch64/aarch64.c (aarch64_hard_regno_caller_save_mode): + New function. + * config/aarch64/aarch64.h (HARD_REGNO_CALLER_SAVE_MODE): New macro. + 2014-05-13 Christian Bruel * target.def (mode_switching): New hook vector. diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h index 04cbc78..7cf7d9f 100644 --- a/gcc/config/aarch64/aarch64-protos.h +++ b/gcc/config/aarch64/aarch64-protos.h @@ -202,6 +202,8 @@ enum aarch64_symbol_type aarch64_classify_symbol (rtx, enum aarch64_symbol_type aarch64_classify_tls_symbol (rtx); enum reg_class aarch64_regno_regclass (unsigned); int aarch64_asm_preferred_eh_data_format (int, int); +enum machine_mode aarch64_hard_regno_caller_save_mode (unsigned, unsigned, + enum machine_mode); int aarch64_hard_regno_mode_ok (unsigned, enum machine_mode); int aarch64_hard_regno_nregs (unsigned, enum machine_mode); int aarch64_simd_attr_length_move (rtx); diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 6a6fb03..fabd6a9 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -424,6 +424,24 @@ aarch64_hard_regno_mode_ok (unsigned regno, enum machine_mode mode) return 0; } +/* Implement HARD_REGNO_CALLER_SAVE_MODE. */ +enum machine_mode +aarch64_hard_regno_caller_save_mode (unsigned regno, unsigned nregs, + enum machine_mode mode) +{ + /* Handle modes that fit within single registers. */ + if (nregs == 1 && GET_MODE_SIZE (mode) <= 16) + { + if (GET_MODE_SIZE (mode) >= 4) + return mode; + else + return SImode; + } + /* Fall back to generic for multi-reg and very large modes. */ + else + return choose_hard_reg_mode (regno, nregs, false); +} + /* Return true if calls to DECL should be treated as long-calls (ie called via a register). */ static bool diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h index c9b30d0..0574593 100644 --- a/gcc/config/aarch64/aarch64.h +++ b/gcc/config/aarch64/aarch64.h @@ -824,6 +824,11 @@ do { \ #define SHIFT_COUNT_TRUNCATED !TARGET_SIMD +/* Choose appropriate mode for caller saves, so we do the minimum + required size of load/store. */ +#define HARD_REGNO_CALLER_SAVE_MODE(REGNO, NREGS, MODE) \ + aarch64_hard_regno_caller_save_mode ((REGNO), (NREGS), (MODE)) + /* Callee only saves lower 64-bits of a 128-bit register. Tell the compiler the callee clobbers the top 64-bits when restoring the bottom 64-bits. */