expr.c (force_operand): Detect PIC address loads before splitting arithmetic.
authorRichard Henderson <rth@cygnus.com>
Mon, 8 Jun 1998 10:44:01 +0000 (03:44 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Mon, 8 Jun 1998 10:44:01 +0000 (03:44 -0700)
* expr.c (force_operand): Detect PIC address loads before
splitting arithmetic.

From-SVN: r20331

gcc/ChangeLog
gcc/expr.c

index 5ecea6e..ff1a1e4 100644 (file)
@@ -1,12 +1,9 @@
-Mon Jun 8 09:22:38 PDT 1998 Jeff Law  (law@cygnus.com)
-
-       * version.c: Bump for snapshot.
+Mon Jun  8 10:43:15 1998  Richard Henderson  <rth@cygnus.com>
 
-Mon Jun 8 09:17:09 PDT 1998 Jeff Law  (law@cygnus.com)
+       * expr.c (force_operand): Detect PIC address loads before 
+       splitting arithmetic.
 
-       * version.c: Bump for snapshot.
-
-Mon Jun 8 02:09:47 PDT 1998 Jeff Law  (law@cygnus.com)
+Mon Jun 8 09:22:38 PDT 1998 Jeff Law  (law@cygnus.com)
 
        * version.c: Bump for snapshot.
 
index dc5e5eb..058d121 100644 (file)
@@ -4525,6 +4525,20 @@ force_operand (value, target)
   /* Use subtarget as the target for operand 0 of a binary operation.  */
   register rtx subtarget = (target != 0 && GET_CODE (target) == REG ? target : 0);
 
+  /* Check for a PIC address load.  */
+  if (flag_pic
+      && (GET_CODE (value) == PLUS || GET_CODE (value) == MINUS)
+      && XEXP (value, 0) == pic_offset_table_rtx
+      && (GET_CODE (XEXP (value, 1)) == SYMBOL_REF
+         || GET_CODE (XEXP (value, 1)) == LABEL_REF
+         || GET_CODE (XEXP (value, 1)) == CONST))
+    {
+      if (!subtarget)
+       subtarget = gen_reg_rtx (GET_MODE (value));
+      emit_move_insn (subtarget, value);
+      return subtarget;
+    }
+
   if (GET_CODE (value) == PLUS)
     binoptab = add_optab;
   else if (GET_CODE (value) == MINUS)