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: [RFA:] Don't strip unary ops when matching constraints. (PRtarget/23424)


> Date: Mon, 17 Oct 2005 18:22:04 -0700
> From: Mark Mitchell <mark@codesourcery.com>

> I agree with Joern; the safe change is to add a hook, which indicates
> the current behavior, except on CRIS, where it indicates the new
> behavior, and then remove that in Stage 1.  That change is OK now, to
> fix the CRIS bug; unconditional removal is not, unless you get the SH
> people to buy in.

I don't think I got buy-in for removing that code now, since the
SH port needs adjustments, but at least I think we all now agree
that the code can be removed in stage 1.

Tested X to mmix-knuth-mmixware, cris-elf, sh-elf, sh64-elf.
Ok to commit?

:ADDPATCH: middle-end:

	PR target/23424
	* recog.c (constrain_operands): Strip unary operators
	only ifndef KEEP_UNARY_OPERATORS_AT_CONSTRAINT_CHECKING.
	* reload.c (find_reloads): Ditto.
        * config/cris/cris.h (KEEP_UNARY_OPERATORS_AT_CONSTRAINT_CHECKING):
	Define.

Index: cris.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/cris/cris.h,v
retrieving revision 1.99
diff -p -u -r1.99 cris.h
--- cris.h	9 Jul 2005 01:09:48 -0000	1.99
+++ cris.h	22 Oct 2005 07:55:38 -0000
@@ -638,6 +638,10 @@ enum reg_class 
 
 #define EXTRA_MEMORY_CONSTRAINT(X, STR) ((X) == 'Q')
 
+/* We want the unary operators visible for constraint checking.
+   (will always be the case in 4.2).  */
+#define KEEP_UNARY_OPERATORS_AT_CONSTRAINT_CHECKING
+
 #define EXTRA_CONSTRAINT_Q(X)				\
  (							\
   /* Just an indirect register (happens to also be	\
Index: recog.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/recog.c,v
retrieving revision 1.227
diff -p -u -r1.227 recog.c
--- recog.c	27 Aug 2005 02:08:28 -0000	1.227
+++ recog.c	22 Oct 2005 07:42:19 -0000
@@ -2314,10 +2314,20 @@ constrain_operands (int strict)
 
 	  earlyclobber[opno] = 0;
 
+#ifndef KEEP_UNARY_OPERATORS_AT_CONSTRAINT_CHECKING
+	  /* This macro and the code within is slated for removal in
+	     4.2, hence not documented further than in this comment.
+	     It only makes a difference if both an insn operand
+	     predicate is absent or allows unary operators and its
+	     constraints are present.  See gcc-patches mailing list
+	     thread starting at
+	     <URL:http://gcc.gnu.org/ml/gcc-patches/2005-10/msg00940.html>.  */
+
 	  /* A unary operator may be accepted by the predicate, but it
 	     is irrelevant for matching constraints.  */
 	  if (UNARY_P (op))
 	    op = XEXP (op, 0);
+#endif
 
 	  if (GET_CODE (op) == SUBREG)
 	    {
@@ -2389,12 +2399,16 @@ constrain_operands (int strict)
 		      rtx op1 = recog_data.operand[match];
 		      rtx op2 = recog_data.operand[opno];
 
+#ifndef KEEP_UNARY_OPERATORS_AT_CONSTRAINT_CHECKING
+		      /* See comment at similar #ifndef above.  */
+
 		      /* A unary operator may be accepted by the predicate,
 			 but it is irrelevant for matching constraints.  */
 		      if (UNARY_P (op1))
 			op1 = XEXP (op1, 0);
 		      if (UNARY_P (op2))
 			op2 = XEXP (op2, 0);
+#endif
 
 		      val = operands_match_p (op1, op2);
 		    }
Index: reload.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/reload.c,v
retrieving revision 1.276
diff -p -u -r1.276 reload.c
--- reload.c	5 Oct 2005 19:50:27 -0000	1.276
+++ reload.c	22 Oct 2005 07:42:23 -0000
@@ -2937,11 +2937,15 @@ find_reloads (rtx insn, int replace, int
 	  int constmemok = 0;
 	  int earlyclobber = 0;
 
+#ifndef KEEP_UNARY_OPERATORS_AT_CONSTRAINT_CHECKING
+	  /* See comment at similar #ifndef in recog.c.  */
+
 	  /* If the predicate accepts a unary operator, it means that
 	     we need to reload the operand, but do not do this for
 	     match_operator and friends.  */
 	  if (UNARY_P (operand) && *p != 0)
 	    operand = XEXP (operand, 0);
+#endif
 
 	  /* If the operand is a SUBREG, extract
 	     the REG or MEM (or maybe even a constant) within.

brgds, H-P


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