Fix shared library in i386; correctly spell macro in mips.h.
authorMichael Meissner <meissner@gcc.gnu.org>
Thu, 8 Oct 1992 20:07:04 +0000 (20:07 +0000)
committerMichael Meissner <meissner@gcc.gnu.org>
Thu, 8 Oct 1992 20:07:04 +0000 (20:07 +0000)
From-SVN: r2373

gcc/config/i386/i386.md
gcc/config/i386/osfrose.h
gcc/config/mips/mips.h

index 6bdc9711b2c33458f4c75331fc992ac1eec974bf..dfd8fa6518c5be6b9761a49c26a724708c5c4eda 100644 (file)
 
   if (flag_pic && SYMBOLIC_CONST (operands[1]))
     emit_pic_move (operands, SImode);
-  else if (HALF_PIC_P()
-          && GET_CODE (operands[0]) == REG
-           && GET_CODE (operands[1]) == SYMBOL_REF
-           && HALF_PIC_ADDRESS_P (operands[1]))
-    {
-      rtx ptr = HALF_PIC_PTR (operands[1]);
-      if (XSTR (ptr, 0) != XSTR (operands[1], 0))
-       {
-         emit_move_insn (operands[0], gen_rtx (MEM, Pmode, ptr));
-         DONE;
-       }
-    }
 }")
 
 ;; On i486, incl reg is faster than movl $1,reg.
   ""
   "
 {
+  rtx addr;
+
   if (flag_pic)
     current_function_uses_pic_offset_table = 1;
+
+  /* With half-pic, force the address into a register.  */
+  addr = XEXP (operands[0], 0);
+  if (GET_CODE (addr) != REG && HALF_PIC_P () && !CONSTANT_ADDRESS_P (addr))
+    XEXP (operands[0], 0) = force_reg (Pmode, addr);
 }")
 
 (define_insn ""
         (match_operand:SI 1 "general_operand" "g"))
    (set (reg:SI 7) (plus:SI (reg:SI 7)
                            (match_operand:SI 3 "immediate_operand" "i")))]
-  ""
+  "!HALF_PIC_P ()"
   "call %P0")
 
 (define_expand "call"
   ""
   "
 {
+  rtx addr;
+
   if (flag_pic)
     current_function_uses_pic_offset_table = 1;
+
+  /* With half-pic, force the address into a register.  */
+  addr = XEXP (operands[0], 0);
+  if (GET_CODE (addr) != REG && HALF_PIC_P () && !CONSTANT_ADDRESS_P (addr))
+    XEXP (operands[0], 0) = force_reg (Pmode, addr);
 }")
 
 (define_insn ""
   [(call (mem:QI (match_operand:SI 0 "symbolic_operand" ""))
         (match_operand:SI 1 "general_operand" "g"))]
   ;; Operand 1 not used on the i386.
-  ""
+  "!HALF_PIC_P ()"
   "call %P0")
 
 ;; Call subroutine, returning value in operand 0
   ""
   "
 {
+  rtx addr;
+
   if (flag_pic)
     current_function_uses_pic_offset_table = 1;
+
+  /* With half-pic, force the address into a register.  */
+  addr = XEXP (operands[1], 0);
+  if (GET_CODE (addr) != REG && HALF_PIC_P () && !CONSTANT_ADDRESS_P (addr))
+    XEXP (operands[1], 0) = force_reg (Pmode, addr);
 }")
 
 (define_insn ""
              (match_operand:SI 2 "general_operand" "g")))
    (set (reg:SI 7) (plus:SI (reg:SI 7)
                            (match_operand:SI 4 "immediate_operand" "i")))]
-  ""
+  "!HALF_PIC_P ()"
   "call %P1")
 
 (define_expand "call_value"
   ""
   "
 {
+  rtx addr;
+
   if (flag_pic)
     current_function_uses_pic_offset_table = 1;
+
+  /* With half-pic, force the address into a register.  */
+  addr = XEXP (operands[1], 0);
+  if (GET_CODE (addr) != REG && HALF_PIC_P () && !CONSTANT_ADDRESS_P (addr))
+    XEXP (operands[1], 0) = force_reg (Pmode, addr);
 }")
 
 (define_insn ""
        (call (mem:QI (match_operand:SI 1 "symbolic_operand" ""))
              (match_operand:SI 2 "general_operand" "g")))]
   ;; Operand 2 not used on the i386.
