PATCH: PA PIC symbolic memory fix PART 1

John David Anglin dave@hiauly1.hia.nrc.ca
Mon Feb 19 12:43:00 GMT 2001


When generating pic code, reload sometimes substitutes a pic symbolic
memory reference into the insn used for non-symbolic move operands.
The enclosed patch fixes the problem.  The IS_RELOADING_PSEUDO_P
and related stuff is unnecessary as far as I can tell.

The patch has been tested with a full PIC build (BOOT_CFLAGS="-g -O3 -fPIC")
under hppa1.1-hp-hpux10.20.  Testsuite results for gcc are the best in recent
memory.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)

2001-02-18  John David Anglin  <dave@hiauly1.hia.nrc.ca>

	* pa.c (symbolic_memory_operand): Add tests for pic LO_SUM and PLUS
	symbolic memory operands.
	* pa.h (IS_RELOADING_PSEUDO_P): Delete macro.
	(EXTRA_CONSTRAINT): Don't change Q and R constraints when
	reload_in_progress.  Delete incorrect comments.

--- pa.c.orig	Wed Jan 31 23:51:24 2001
+++ pa.c	Sat Feb 17 15:31:04 2001
@@ -302,7 +302,11 @@
     return 0;
   op = XEXP (op, 0);
   return (GET_CODE (op) == SYMBOL_REF || GET_CODE (op) == CONST
-	  || GET_CODE (op) == HIGH || GET_CODE (op) == LABEL_REF);
+	  || GET_CODE (op) == HIGH || GET_CODE (op) == LABEL_REF
+	  || (GET_CODE (op) == LO_SUM && GET_CODE (XEXP (op, 1)) == UNSPEC)
+	  || (GET_CODE (op) == PLUS && flag_pic
+	      && XEXP (op, 0) == pic_offset_table_rtx
+	      && symbolic_operand (XEXP (op, 1), Pmode)));
 }
 
 /* Return 1 if the operand is either a register or a memory operand that is
--- pa.h.orig	Wed Jan 31 23:51:24 2001
+++ pa.h	Sun Feb 18 14:39:05 2001
@@ -1132,22 +1132,10 @@
 
 /* Subroutine for EXTRA_CONSTRAINT.
 
-   Return 1 iff OP is a pseudo which did not get a hard register and
-   we are running the reload pass.  */
-
-#define IS_RELOADING_PSEUDO_P(OP) \
-  ((reload_in_progress					\
-    && GET_CODE (OP) == REG				\
-    && REGNO (OP) >= FIRST_PSEUDO_REGISTER		\
-    && reg_renumber [REGNO (OP)] < 0))
-
-/* Optional extra constraints for this machine. Borrowed from sparc.h.
+   Optional extra constraints for this machine. Borrowed from sparc.h.
 
    For the HPPA, `Q' means that this is a memory operand but not a
-   symbolic memory operand.  Note that an unassigned pseudo register
-   is such a memory operand.  Needed because reload will generate
-   these things in insns and then not re-recognize the insns, causing
-   constrain_operands to fail.
+   symbolic memory operand.
 
    `R' is used for scaled indexed addresses.
 
@@ -1156,22 +1144,19 @@
    `T' is for fp loads and stores.  */
 #define EXTRA_CONSTRAINT(OP, C)				\
   ((C) == 'Q' ?						\
-   (IS_RELOADING_PSEUDO_P (OP)				\
-    || (GET_CODE (OP) == MEM				\
-	&& (memory_address_p (GET_MODE (OP), XEXP (OP, 0))\
-	    || reload_in_progress)			\
-	&& ! symbolic_memory_operand (OP, VOIDmode)	\
-        && !(GET_CODE (XEXP (OP, 0)) == PLUS		\
-	     && (GET_CODE (XEXP (XEXP (OP, 0), 0)) == MULT\
-		 || GET_CODE (XEXP (XEXP (OP, 0), 1)) == MULT))))\
+   (GET_CODE (OP) == MEM				\
+    && memory_address_p (GET_MODE (OP), XEXP (OP, 0))	\
+    && ! symbolic_memory_operand (OP, VOIDmode)		\
+    && !(GET_CODE (XEXP (OP, 0)) == PLUS		\
+    && (GET_CODE (XEXP (XEXP (OP, 0), 0)) == MULT	\
+	|| GET_CODE (XEXP (XEXP (OP, 0), 1)) == MULT)))	\
    : ((C) == 'R' ?					\
      (GET_CODE (OP) == MEM				\
       && GET_CODE (XEXP (OP, 0)) == PLUS		\
       && (GET_CODE (XEXP (XEXP (OP, 0), 0)) == MULT	\
 	  || GET_CODE (XEXP (XEXP (OP, 0), 1)) == MULT)	\
       && (move_operand (OP, GET_MODE (OP))		\
-	  || memory_address_p (GET_MODE (OP), XEXP (OP, 0))\
-	  || reload_in_progress))			\
+	  || memory_address_p (GET_MODE (OP), XEXP (OP, 0))))\
    : ((C) == 'T' ? 					\
       (GET_CODE (OP) == MEM				\
        /* Using DFmode forces only short displacements	\



More information about the Gcc-patches mailing list