This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: RFA reload.c patch


> Those should be && operators not || operators, as both conditions must
> be true.  That also allows you to get rid of some parentheses now.
> 

Right. Logic. Whee.

> In the second test, the x should be XEXP (XEXP (x, 0), 1), i.e. the same
> test used in CONSTANT_P.

Umm. Yes. Thanks.

Attached. Bootstrapped on x86-linux. Regtested on frv-elf and x86-linux
with no changes.

OK?

-eric

-- 
Eric Christopher <echristo@redhat.com>

2003-11-13  Eric Christopher  <echristo@redhat.com>

	* reload1.c (reload): Revert previous patch. Make
	check for assignment into reg_equiv_address stricter.

Index: reload1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/reload1.c,v
retrieving revision 1.409
diff -u -p -w -r1.409 reload1.c
--- reload1.c	12 Nov 2003 07:24:25 -0000	1.409
+++ reload1.c	14 Nov 2003 01:48:08 -0000
@@ -774,12 +774,6 @@ reload (rtx first, int global)
 			    = force_const_mem (GET_MODE (SET_DEST (set)), x);
 			  if (!reg_equiv_memory_loc[i])
 			    continue;
-			  /* As above. Later passes of reload assume that
-			     all addresses found in the reg_equiv_* arrays
-			     were originally legitimate.  */
-			  if (!memory_operand (reg_equiv_memory_loc[i], VOIDmode))
-			    reg_equiv_memory_loc[i] = NULL_RTX;
-
 			}
 		    }
 		  else
@@ -916,18 +910,24 @@ reload (rtx first, int global)
 	if (reg_renumber[i] < 0 && reg_equiv_memory_loc[i])
 	  {
 	    rtx x = eliminate_regs (reg_equiv_memory_loc[i], 0, NULL_RTX);
+	    enum reg_class class = MODE_BASE_REG_CLASS (GET_MODE (x));
 
 	    if (strict_memory_address_p (GET_MODE (regno_reg_rtx[i]),
 					 XEXP (x, 0)))
 	      reg_equiv_mem[i] = x, reg_equiv_address[i] = 0;
-	    else if (CONSTANT_P (XEXP (x, 0))
+	    else if ((CONSTANT_P (x)
+		      && LEGITIMATE_CONSTANT_P (x)
+		      && PREFERRED_RELOAD_CLASS (x, class) != NO_REGS)
 		     || (GET_CODE (XEXP (x, 0)) == REG
 			 && REGNO (XEXP (x, 0)) < FIRST_PSEUDO_REGISTER)
 		     || (GET_CODE (XEXP (x, 0)) == PLUS
 			 && GET_CODE (XEXP (XEXP (x, 0), 0)) == REG
 			 && (REGNO (XEXP (XEXP (x, 0), 0))
 			     < FIRST_PSEUDO_REGISTER)
-			 && CONSTANT_P (XEXP (XEXP (x, 0), 1))))
+			 && (CONSTANT_P (XEXP (XEXP (x, 0), 1))
+			     && LEGITIMATE_CONSTANT_P (XEXP (XEXP (x, 0), 1))
+			     && PREFERRED_RELOAD_CLASS (XEXP (XEXP (x, 0), 1), class)
+			                                    != NO_REGS)))
 	      reg_equiv_address[i] = XEXP (x, 0), reg_equiv_mem[i] = 0;
 	    else
 	      {



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]