-  ""
+  "!HALF_PIC_P ()"
   "call %P1")
 
 ;; Insn emitted into the body of a function to return from a function.
index 6896ba2b1d21a097e9dbf76f4bd79d49465bd5ed..f1dbc7f67c4643920f74b4abe598e3029cd342d3 100644 (file)
@@ -37,9 +37,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #define TARGET_DEBUG   (target_flags & MASK_HALF_PIC_DEBUG)
 #define HALF_PIC_DEBUG TARGET_DEBUG
 
-#ifdef SUBTARGET_SWITCHES
-#undef SUBTARGET_SWITCHES
-#endif
+#undef SUBTARGET_SWITCHES
 #define SUBTARGET_SWITCHES \
      { "half-pic",      MASK_HALF_PIC},                                \
      { "no-half-pic",  -MASK_HALF_PIC},                                \
@@ -56,14 +54,10 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #define IDENTIFIER_SUFFIX ""
 
 /* Change default predefines.  */
-#ifdef CPP_PREDEFINES
-#undef CPP_PREDEFINES
-#endif
+#undef CPP_PREDEFINES
 #define CPP_PREDEFINES "-DOSF -DOSF1 -Dunix -Di386"
 
-#ifdef  CPP_SPEC
 #undef  CPP_SPEC
-#endif
 #define CPP_SPEC "\
 %{.S:  -D__LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY}} \
 %{.cc: -D__LANGUAGE_C_PLUS_PLUS} \
@@ -72,11 +66,8 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 %{.m:  -D__LANGUAGE_OBJECTIVE_C} \
 %{!.S: -D__LANGUAGE_C %{!ansi:-DLANGUAGE_C}}"
 
-#ifdef  CC1_SPEC
-#undef  CC1_SPEC
-#endif
-
 /* Turn on -mpic-extern by default.  */
+#undef  CC1_SPEC
 #define CC1_SPEC "\
 %{gline:%{!g:%{!g0:%{!g1:%{!g2: -g1}}}}} \
 %{pic-none:   -mno-half-pic} \
@@ -85,32 +76,21 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 %{pic-calls:  -mhalf-pic} \
 %{!pic-*:     -mhalf-pic}"
 
-#ifdef ASM_SPEC
-#undef ASM_SPEC
-#endif
+#undef ASM_SPEC
 #define ASM_SPEC       ""
 
-#ifdef  LINK_SPEC
 #undef  LINK_SPEC
-#endif
 #define LINK_SPEC      "%{v*: -v}                           \
                       %{!noshrlib: %{pic-none: -noshrlib} %{!pic-none: -warn_nopic}} \
                       %{nostdlib} %{noshrlib} %{glue}"
 
-#ifdef  LIB_SPEC
 #undef  LIB_SPEC
-#endif
-
 #define LIB_SPEC "-lc"
 
-#ifdef  LIBG_SPEC
 #undef  LIBG_SPEC
-#endif
-#define LIBG_SPEC      ""
+#define LIBG_SPEC ""
 
-#ifdef  STARTFILE_SPEC
 #undef  STARTFILE_SPEC
-#endif
 #define STARTFILE_SPEC "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}"
 
 #undef TARGET_VERSION_INTERNAL
@@ -121,14 +101,10 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #define TARGET_VERSION_INTERNAL(STREAM) fputs (I386_VERSION, STREAM)
 #define TARGET_VERSION TARGET_VERSION_INTERNAL (stderr)
 
-#ifdef  MD_EXEC_PREFIX
 #undef  MD_EXEC_PREFIX
-#endif
 #define MD_EXEC_PREFIX         "/usr/ccs/gcc/"
 
-#ifdef  MD_STARTFILE_PREFIX
 #undef  MD_STARTFILE_PREFIX
-#endif
 #define MD_STARTFILE_PREFIX    "/usr/ccs/lib/"
 
 /* Tell final.c we don't need a label passed to mcount.  */
@@ -165,18 +141,26 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
    `high' expressions and `const' arithmetic expressions, in
    addition to `const_int' and `const_double' expressions.  */
 
