public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [committed] CRIS-LRA: Fix uses of reload_in_progress
@ 2023-05-04  0:07 Hans-Peter Nilsson
  0 siblings, 0 replies; only message in thread
From: Hans-Peter Nilsson @ 2023-05-04  0:07 UTC (permalink / raw)
  To: gcc-patches; +Cc: jeffreyalaw

On previous occasions when a general LRA transition has been
discussed, IIRC, the argument was used, that everything is ready for
targets and their maintainers to make the transition.  As I pointed
out then (though more than a year ago last time, people forget) that's
still not true: LRA documentation needs improvement to know what to
do, and having to sneak peaks at other targets is not a valid level of
documentation.  Here's an example and its fall-out: what to do with
lra_in_progress vs. reload_in_progress.  I "guess" lra_in_progress is
supposed to be used like reload_in_progress.  The consequences of
missing it is quite mild though: LRA takes most of its data from state
collected during IRA, and lra_in_progress has much less impact there,
than reload_in_progress has for reload.

Anyway, many supposedly-transformed targets (without TARGET_LRA_P)
still mention reload_in_progress, like aarch64, arm, csky, epiphany,
iq2000, m32r, microblaze, mmix (I'll deal with this one), moxie,
nds32, stormy16, v850 (with reservations for grep-errors; the list may
be erroneous or incomplete).

While this may have been of no measureable consequence to CRIS, it
*might* be a build-breaker for other targets, transformed or
about-to-be transformed, thus heads-up to eager converters. ;-)

