i386.c (tls_model_chars): Remove.
authorRichard Henderson <rth@redhat.com>
Fri, 11 Apr 2003 21:27:14 +0000 (14:27 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Fri, 11 Apr 2003 21:27:14 +0000 (14:27 -0700)
        * config/i386/i386.c (tls_model_chars): Remove.
        (ix86_encode_section_info, ix86_strip_name_encoding): Remove.
        (local_symbolic_operand): Use SYMBOL_REF_LOCAL_P.
        (tls_symbolic_operand): Use SYMBOL_REF_TLS_MODEL.
        (tls_symbolic_operand_1): Likewise.
        (legitimate_pic_address_disp_p): Use SYMBOL_REF_LOCAL_P.
        * config/i386/i386.h (TARGET_ENCODE_SECTION_INFO): Remove.
        (TARGET_STRIP_NAME_ENCODING, ASM_OUTPUT_LABELREF): Remove.
        * config/i386/winnt.c (i386_pe_encode_section_info): Replace
        bits "copied from i386.h" with default_encode_section_info.

From-SVN: r65480

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/config/i386/i386.h
gcc/config/i386/winnt.c

index 7baa961fe29080ef164a1b32d9a8caf6369be112..9e142f5b5085fd643d92733cb9697fc9f9af31e2 100644 (file)
@@ -1,3 +1,16 @@
+2003-04-11  Richard Henderson  <rth@redhat.com>
+
+       * config/i386/i386.c (tls_model_chars): Remove.
+       (ix86_encode_section_info, ix86_strip_name_encoding): Remove.
+       (local_symbolic_operand): Use SYMBOL_REF_LOCAL_P.
+       (tls_symbolic_operand): Use SYMBOL_REF_TLS_MODEL.
+       (tls_symbolic_operand_1): Likewise.
+       (legitimate_pic_address_disp_p): Use SYMBOL_REF_LOCAL_P.
+       * config/i386/i386.h (TARGET_ENCODE_SECTION_INFO): Remove.
+       (TARGET_STRIP_NAME_ENCODING, ASM_OUTPUT_LABELREF): Remove.
+       * config/i386/winnt.c (i386_pe_encode_section_info): Replace
+       bits "copied from i386.h" with default_encode_section_info.
+
 2003-04-11  Richard Henderson  <rth@redhat.com>
 
        * rtl.def (SYMBOL_REF): Add two 0 fields.
index e510d863e9b0865d21967bcc8b53f1b757969418..d01733d0edd30ec0c17f51297dd4ed43b42c568d 100644 (file)
@@ -668,10 +668,6 @@ int const svr4_dbx_register_map[FIRST_PSEUDO_REGISTER] =
 rtx ix86_compare_op0 = NULL_RTX;
 rtx ix86_compare_op1 = NULL_RTX;
 
-/* The encoding characters for the four TLS models present in ELF.  */
-
-static char const tls_model_chars[] = " GLil";
-
 #define MAX_386_STACK_LOCALS 3
 /* Size of the register save area.  */
 #define X86_64_VARARGS_SIZE (REGPARM_MAX * UNITS_PER_WORD + SSE_REGPARM_MAX * 16)
@@ -845,10 +841,6 @@ static int ix86_address_cost PARAMS ((rtx));
 static bool ix86_cannot_force_const_mem PARAMS ((rtx));
 static rtx ix86_delegitimize_address PARAMS ((rtx));
 
-static void ix86_encode_section_info PARAMS ((tree, int)) ATTRIBUTE_UNUSED;
-static const char *ix86_strip_name_encoding PARAMS ((const char *))
-     ATTRIBUTE_UNUSED;
-
 struct builtin_description;
 static rtx ix86_expand_sse_comi PARAMS ((const struct builtin_description *,
                                         tree, rtx));
@@ -3497,9 +3489,7 @@ local_symbolic_operand (op, mode)
   if (GET_CODE (op) != SYMBOL_REF)
     return 0;
 
-  /* These we've been told are local by varasm and encode_section_info
-     respectively.  */
-  if (CONSTANT_POOL_ADDRESS_P (op) || SYMBOL_REF_FLAG (op))
+  if (SYMBOL_REF_LOCAL_P (op))
     return 1;
 
   /* There is, however, a not insubstantial body of code in the rest of
@@ -3514,36 +3504,26 @@ local_symbolic_operand (op, mode)
   return 0;
 }
 
-/* Test for various thread-local symbols.  See ix86_encode_section_info. */
+/* Test for various thread-local symbols.  */
 
 int
 tls_symbolic_operand (op, mode)
      register rtx op;
      enum machine_mode mode ATTRIBUTE_UNUSED;
 {
-  const char *symbol_str;
-
   if (GET_CODE (op) != SYMBOL_REF)
     return 0;
-  symbol_str = XSTR (op, 0);
-
-  if (symbol_str[0] != '%')
-    return 0;
-  return strchr (tls_model_chars, symbol_str[1]) - tls_model_chars;
+  return SYMBOL_REF_TLS_MODEL (op);
 }
 
-static int
+static inline int
 tls_symbolic_operand_1 (op, kind)
      rtx op;
      enum tls_model kind;
 {
-  const char *symbol_str;
-
   if (GET_CODE (op) != SYMBOL_REF)
     return 0;
-  symbol_str = XSTR (op, 0);
-
-  return symbol_str[0] == '%' && symbol_str[1] == tls_model_chars[kind];
+  return SYMBOL_REF_TLS_MODEL (op) == kind;
 }
 
 int
@@ -5773,8 +5753,7 @@ legitimate_pic_address_disp_p (disp)
        return 0;
       if (GET_CODE (disp) == SYMBOL_REF
          && ix86_cmodel == CM_SMALL_PIC
-         && (CONSTANT_POOL_ADDRESS_P (disp)
-             || SYMBOL_REF_FLAG (disp)))
+         && SYMBOL_REF_LOCAL_P (disp))
        return 1;
       if (GET_CODE (disp) == LABEL_REF)
        return 1;
