]> gcc.gnu.org Git - gcc.git/commitdiff
mips-protos.h (SYMBOL_FORCE_TO_MEM): New symbol type.
authorRichard Sandiford <richard@codesourcery.com>
Wed, 8 Aug 2007 15:26:03 +0000 (15:26 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Wed, 8 Aug 2007 15:26:03 +0000 (15:26 +0000)
gcc/
* config/mips/mips-protos.h (SYMBOL_FORCE_TO_MEM): New symbol type.
* config/mips/mips.c (mips_classify_symbol): Skip TARGET_ABICALLS
block for locally-binding symbols if TARGET_ABSOLUTE_ABICALLS.
Return SYMBOL_FORCE_TO_MEM instead of SYMBOL_ABSOLUTE for
non-call contexts if TARGET_MIPS16.
(mips_symbolic_constant_p): Handle SYMBOL_FORCE_TO_MEM.
(mips_symbolic_address_p): Likewise.  Remove special TARGET_MIPS16
code for SYMBOL_ABSOLUTE.
(mips_symbol_insns): Likewise.

From-SVN: r127296

gcc/ChangeLog
gcc/config/mips/mips-protos.h
gcc/config/mips/mips.c

index c5ad71601cb7ce0f464c92082198ff25e19d1804..ee858f46d8dd1db7ebe115487683492bba1d4e2f 100644 (file)
@@ -1,3 +1,15 @@
+2007-08-08  Richard Sandiford  <richard@codesourcery.com>
+
+       * config/mips/mips-protos.h (SYMBOL_FORCE_TO_MEM): New symbol type.
+       * config/mips/mips.c (mips_classify_symbol): Skip TARGET_ABICALLS
+       block for locally-binding symbols if TARGET_ABSOLUTE_ABICALLS.
+       Return SYMBOL_FORCE_TO_MEM instead of SYMBOL_ABSOLUTE for
+       non-call contexts if TARGET_MIPS16.
+       (mips_symbolic_constant_p): Handle SYMBOL_FORCE_TO_MEM.
+       (mips_symbolic_address_p): Likewise.  Remove special TARGET_MIPS16
+       code for SYMBOL_ABSOLUTE.
+       (mips_symbol_insns): Likewise.
+
 2007-08-08  Richard Sandiford  <richard@codesourcery.com>
 
        * config/mips/mips-protos.h (mips_symbol_context): New enumeration.
index f88c7c9ecd6e2964511e7558f1a708d4a40a8a03..13cbfbfc34114a9648b0590928242e8a190829c3 100644 (file)
@@ -55,6 +55,9 @@ enum mips_symbol_context {
        The symbol's value will be calculated using a MIPS16 PC-relative
        calculation.
 
+   SYMBOL_FORCE_TO_MEM
+       The symbol's value must be forced to memory and loaded from there.
+
    SYMBOL_GOT_PAGE_OFST
        The symbol's value will be calculated by loading an address
        from the GOT and then applying a 16-bit offset.
@@ -109,6 +112,7 @@ enum mips_symbol_type {
   SYMBOL_ABSOLUTE,
   SYMBOL_GP_RELATIVE,
   SYMBOL_PC_RELATIVE,
+  SYMBOL_FORCE_TO_MEM,
   SYMBOL_GOT_PAGE_OFST,
   SYMBOL_GOT_DISP,
   SYMBOL_GOTOFF_PAGE,
index 416f19ac9f4d64fb006cdc8c924b0344fab5fc0a..75873d7c311406b94a48f0cfe493001f54720f72 100644 (file)
@@ -1438,7 +1438,7 @@ mips_symbol_binds_local_p (rtx x)
    LABEL_REF X in context CONTEXT.  */
 
 static enum mips_symbol_type
-mips_classify_symbol (rtx x, enum mips_symbol_context context ATTRIBUTE_UNUSED)
+mips_classify_symbol (rtx x, enum mips_symbol_context context)
 {
   if (TARGET_RTP_PIC)
     return SYMBOL_GOT_DISP;
@@ -1473,13 +1473,11 @@ mips_classify_symbol (rtx x, enum mips_symbol_context context ATTRIBUTE_UNUSED)
       && !SYMBOL_REF_WEAK (x))
     return SYMBOL_GP_RELATIVE;
 
-  if (TARGET_ABICALLS)
+  /* Don't use GOT accesses for locally-binding symbols when -mno-shared
+     is in effect.  */
+  if (TARGET_ABICALLS
+      && !(TARGET_ABSOLUTE_ABICALLS && mips_symbol_binds_local_p (x)))
     {
-      /* Don't use GOT accesses for locally-binding symbols; we can use
-        %hi and %lo instead.  */
-      if (TARGET_ABSOLUTE_ABICALLS && mips_symbol_binds_local_p (x))
-       return SYMBOL_ABSOLUTE;
-
       /* There are three cases to consider:
 
            - o32 PIC (either with or without explicit relocs)
@@ -1505,6 +1503,8 @@ mips_classify_symbol (rtx x, enum mips_symbol_context context ATTRIBUTE_UNUSED)
       return SYMBOL_GOT_PAGE_OFST;
     }
 
+  if (TARGET_MIPS16 && context != SYMBOL_CONTEXT_CALL)
+    return SYMBOL_FORCE_TO_MEM;
   return SYMBOL_ABSOLUTE;
 }
 
@@ -1560,6 +1560,7 @@ mips_symbolic_constant_p (rtx x, enum mips_symbol_context context,
   switch (*symbol_type)
     {
     case SYMBOL_ABSOLUTE:
+    case SYMBOL_FORCE_TO_MEM:
     case SYMBOL_64_HIGH:
     case SYMBOL_64_MID:
     case SYMBOL_64_LOW:
@@ -1682,8 +1683,6 @@ mips_symbolic_address_p (enum mips_symbol_type symbol_type,
   switch (symbol_type)
     {
     case SYMBOL_ABSOLUTE:
-      return !TARGET_MIPS16;
-
     case SYMBOL_GP_RELATIVE:
       return true;
 
@@ -1694,8 +1693,10 @@ mips_symbolic_address_p (enum mips_symbol_type symbol_type,
     case SYMBOL_GOT_PAGE_OFST:
       return true;
 
+    case SYMBOL_FORCE_TO_MEM:
     case SYMBOL_GOT_DISP:
-      /* The address will have to be loaded from the GOT first.  */
+      /* The address will have to be loaded from the constant pool
+        or GOT before it is used in an address.  */
       return false;
 
     case SYMBOL_GOTOFF_PAGE:
@@ -1841,11 +1842,6 @@ mips_symbol_insns (enum mips_symbol_type type)
   switch (type)
     {
     case SYMBOL_ABSOLUTE:
-      /* In mips16 code, general symbols must be fetched from the
-        constant pool.  */
-      if (TARGET_MIPS16)
-       return 0;
-
       /* When using 64-bit symbols, we need 5 preparatory instructions,
         such as:
 
@@ -1868,6 +1864,10 @@ mips_symbol_insns (enum mips_symbol_type type)
         extended instruction.  */
       return 2;
 
+    case SYMBOL_FORCE_TO_MEM:
+      /* The constant must be loaded from the constant pool.  */
+      return 0;
+
     case SYMBOL_GOT_PAGE_OFST:
     case SYMBOL_GOT_DISP:
       /* Unless -funit-at-a-time is in effect, we can't be sure whether
This page took 0.132243 seconds and 5 git commands to generate.