With the remaining known issues having been mostly resolved, this finally
flips the LRA switch for SH.
Some cleanup patches will probably follow to remove the remaining is-lra?
checks that have been added over the time.
Thanks to everyone who helped out with this, especially Kaz!
Best regards,
Oleg Endo
gcc/ChangeLog:
PR target/55212
* config/sh/sh.opt (mlra): Ignore option but keep it around
for compatibility.
* config/sh/sh.cc (TARGET_LRA_P): Remove.
(sh_lra_p): Move definition ...
* config/sh/sh-protos.h (sh_lra_p): ... here. Always return true.
* doc/invoke.texi: Remove mention of -mlra for SH.
From 5176694db809769480b1d48f4a841b9893cf26fd Mon Sep 17 00:00:00 2001
From: Oleg Endo <[email protected]>
Date: Wed, 25 Sep 2024 09:47:25 +0900
Subject: [PATCH] SH: Switch to LRA permanently
gcc/ChangeLog:
PR target/55212
* config/sh/sh.opt (mlra): Ignore option but keep it around
for compatibility.
* config/sh/sh.cc (TARGET_LRA_P): Remove.
(sh_lra_p): Move definition ...
* config/sh/sh-protos.h (sh_lra_p): ... here. Always return true.
* doc/invoke.texi: Remove mention of -mlra for SH.
---
gcc/config/sh/sh-protos.h | 7 ++++++-
gcc/config/sh/sh.cc | 10 ----------
gcc/config/sh/sh.opt | 4 ++--
gcc/doc/invoke.texi | 9 +--------
4 files changed, 9 insertions(+), 21 deletions(-)
diff --git a/gcc/config/sh/sh-protos.h b/gcc/config/sh/sh-protos.h
index adf227e..c040af2 100644
--- a/gcc/config/sh/sh-protos.h
+++ b/gcc/config/sh/sh-protos.h
@@ -40,7 +40,12 @@ extern rtx sh_fsca_sf2int (void);
extern rtx sh_fsca_int2sf (void);
/* Declare functions defined in sh.cc and used in templates. */
-extern bool sh_lra_p (void);
+
+/* FIXME: sh_lra_p is for transional purposes only. Remove it eventually. */
+inline bool sh_lra_p (void)
+{
+ return true;
+}
extern const char *output_branch (int, rtx_insn *, rtx *);
extern const char *output_ieee_ccmpeq (rtx_insn *, rtx *);
diff --git a/gcc/config/sh/sh.cc b/gcc/config/sh/sh.cc
index 2c63047..abb7632 100644
--- a/gcc/config/sh/sh.cc
+++ b/gcc/config/sh/sh.cc
@@ -593,9 +593,6 @@ TARGET_GNU_ATTRIBUTES (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
@@ -12653,13 +12650,6 @@ sh_mode_priority (int entity ATTRIBUTE_UNUSED, int n)
Misc
*/
-/* Return true if we use LRA instead of reload pass. */
-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 1ef494d..d0a2a31 100644
--- a/gcc/config/sh/sh.opt
+++ b/gcc/config/sh/sh.opt
@@ -299,5 +299,5 @@ Target Var(TARGET_FSRRA)
Enable the use of the fsrra instruction.
mlra
-Target Var(sh_lra_flag) Init(0) Save
-Use LRA instead of reload (transitional).
+Target Ignore
+Does nothing. Preserved for backward compatibility.
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 9546523..208625c 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -1465,7 +1465,7 @@ See RS/6000 and PowerPC Options.
-mbranch-cost=@var{num} -mzdcbranch
-mcbranch-force-delay-slot
-mfsca -mfsrra
--mpretend-cmove -mfdpic -mtas -mlra}
+-mpretend-cmove -mfdpic -mtas}
@emph{Solaris 2 Options} (@ref{Solaris 2 Options})
@gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text
@@ -33989,13 +33989,6 @@ This can result in faster code on the SH4 processor.
@itemx -mno-fdpic
Generate code using the FDPIC ABI.
-@opindex mlra
-@opindex mno-lra
-@item -mlra
-@itemx -mno-lra
-Use the new LRA register allocator. By default, the old ``reload''
-allocator is used.
-
@end table
@node Solaris 2 Options
--
libgit2 1.9.0