@@ -5782,8 +5761,7 @@ legitimate_pic_address_disp_p (disp)
          && GET_CODE (XEXP (disp, 0)) == PLUS
          && ((GET_CODE (XEXP (XEXP (disp, 0), 0)) == SYMBOL_REF
               && ix86_cmodel == CM_SMALL_PIC
-              && (CONSTANT_POOL_ADDRESS_P (XEXP (XEXP (disp, 0), 0))
-                  || SYMBOL_REF_FLAG (XEXP (XEXP (disp, 0), 0))))
+              && SYMBOL_REF_LOCAL_P (XEXP (XEXP (disp, 0), 0)))
              || GET_CODE (XEXP (XEXP (disp, 0), 0)) == LABEL_REF)
          && GET_CODE (XEXP (XEXP (disp, 0), 1)) == CONST_INT
          && INTVAL (XEXP (XEXP (disp, 0), 1)) < 16*1024*1024
@@ -6124,7 +6102,7 @@ ix86_GOT_alias_set ()
 
    2. Static data references, constant pool addresses, and code labels
       compute the address as an offset from the GOT, whose base is in
-      the PIC reg.  Static data objects have SYMBOL_REF_FLAG set to
+      the PIC reg.  Static data objects have SYMBOL_FLAG_LOCAL set to
       differentiate them from global data objects.  The returned
       address is the PIC reg + an unspec constant.
 
@@ -6282,85 +6260,6 @@ legitimize_pic_address (orig, reg)
     }
   return new;
 }
