mips-protos.h (mips_simplify_dwarf_addr): Remove.
authorRichard Sandiford <rsandifo@redhat.com>
Tue, 6 May 2003 07:06:11 +0000 (07:06 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Tue, 6 May 2003 07:06:11 +0000 (07:06 +0000)
* config/mips/mips-protos.h (mips_simplify_dwarf_addr): Remove.
(mips_delegitimize_address): Declare.
* config/mips/mips.h (ASM_SIMPLIFY_DWARF_ADDR): Undefine.
(FIND_BASE_TERM): Define.
* config/mips/mips.c (TARGET_DELEGITIMIZE_ADDRESS): Define.
(mips_delegitimize_address): Renamed from mips_simplify_dwarf_addr.
Handle small-data addresses.

From-SVN: r66518

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

index ae2db06..6af2924 100644 (file)
@@ -1,3 +1,13 @@
+2003-05-06  Richard Sandiford  <rsandifo@redhat.com>
+
+       * config/mips/mips-protos.h (mips_simplify_dwarf_addr): Remove.
+       (mips_delegitimize_address): Declare.
+       * config/mips/mips.h (ASM_SIMPLIFY_DWARF_ADDR): Undefine.
+       (FIND_BASE_TERM): Define.
+       * config/mips/mips.c (TARGET_DELEGITIMIZE_ADDRESS): Define.
+       (mips_delegitimize_address): Renamed from mips_simplify_dwarf_addr.
+       Handle small-data addresses.
+
 2003-05-05  Roger Sayle  <roger@eyesopen.com>
 
        * real.c (real_powi): New function to calculate the value of
index eb6b5e6..140e60b 100644 (file)
@@ -141,7 +141,7 @@ extern bool         mips_legitimize_address PARAMS ((rtx *,
                                                         enum machine_mode));
 extern bool            mips_legitimize_move PARAMS ((enum machine_mode,
                                                      rtx, rtx));
-extern rtx             mips_simplify_dwarf_addr PARAMS ((rtx));
+extern rtx             mips_delegitimize_address PARAMS ((rtx));
 extern void            mips_expand_call PARAMS ((rtx, rtx, rtx, rtx, int));
 extern int              mips_reg_mode_ok_for_base_p PARAMS ((rtx,
                                                             enum machine_mode,
index 45802fb..754a69d 100644 (file)
@@ -881,6 +881,8 @@ const struct mips_cpu_info mips_cpu_info_table[] = {
 #define TARGET_RTX_COSTS mips_rtx_costs
 #undef TARGET_ADDRESS_COST
 #define TARGET_ADDRESS_COST mips_address_cost
+#undef TARGET_DELEGITIMIZE_ADDRESS
+#define TARGET_DELEGITIMIZE_ADDRESS mips_delegitimize_address
 
 #undef TARGET_ENCODE_SECTION_INFO
 #define TARGET_ENCODE_SECTION_INFO mips_encode_section_info
@@ -2193,23 +2195,11 @@ mips_legitimize_move (mode, dest, src)
 }
 
 
-/* Simplify an address for dwarf debugging info.  The main purpose of
-   this function is to convert GOT references back into symbolic form.
-
-   For example, suppose a pseudo register R is found to be equivalent
-   to a GOT reference.  This reference would be stored in reg_equiv_mem[R].
-   The dwarf code may try to use this reference as the location of the
-   variable associated with R.  Normally, an address like:
-
-        (plus $gp (unspec [FOO] RELOC))
-
-   would be converted into individual components, but we can't emit
-   (unspec [FOO] RELOC) in .word directives.  We avoid this problem
-   (and generate better debug information) by converting the reference
-   back into its original form.  */
+/* Convert GOT and GP-relative accesses back into their original form.
+   Used by bothh TARGET_DELEGITIMIZE_ADDRESS and FIND_BASE_TERM.  */
 
 rtx
-mips_simplify_dwarf_addr (x)
+mips_delegitimize_address (x)
      rtx x;
 {
   struct mips_constant_info c;
@@ -2219,6 +2209,14 @@ mips_simplify_dwarf_addr (x)
       && mips_classify_constant (&c, XEXP (XEXP (x, 0), 1)) == CONSTANT_RELOC
       && mips_classify_symbol (XVECEXP (c.symbol, 0, 0)) == SYMBOL_GOT_GLOBAL)
     return XVECEXP (c.symbol, 0, 0);
+
+  if (GET_CODE (x) == PLUS
+      && (XEXP (x, 0) == pic_offset_table_rtx
+         || XEXP (x, 0) == cfun->machine->mips16_gp_pseudo_rtx)
+      && mips_classify_constant (&c, XEXP (x, 1)) == CONSTANT_RELOC
+      && mips_classify_symbol (XVECEXP (c.symbol, 0, 0)) == SYMBOL_SMALL_DATA)
+    return plus_constant (XVECEXP (c.symbol, 0, 0), c.offset);
+
   return x;
 }
 \f
index 5477b20..c645f10 100644 (file)
@@ -1348,7 +1348,7 @@ extern int mips_abi;
    SFmode register saves.  */
 #define DWARF_CIE_DATA_ALIGNMENT 4
 
-#define ASM_SIMPLIFY_DWARF_ADDR mips_simplify_dwarf_addr
+#define FIND_BASE_TERM(X) mips_delegitimize_address (X)
 
 /* Overrides for the COFF debug format.  */
 #define PUT_SDB_SCL(a)                                 \