Supprt LABEL_REFs when using -fpic.
authorMichael Meissner <meissner@gcc.gnu.org>
Wed, 5 Oct 1994 18:37:55 +0000 (18:37 +0000)
committerMichael Meissner <meissner@gcc.gnu.org>
Wed, 5 Oct 1994 18:37:55 +0000 (18:37 +0000)
From-SVN: r8222

gcc/config/i386/i386.c
gcc/config/i386/i386.md

index 3d5db62bc2950a4e1da8ff7a2d497f9aaeeb6af3..7a7c607aeb9b82726c03e8f0833579155718eea6 100644 (file)
@@ -1572,7 +1572,8 @@ legitimize_pic_address (orig, reg)
          if (reg == 0)
            reg = gen_reg_rtx (Pmode);
 
-         if (GET_CODE (addr) == SYMBOL_REF && SYMBOL_REF_FLAG (addr))
+         if ((GET_CODE (addr) == SYMBOL_REF && SYMBOL_REF_FLAG (addr))
+             || GET_CODE (addr) == LABEL_REF)
            new = gen_rtx (PLUS, Pmode, pic_offset_table_rtx, orig);
          else
            new = gen_rtx (MEM, Pmode,
@@ -1854,7 +1855,9 @@ output_pic_addr_const (file, x, code)
        fprintf (file, "@GOTOFF(%%ebx)");
       else if (code == 'P')
        fprintf (file, "@PLT");
-      else if (GET_CODE (x) == LABEL_REF || ! SYMBOL_REF_FLAG (x))
+      else if (GET_CODE (x) == LABEL_REF)
+       fprintf (file, "@GOTOFF");
+      else if (! SYMBOL_REF_FLAG (x))
        fprintf (file, "@GOT");
       else
        fprintf (file, "@GOTOFF");
@@ -2176,15 +2179,14 @@ print_operand_address (file, addr)
 
          if (addr != 0)
            {
-             if (GET_CODE (addr) == LABEL_REF)
+             if (flag_pic)
+               output_pic_addr_const (file, addr, 0);
+
+             else if (GET_CODE (addr) == LABEL_REF)
                output_asm_label (addr);
+
              else
-               {
-                 if (flag_pic)
-                   output_pic_addr_const (file, addr, 0);
-                 else
-                   output_addr_const (file, addr);
-               }
+               output_addr_const (file, addr);
            }
 
          if (ireg != 0 && GET_CODE (ireg) == MULT)
index ae67a597eb260f0667c0c0c1976555b5f22a9a88..18d56f66a0331211272360f80a3f6a81cc4479c9 100644 (file)
     /* Fastest way to change a 0 to a 1.  */
     return AS1 (inc%L0,%0);
 
-  if (flag_pic
-      && GET_CODE (operands[1]) == SYMBOL_REF
-      && CONSTANT_POOL_ADDRESS_P (operands[1]))
+  if (flag_pic && SYMBOLIC_CONST (operands[1]))
     return AS2 (lea%L0,%a1,%0);
 
   return AS2 (mov%L0,%1,%0);
 
 ;; addsi3 is faster, so put this after.
 
-(define_insn ""
+(define_insn "movsi_lea"
   [(set (match_operand:SI 0 "register_operand" "=r")
         (match_operand:QI 1 "address_operand" "p"))]
   ""