-
-static void
-ix86_encode_section_info (decl, first)
-     tree decl;
-     int first ATTRIBUTE_UNUSED;
-{
-  bool local_p = (*targetm.binds_local_p) (decl);
-  rtx rtl, symbol;
-
-  rtl = DECL_P (decl) ? DECL_RTL (decl) : TREE_CST_RTL (decl);
-  if (GET_CODE (rtl) != MEM)
-    return;
-  symbol = XEXP (rtl, 0);
-  if (GET_CODE (symbol) != SYMBOL_REF)
-    return;
-
-  /* For basic x86, if using PIC, mark a SYMBOL_REF for a non-global
-     symbol so that we may access it directly in the GOT.  */
-
-  if (flag_pic)
-    SYMBOL_REF_FLAG (symbol) = local_p;
-
-  /* For ELF, encode thread-local data with %[GLil] for "global dynamic",
-     "local dynamic", "initial exec" or "local exec" TLS models
-     respectively.  */
-
-  if (TREE_CODE (decl) == VAR_DECL && DECL_THREAD_LOCAL (decl))
-    {
-      const char *symbol_str;
-      char *newstr;
-      size_t len;
-      enum tls_model kind = decl_tls_model (decl);
-
-      if (TARGET_64BIT && ! flag_pic)
-       {
-         /* x86-64 doesn't allow non-pic code for shared libraries,
-            so don't generate GD/LD TLS models for non-pic code.  */
-         switch (kind)
-           {
-           case TLS_MODEL_GLOBAL_DYNAMIC:
-             kind = TLS_MODEL_INITIAL_EXEC; break;
-           case TLS_MODEL_LOCAL_DYNAMIC:
-             kind = TLS_MODEL_LOCAL_EXEC; break;
-           default:
-             break;
-           }
-       }
-
-      symbol_str = XSTR (symbol, 0);
-
-      if (symbol_str[0] == '%')
-       {
-         if (symbol_str[1] == tls_model_chars[kind])
-           return;
-         symbol_str += 2;
-       }
-      len = strlen (symbol_str) + 1;
-      newstr = alloca (len + 2);
-
-      newstr[0] = '%';
-      newstr[1] = tls_model_chars[kind];
-      memcpy (newstr + 2, symbol_str, len);
-
-      XSTR (symbol, 0) = ggc_alloc_string (newstr, len + 2 - 1);
-    }
-}
-
-/* Undo the above when printing symbol names.  */
-
-static const char *
-ix86_strip_name_encoding (str)
-     const char *str;
-{
-  if (str[0] == '%')
-    str += 2;
-  if (str [0] == '*')
-    str += 1;
-  return str;
-}
 \f
 /* Load the thread pointer into a register.  */
 
index d8c87d4a99a7fa192f80d4607c8f320e54471098..fed00089e745a1f521b458fc9c459e2f25515d52 100644 (file)
@@ -2496,21 +2496,6 @@ enum ix86_builtins
   IX86_BUILTIN_MAX
 };
 \f
-#define TARGET_ENCODE_SECTION_INFO  ix86_encode_section_info
-#define TARGET_STRIP_NAME_ENCODING  ix86_strip_name_encoding
-
-#define ASM_OUTPUT_LABELREF(FILE,NAME)         \
-  do {                                         \
-    const char *xname = (NAME);                        \
-    if (xname[0] == '%')                       \
-      xname += 2;                              \
-    if (xname[0] == '*')                       \
-      xname += 1;                              \
-    else                                       \
-      fputs (user_label_prefix, FILE);         \
-    fputs (xname, FILE);                       \
-  } while (0)
-\f
 /* Max number of args passed in registers.  If this is more than 3, we will
    have problems with ebx (register #4), since it is a caller save register and
    is also used as the pic register in ELF.  So for now, don't allow more than
index 566e75fbda68ddf656174303d56151173bfc0d1a..0751c7f888eaec07bcb2df2b30c207e555fcae00 100644 (file)
@@ -429,14 +429,7 @@ i386_pe_encode_section_info (decl, first)
   if (!first)
     return;
 
-  /* This bit is copied from i386.h.  */
-  if (optimize > 0 && TREE_CONSTANT (decl)
-      && (!flag_writable_strings || TREE_CODE (decl) != STRING_CST))
-    {
-      rtx rtl = (TREE_CODE_CLASS (TREE_CODE (decl)) != 'd'
-                 ? TREE_CST_RTL (decl) : DECL_RTL (decl));
-      SYMBOL_REF_FLAG (XEXP (rtl, 0)) = 1;
-    }
+  default_encode_section_info (decl, first);
 
   if (TREE_CODE (decl) == FUNCTION_DECL)
     {