This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

mips patch to use delegitimize_address & FIND_BASE_TERM


This patch changes ASM_SIMPLIFY_DWARF_ADDR to TARGET_DELEGITIMIZE_ADDRESS.
It also defines FIND_BASE_TERM, which uses the same function.

Tested in the same way as the previous patch.  OK to install?

Richard


	* 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.

Index: config/mips/mips-protos.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/mips-protos.h,v
retrieving revision 1.35
diff -c -d -p -F^[(a-zA-Z0-9_^#] -r1.35 mips-protos.h
*** config/mips/mips-protos.h	1 May 2003 02:33:12 -0000	1.35
--- config/mips/mips-protos.h	3 May 2003 07:45:48 -0000
*************** extern bool		mips_legitimize_address PAR
*** 141,147 ****
  							 enum machine_mode));
  extern bool		mips_legitimize_move PARAMS ((enum machine_mode,
  						      rtx, rtx));
! extern rtx		mips_simplify_dwarf_addr 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,
--- 141,147 ----
  							 enum machine_mode));
  extern bool		mips_legitimize_move PARAMS ((enum machine_mode,
  						      rtx, 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: config/mips/mips.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/mips.h,v
retrieving revision 1.245
diff -c -d -p -F^[(a-zA-Z0-9_^#] -r1.245 mips.h
*** config/mips/mips.h	1 May 2003 02:33:12 -0000	1.245
--- config/mips/mips.h	3 May 2003 07:45:53 -0000
*************** #define EH_RETURN_STACKADJ_RTX  gen_rtx_
*** 1348,1354 ****
     SFmode register saves.  */
  #define DWARF_CIE_DATA_ALIGNMENT 4
  
! #define ASM_SIMPLIFY_DWARF_ADDR mips_simplify_dwarf_addr
  
  /* Overrides for the COFF debug format.  */
  #define PUT_SDB_SCL(a)					\
--- 1348,1354 ----
     SFmode register saves.  */
  #define DWARF_CIE_DATA_ALIGNMENT 4
  
! #define FIND_BASE_TERM(X) mips_delegitimize_address (X)
  
  /* Overrides for the COFF debug format.  */
  #define PUT_SDB_SCL(a)					\
Index: config/mips/mips.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/mips.c,v
retrieving revision 1.257
diff -c -d -p -F^[(a-zA-Z0-9_^#] -r1.257 mips.c
*** config/mips/mips.c	1 May 2003 02:33:12 -0000	1.257
--- config/mips/mips.c	3 May 2003 07:45:51 -0000
*************** #undef TARGET_RTX_COSTS
*** 850,855 ****
--- 881,888 ----
  #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
*************** mips_legitimize_move (mode, dest, src)
*** 2017,2039 ****
  }
  
  
! /* 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.  */
  
  rtx
! mips_simplify_dwarf_addr (x)
       rtx x;
  {
    struct mips_constant_info c;
--- 2191,2201 ----
  }
  
  
! /* Convert GOT and GP-relative accesses back into their original form.
!    Used by bothh TARGET_DELEGITIMIZE_ADDRESS and FIND_BASE_TERM.  */
  
  rtx
! mips_delegitimize_address (x)
       rtx x;
  {
    struct mips_constant_info c;
*************** mips_simplify_dwarf_addr (x)
*** 2043,2048 ****
--- 2205,2218 ----
        && 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;
  }
  


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]