(JFTR: in comparison, reload_completed is used for both LRA and
reload; there's no "lra_completed".)

Committed.
-- >8 --
This shows no difference neither in arith-rand-ll nor coremark
numbers.  Comparing libgcc and newlib libc before/after, the only
difference can be seen in a few functions where it's mostly neutral
(newlib's _svfprintf_r et al) and one function (__gdtoa), which
improves ever so slightly (four bytes less; one load less, but one
instruction reading from memory instead of a register).

	* config/cris/cris.cc (cris_side_effect_mode_ok): Use
	lra_in_progress, not reload_in_progress.
	* config/cris/cris.md ("movdi", "*addi_reload"): Ditto.
	* config/cris/constraints.md ("Q"): Ditto.
---
 gcc/config/cris/constraints.md | 18 +++++++++---------
 gcc/config/cris/cris.cc        | 18 +++++++++---------
 gcc/config/cris/cris.md        |  4 ++--
 3 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/gcc/config/cris/constraints.md b/gcc/config/cris/constraints.md
index fa9aa19d13e3..3df8cc27d8d4 100644
--- a/gcc/config/cris/constraints.md
+++ b/gcc/config/cris/constraints.md
@@ -96,7 +96,7 @@ (define_constraint "G"
 (define_memory_constraint "Q"
   "@internal"
   (and (match_code "mem")
-       (match_test "cris_base_p (XEXP (op, 0), reload_in_progress
+       (match_test "cris_base_p (XEXP (op, 0), lra_in_progress
 					       || reload_completed)")))
 
 ;; Extra constraints.
@@ -107,7 +107,7 @@ (define_memory_constraint "T"
 	    ;; Double indirect: [[reg]] or [[reg+]]?
        (ior (and (match_code "mem" "0")
 		 (match_test "cris_base_or_autoincr_p (XEXP (XEXP (op, 0), 0),
-						       reload_in_progress
+						       lra_in_progress
 						       || reload_completed)"))
 	    ;; Just an explicit indirect reference: [const]?
 	    (match_test "CONSTANT_P (XEXP (op, 0))")
@@ -115,29 +115,29 @@ (define_memory_constraint "T"
 	    (and (match_code "plus" "0")
 		      ;; A BDAP constant: [reg+(8|16|32)bit offset]?
 		 (ior (and (match_test "cris_base_p (XEXP (XEXP (op, 0), 0),
-						     reload_in_progress
+						     lra_in_progress
 						     || reload_completed)")
 			   (match_test "CONSTANT_P (XEXP (XEXP (op, 0), 1))"))
 		      ;; A BDAP register: [reg+[reg(+)].S]?
 		      (and (match_test "cris_base_p (XEXP (XEXP (op, 0), 0),
-						     reload_in_progress
+						     lra_in_progress
 						     || reload_completed)")
 			   (match_test "cris_bdap_index_p (XEXP (XEXP (op, 0), 1),
-							   reload_in_progress
+							   lra_in_progress
 							   || reload_completed)"))
 		      ;; Same, but with swapped arguments (no canonical
 		      ;; ordering between e.g. REG and MEM as of LAST_UPDATED
 		      ;; "Thu May 12 03:59:11 UTC 2005").
 		      (and (match_test "cris_base_p (XEXP (XEXP (op, 0), 1),
-						     reload_in_progress
+						     lra_in_progress
 						     || reload_completed)")
 			   (match_test "cris_bdap_index_p (XEXP (XEXP (op, 0), 0),
-							   reload_in_progress
+							   lra_in_progress
 							   || reload_completed)"))
 		      ;; A BIAP: [reg+reg.S] (MULT comes first).
 		      (and (match_test "cris_base_p (XEXP (XEXP (op, 0), 1),
-						     reload_in_progress
+						     lra_in_progress
 						     || reload_completed)")
 			   (match_test "cris_biap_index_p (XEXP (XEXP (op, 0), 0),
-							   reload_in_progress
+							   lra_in_progress
 							   || reload_completed)")))))))
diff --git a/gcc/config/cris/cris.cc b/gcc/config/cris/cris.cc
index 7ce1b754e76e..3013e01f22ac 100644
--- a/gcc/config/cris/cris.cc
+++ b/gcc/config/cris/cris.cc
@@ -2134,12 +2134,12 @@ cris_side_effect_mode_ok (enum rtx_code code, rtx *ops,
   /* The operands may be swapped.  Canonicalize them in reg_rtx and
      val_rtx, where reg_rtx always is a reg (for this constraint to
      match).  */
-  if (! cris_base_p (reg_rtx, reload_in_progress || reload_completed))
+  if (! cris_base_p (reg_rtx, lra_in_progress || reload_completed))
     reg_rtx = val_rtx, val_rtx = ops[rreg];
 
   /* Don't forget to check that reg_rtx really is a reg.  If it isn't,
      we have no business.  */
-  if (! cris_base_p (reg_rtx, reload_in_progress || reload_completed))
+  if (! cris_base_p (reg_rtx, lra_in_progress || reload_completed))
     return 0;
 
   /* Don't do this when -mno-split.  */
@@ -2164,9 +2164,9 @@ cris_side_effect_mode_ok (enum rtx_code code, rtx *ops,
       /* Check if the lvalue register is the same as the "other
 	 operand".  If so, the result is undefined and we shouldn't do
 	 this.  FIXME:  Check again.  */
-      if ((cris_base_p (ops[lreg], reload_in_progress || reload_completed)
+      if ((cris_base_p (ops[lreg], lra_in_progress || reload_completed)
 	   && cris_base_p (ops[other_op],
-			   reload_in_progress || reload_completed)
+			   lra_in_progress || reload_completed)
 	   && REGNO (ops[lreg]) == REGNO (ops[other_op]))
 	  || rtx_equal_p (ops[other_op], ops[lreg]))
       return 0;
@@ -2179,7 +2179,7 @@ cris_side_effect_mode_ok (enum rtx_code code, rtx *ops,
     return 0;
 
   if (code == PLUS
-      && ! cris_base_p (val_rtx, reload_in_progress || reload_completed))
+      && ! cris_base_p (val_rtx, lra_in_progress || reload_completed))
     {
 
       /* Do not allow rx = rx + n if a normal add or sub with same size
@@ -2195,13 +2195,13 @@ cris_side_effect_mode_ok (enum rtx_code code, rtx *ops,
 
       if (MEM_P (val_rtx)
 	  && cris_base_or_autoincr_p (XEXP (val_rtx, 0),
-				      reload_in_progress || reload_completed))
+				      lra_in_progress || reload_completed))
 	return 1;
 
       if (GET_CODE (val_rtx) == SIGN_EXTEND
 	  && MEM_P (XEXP (val_rtx, 0))
 	  && cris_base_or_autoincr_p (XEXP (XEXP (val_rtx, 0), 0),
-				      reload_in_progress || reload_completed))
+				      lra_in_progress || reload_completed))
 	return 1;
 
       /* If we got here, it's not a valid addressing mode.  */
@@ -2210,7 +2210,7 @@ cris_side_effect_mode_ok (enum rtx_code code, rtx *ops,
   else if (code == MULT
 	   || (code == PLUS
 	       && cris_base_p (val_rtx,
-			       reload_in_progress || reload_completed)))
+			       lra_in_progress || reload_completed)))
     {
       /* Do not allow rx = rx + ry.S, since it doesn't give better code.  */
       if (rtx_equal_p (ops[lreg], reg_rtx)
@@ -2222,7 +2222,7 @@ cris_side_effect_mode_ok (enum rtx_code code, rtx *ops,
 	return 0;
 
       /* Only allow  r + ...  */
-      if (! cris_base_p (reg_rtx, reload_in_progress || reload_completed))
+      if (! cris_base_p (reg_rtx, lra_in_progress || reload_completed))
 	return 0;
 
       /* If we got here, all seems ok.
diff --git a/gcc/config/cris/cris.md b/gcc/config/cris/cris.md
index 366b4bc304bf..3796a78480cb 100644
--- a/gcc/config/cris/cris.md
+++ b/gcc/config/cris/cris.md
@@ -528,7 +528,7 @@ (define_expand "movdi"
      emitted) is the final value.  */
   if ((CONST_INT_P (operands[1]) || GET_CODE (operands[1]) == CONST_DOUBLE)
       && ! reload_completed
-      && ! reload_in_progress)
+      && ! lra_in_progress)
     {
       rtx insns;
       rtx op0 = operands[0];
@@ -1328,7 +1328,7 @@ (define_insn_and_split "*addi_reload"
    && operands[1] != frame_pointer_rtx
    && CONST_INT_P (operands[3])
    && (INTVAL (operands[3]) == 2 || INTVAL (operands[3]) == 4)
-   && (reload_in_progress || reload_completed)"
+   && (lra_in_progress || reload_completed)"
   "#"
   "&& 1"
   [(set (match_dup 0)
-- 
2.30.2


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-05-04  0:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-04  0:07 [committed] CRIS-LRA: Fix uses of reload_in_progress Hans-Peter Nilsson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).