diff mbox series

[avr,applied] ad PR113934: Add option -mlra to switch to LRA.

Message ID 54d4da88-7b4e-48fc-9b49-339435e5ae0e@gjlay.de
State New
Headers show
Series [avr,applied] ad PR113934: Add option -mlra to switch to LRA. | expand

Commit Message

Georg-Johann Lay Aug. 10, 2024, 8:38 a.m. UTC
Applied this patch that makes it easier for the LRA maintainers
to reproduce LRA bugs that pop up for avr.

Johann

--

AVR: ad target/113934 - Add option -mlra to enable LRA.

	PR target/113934
gcc/
	* config/avr/avr.opt (-mlra): New target option.
	* config/avr/avr.cc (avr_use_lra_p): New function.
	(TARGET_LRA_P): Use it.
	(avr_hard_regno_mode_ok) [lra]: Don't disallow 4-byte modes for X.
diff mbox series

Patch

diff --git a/gcc/config/avr/avr.cc b/gcc/config/avr/avr.cc
index 5cfd67a8e74..9c9311c4128 100644
--- a/gcc/config/avr/avr.cc
+++ b/gcc/config/avr/avr.cc
@@ -14180,7 +14180,9 @@  avr_hard_regno_mode_ok (unsigned int regno, machine_mode mode)
 	address registers is extreme stress test for reload.  */
 
   if (GET_MODE_SIZE (mode) >= 4
-      && regno >= REG_X)
+      && regno >= REG_X
+      // This problem only concerned the old reload.
+      && ! avr_lra_p)
     return false;
 
   /* All modes larger than 8 bits should start in an even register.  */
@@ -16682,6 +16684,15 @@  avr_float_lib_compare_returns_bool (machine_mode mode, enum rtx_code)
   return false;
 }
 
+
+/* Implement `TARGET_LRA_P'.  */
+
+static bool
+avr_use_lra_p ()
+{
+  return avr_lra_p;
+}
+
 
 
 /* Initialize the GCC target structure.  */
@@ -16824,7 +16835,7 @@  avr_float_lib_compare_returns_bool (machine_mode mode, enum rtx_code)
 #define TARGET_CONVERT_TO_TYPE avr_convert_to_type
 
 #undef TARGET_LRA_P
-#define TARGET_LRA_P hook_bool_void_false
+#define TARGET_LRA_P avr_use_lra_p
 
 #undef  TARGET_ADDR_SPACE_SUBSET_P
 #define TARGET_ADDR_SPACE_SUBSET_P avr_addr_space_subset_p
diff --git a/gcc/config/avr/avr.opt b/gcc/config/avr/avr.opt
index c3ca8379ee3..947489eddf0 100644
--- a/gcc/config/avr/avr.opt
+++ b/gcc/config/avr/avr.opt
@@ -18,6 +18,10 @@ 
 ; along with GCC; see the file COPYING3.  If not see
 ; <http://www.gnu.org/licenses/>.
 
+mlra
+Target Var(avr_lra_p) UInteger Init(0) Optimization
+Usa LRA for reload instead of the old reload framework.  This option is experimental, and it may be removed in future versions of the compiler.
+
 mcall-prologues
 Target Mask(CALL_PROLOGUES) Optimization
 Optimization. Use subroutines for function prologues and epilogues.