-#ifdef CONSTANT_ADDRESS_P
-#undef CONSTANT_ADDRESS_P
-#endif
+#undef CONSTANT_ADDRESS_P
 #define CONSTANT_ADDRESS_P(X)                                           \
   (CONSTANT_P (X) && (!HALF_PIC_P () || !HALF_PIC_ADDRESS_P (X)))
 
+/* Nonzero if the constant value X is a legitimate general operand.
+   It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE.  */
+
+#undef LEGITIMATE_CONSTANT_P
+#define LEGITIMATE_CONSTANT_P(X)                                       \
+  (!HALF_PIC_P ()                                                      \
+   || GET_CODE (X) == CONST_DOUBLE                                     \
+   || GET_CODE (X) == CONST_INT                                                \
+   || !HALF_PIC_ADDRESS_P (X))
+
 /* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
    that is a valid memory address for an instruction.
    The MODE argument is the machine mode for the MEM expression
    that wants to use this address. */
 
-#undef GO_IF_LEGITIMATE_ADDRESS
+#undef GO_IF_LEGITIMATE_ADDRESS
 #define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR)                                \
 {                                                                      \
   if (CONSTANT_P (X))                                                  \
@@ -240,9 +224,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
    the definition of `GO_IF_LEGITIMATE_ADDRESS' or
    `PRINT_OPERAND_ADDRESS'. */
 
-#ifdef ENCODE_SECTION_INFO
-#undef ENCODE_SECTION_INFO
-#endif
+#undef ENCODE_SECTION_INFO
 #define ENCODE_SECTION_INFO(DECL)                                      \
 do                                                                     \
   {                                                                    \
@@ -252,6 +234,39 @@ do                                                                 \
 while (0)
 
 
+/* Given a decl node or constant node, choose the section to output it in
+   and select that section.  */
+
+#undef SELECT_RTX_SECTION
+#define SELECT_RTX_SECTION(MODE, RTX)                                  \
+do                                                                     \
+  {                                                                    \
+    if (MODE == Pmode && HALF_PIC_P () && HALF_PIC_ADDRESS_P (RTX))    \
+      data_section ();                                                 \
+    else                                                               \
+      readonly_data_section ();                                                \
+  }                                                                    \
+while (0)
+
+#undef SELECT_SECTION
+#define SELECT_SECTION(DECL,RELOC)                                     \
+{                                                                      \
+  if (TREE_CODE (DECL) == STRING_CST)                                  \
+    {                                                                  \
+      if (flag_writable_strings)                                       \
+       data_section ();                                                \
+      else                                                             \
+       readonly_data_section ();                                       \
+    }                                                                  \
+  else if (TREE_CODE (DECL) != VAR_DECL)                               \
+    readonly_data_section ();                                          \
+  else if (!TREE_READONLY (DECL))                                      \
+    data_section ();                                                   \
+  else                                                                 \
+    readonly_data_section ();                                          \
+}
+
+
 /* A C statement (sans semicolon) to output to the stdio stream
    STREAM any text necessary for declaring the name NAME of an
    initialized variable which is being defined.  This macro must
@@ -262,9 +277,7 @@ while (0)
    If this macro is not defined, then the variable name is defined
    in the usual manner as a label (by means of `ASM_OUTPUT_LABEL').  */
 
-#ifdef ASM_DECLARE_OBJECT_NAME
-#undef ASM_DECLARE_OBJECT_NAME
-#endif
+#undef ASM_DECLARE_OBJECT_NAME
 #define ASM_DECLARE_OBJECT_NAME(STREAM, NAME, DECL)                    \
 do                                                                     \
  {                                                                     \
@@ -314,28 +327,46 @@ while (0)
 
 /* This is how to output an assembler line defining a `double' constant.  */
 
-#ifdef ASM_OUTPUT_DOUBLE
-#undef ASM_OUTPUT_DOUBLE
+#undef ASM_OUTPUT_DOUBLE
+
+#ifndef        CROSS_COMPILE
+#define        ASM_OUTPUT_DOUBLE(STREAM, VALUE)                                \
+do                                                                     \
+  {                                                                    \
+    long value_long[2];                                                        \
+    REAL_VALUE_TO_TARGET_DOUBLE (VALUE, value_long);                   \
+                                                                       \
+    fprintf (STREAM, "\t.long\t0x%08lx\t\t# %.20g\n\t.long\t0x%08lx\n",        \
+          value_long[0], VALUE, value_long[1]);                        \
+  }                                                                    \
+while (0)
+
+#else
+#define        ASM_OUTPUT_DOUBLE(STREAM, VALUE)                                \
+  fprintf (STREAM, "\t.double\t%.20g\n", VALUE)
 #endif
-#define ASM_OUTPUT_DOUBLE(STREAM,VALUE)                                        \
-{                                                                      \
-  union { double d; long l[2]; } u2;                                   \
-  u2.d = VALUE;                                                                \
-  fprintf (STREAM, "\t.long\t0x%08lx\t\t# %.20g\n\t.long\t0x%08lx\n",  \
-          u2.l[0], u2.d, u2.l[1]);                                     \
-}
 
 /* This is how to output an assembler line defining a `float' constant.  */
 
-#ifdef ASM_OUTPUT_FLOAT
-#undef ASM_OUTPUT_FLOAT
+#undef ASM_OUTPUT_FLOAT
+
+#ifndef        CROSS_COMPILE
+#define        ASM_OUTPUT_FLOAT(STREAM, VALUE)                                 \
+do                                                                     \
+  {                                                                    \
+    long value_long;                                                   \
+    REAL_VALUE_TO_TARGET_SINGLE (VALUE, value_long);                   \
+                                                                       \
+    fprintf (STREAM, "\t.long\t0x%08lx\t\t# %.12g (float)\n",          \
+          value_long, VALUE);                                          \
+  }                                                                    \
+while (0)
+
+#else
+#define        ASM_OUTPUT_FLOAT(STREAM, VALUE)                                 \
+  fprintf (STREAM, "\t.float\t%.12g\n", VALUE)
 #endif
-#define ASM_OUTPUT_FLOAT(STREAM,VALUE)                                 \
-{                                                                      \
-  union { float f; long l; } u2;                                       \
-  u2.f = VALUE;                                                                \
-  fprintf (STREAM, "\t.long\t0x%08lx\t\t# %.12g\n", u2.l, u2.f);       \
-}
+
 
 /* Generate calls to memcpy, etc., not bcopy, etc. */
 #define TARGET_MEM_FUNCTIONS
@@ -344,6 +375,10 @@ while (0)
 \f
 /* Defines to be able to build libgcc.a with GCC.  */
 
+/* It might seem that these are not important, since gcc 2 will never
+   call libgcc for these functions.  But programs might be linked with
+   code compiled by gcc 1, and then these will be used.  */
+
 #define perform_udivsi3(a,b)                                           \
 {                                                                      \
   register int dx asm("dx");                                           \
@@ -391,15 +426,18 @@ while (0)
   auto unsigned short ostatus;                                         \
   auto unsigned short nstatus;                                         \
   auto int ret;                                                                \
+  auto double tmp;                                                     \
                                                                        \
   &ostatus;                    /* guarantee these land in memory */    \
   &nstatus;                                                            \
   &ret;                                                                        \
+  &tmp;                                                                        \
                                                                        \
   asm volatile ("fnstcw %0" : "=m" (ostatus));                         \
   nstatus = ostatus | 0x0c00;                                          \
   asm volatile ("fldcw %0" : /* no outputs */ : "m" (nstatus));                \
-  asm volatile ("fldl %0" : /* no outputs */ : "m" (a));               \
+  tmp = a;                                                             \
+  asm volatile ("fldl %0" : /* no outputs */ : "m" (tmp));             \
   asm volatile ("fistpl %0" : "=m" (ret));                             \
   asm volatile ("fldcw %0" : /* no outputs */ : "m" (ostatus));                \
                                                                        \
index f68d6a67956a15e306d20b61e249d4e908eecc52..7d3f1065e82e03e6a91e798ffc787a05292bf01b 100644 (file)
@@ -3341,7 +3341,7 @@ rdata_section ()                                                  \
 /* Given a decl node or constant node, choose the section to output it in
    and select that section.  */
 
-#define SELECT_SECTION_MODE(MODE,RTX)                                  \
+#define SELECT_RTX_SECTION(MODE,RTX)                                   \
 {                                                                      \
   if ((GET_MODE_SIZE(MODE) / BITS_PER_UNIT) <= mips_section_threshold  \
       && mips_section_threshold > 0)                                   \