From 106a52b7bff18807dedbfc54e48db07d375e7eac Mon Sep 17 00:00:00 2001 From: Kaz Kojima Date: Fri, 19 Dec 2014 04:47:18 +0000 Subject: [PATCH] * [SH] Add -mlra option. From-SVN: r218888 --- gcc/ChangeLog | 7 +++++++ gcc/config/sh/sh.c | 14 ++++++++++++++ gcc/config/sh/sh.opt | 3 +++ 3 files changed, 24 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b22e5aa3607..fd92d522057 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2014-12-19 Kaz Kojima + + * config/sh/sh.c (sh_lra_p): New function. + (TARGET_LRA_P): Define. + (sh_legitimize_reload_address): Return false if sh_lra_p is true. + * config/sh/sh.opt (mlra): New option. + 2014-12-19 Kaz Kojima * lra-constraints.c (process_address_1): Try if target can split diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index 815f4d90a9f..e586f48c5ea 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -222,6 +222,7 @@ static int sh_mode_after (int, int, rtx_insn *); static int sh_mode_entry (int); static int sh_mode_exit (int); static int sh_mode_priority (int entity, int n); +static bool sh_lra_p (void); static rtx mark_constant_pool_use (rtx); static tree sh_handle_interrupt_handler_attribute (tree *, tree, tree, @@ -620,6 +621,9 @@ static const struct attribute_spec sh_attribute_table[] = #undef TARGET_ENCODE_SECTION_INFO #define TARGET_ENCODE_SECTION_INFO sh_encode_section_info +#undef TARGET_LRA_P +#define TARGET_LRA_P sh_lra_p + #undef TARGET_SECONDARY_RELOAD #define TARGET_SECONDARY_RELOAD sh_secondary_reload @@ -10484,6 +10488,9 @@ sh_legitimize_reload_address (rtx *p, machine_mode mode, int opnum, enum reload_type type = (enum reload_type) itype; const int mode_sz = GET_MODE_SIZE (mode); + if (sh_lra_p ()) + return false; + if (! ALLOW_INDEXED_ADDRESS && GET_CODE (*p) == PLUS && REG_P (XEXP (*p, 0)) && REG_P (XEXP (*p, 1))) @@ -13774,6 +13781,13 @@ sh_mode_priority (int entity ATTRIBUTE_UNUSED, int n) return ((TARGET_FPU_SINGLE != 0) ^ (n) ? FP_MODE_SINGLE : FP_MODE_DOUBLE); } +/* Return true if we use LRA instead of reload pass. */ +static bool +sh_lra_p (void) +{ + return sh_lra_flag; +} + /* Implement TARGET_USE_BY_PIECES_INFRASTRUCTURE_P. */ static bool diff --git a/gcc/config/sh/sh.opt b/gcc/config/sh/sh.opt index bb6d3958135..375bb88d741 100644 --- a/gcc/config/sh/sh.opt +++ b/gcc/config/sh/sh.opt @@ -360,3 +360,6 @@ mfsrra Target Var(TARGET_FSRRA) Enable the use of the fsrra instruction +mlra +Target Report Var(sh_lra_flag) Init(0) Save +Use LRA instead of reload (transitional) -- 2.30.2