This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Replace ASM_SIMPLIFY_DWARF_ADDR with delegitimize_address
- From: Roger Sayle <roger at www dot eyesopen dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 4 Feb 2003 16:02:57 -0700 (MST)
- Subject: [PATCH] Replace ASM_SIMPLIFY_DWARF_ADDR with delegitimize_address
As requested by Richard Henderson, this patch removes all references to
ASM_SIMPLIFY_DWARF_ADDR and replaces them with the new target call-back
delegitimize_address. This required changes to both the i386 and s390
backends. I also noticed that dwarf2out.c's dependency upon $(TARGET_H)
was missing from Makefile.in.
The following patch has been tested by a complete bootstrap, all languages
except Ada and treelang, on i686-pc-linux-gnu with no new regressions in
the testsuite. I'd also like to thank Ulrich Weigand for performing
both bootstraps and regression testing on both s390-ibm-linux and
s390x-ibm-linux, also without any new failures. I've also confirmed
that the cc1 of an s390-ibm-linux cross-compiler can be built from
i686-pc-linux-gnu without problems.
Ok for mainline?
2003-02-04 Roger Sayle <roger@eyesopen.com>
* dwarf2out.c (mem_loc_descriptor): Replace ASM_SIMPLIFY_DWARF_ADDR
with *targetm.delegitimize_address.
(rtl_for_decl_location): Likewise.
* dwarfout.c (output_mem_loc_descriptor): Likewise. Include target.h.
* Makefile.in (dwarf2out.c, dwarfout.c): Depend upon $(TARGET_H)
* config/i386/i386.h (ASM_SIMPLIFY_DWARF_ADDR): Remove definition.
* config/i386/i386-protos.h (i386_simplify_dwarf_addr): Remove
prototype.
* config/i386/i386.c (ix86_delegitimize_address): Renamed from
i386_simplify_dwarf_addr. Made static. Prototyped.
(TARGET_DELEGITIMIZE_ADDRESS): Update definition from
i386_simplify_dwarf_addr to ix86_delegitimize_address.
(ix86_find_base_term): Likewise.
(maybe_get_pool_constant): Likewise.
* config/s390/s390.h (ASM_SIMPLIFY_DWARF_ADDR): Remove definition.
* config/s390/s390-protos.h (s390_simplify_dwarf_addr): Remove
prototype.
* config/s390/s390.c (s390_delegitimize_address): Renamed from
s390_simplify_dwarf_addr. Made static. Prototyped.
(TARGET_DELEGITIMIZE_ADDRESS): Define as s390_delegitimize_address.
Index: dwarf2out.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/dwarf2out.c,v
retrieving revision 1.398
diff -c -3 -p -r1.398 dwarf2out.c
*** dwarf2out.c 1 Feb 2003 21:12:55 -0000 1.398
--- dwarf2out.c 4 Feb 2003 03:51:11 -0000
***************
*** 1,6 ****
/* Output Dwarf2 format symbol table information from the GNU C compiler.
! Copyright (C) 1992, 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
! Free Software Foundation, Inc.
Contributed by Gary Funck (gary@intrepid.com).
Derived from DWARF 1 implementation of Ron Guilmette (rfg@monkeys.com).
Extensively modified by Jason Merrill (jason@cygnus.com).
--- 1,6 ----
/* Output Dwarf2 format symbol table information from the GNU C compiler.
! Copyright (C) 1992, 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
! 2003 Free Software Foundation, Inc.
Contributed by Gary Funck (gary@intrepid.com).
Derived from DWARF 1 implementation of Ron Guilmette (rfg@monkeys.com).
Extensively modified by Jason Merrill (jason@cygnus.com).
*************** mem_loc_descriptor (rtl, mode)
*** 8270,8278 ****
actually within the array. That's *not* necessarily the same as the
zeroth element of the array. */
! #ifdef ASM_SIMPLIFY_DWARF_ADDR
! rtl = ASM_SIMPLIFY_DWARF_ADDR (rtl);
! #endif
switch (GET_CODE (rtl))
{
--- 8270,8276 ----
actually within the array. That's *not* necessarily the same as the
zeroth element of the array. */
! rtl = (*targetm.delegitimize_address) (rtl);
switch (GET_CODE (rtl))
{
*************** rtl_for_decl_location (decl)
*** 9370,9378 ****
|| (GET_CODE (rtl) == MEM
&& CONSTANT_P (XEXP (rtl, 0)))))
{
! #ifdef ASM_SIMPLIFY_DWARF_ADDR
! rtl = ASM_SIMPLIFY_DWARF_ADDR (rtl);
! #endif
return rtl;
}
rtl = NULL_RTX;
--- 9368,9374 ----
|| (GET_CODE (rtl) == MEM
&& CONSTANT_P (XEXP (rtl, 0)))))
{
! rtl = (*targetm.delegitimize_address) (rtl);
return rtl;
}
rtl = NULL_RTX;
*************** rtl_for_decl_location (decl)
*** 9478,9487 ****
}
}
- #ifdef ASM_SIMPLIFY_DWARF_ADDR
if (rtl)
! rtl = ASM_SIMPLIFY_DWARF_ADDR (rtl);
! #endif
/* If we don't look past the constant pool, we risk emitting a
reference to a constant pool entry that isn't referenced from
--- 9474,9481 ----
}
}
if (rtl)
! rtl = (*targetm.delegitimize_address) (rtl);
/* If we don't look past the constant pool, we risk emitting a
reference to a constant pool entry that isn't referenced from
Index: dwarfout.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/dwarfout.c,v
retrieving revision 1.119
diff -c -3 -p -r1.119 dwarfout.c
*** dwarfout.c 16 Dec 2002 18:19:23 -0000 1.119
--- dwarfout.c 4 Feb 2003 03:51:12 -0000
***************
*** 1,6 ****
/* Output Dwarf format symbol table information from the GNU C compiler.
! Copyright (C) 1992, 1993, 1995, 1996, 1997, 1998, 2002,
! 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Contributed by Ron Guilmette (rfg@monkeys.com) of Network Computing Devices.
This file is part of GCC.
--- 1,6 ----
/* Output Dwarf format symbol table information from the GNU C compiler.
! Copyright (C) 1992, 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
! 2002, 2003 Free Software Foundation, Inc.
Contributed by Ron Guilmette (rfg@monkeys.com) of Network Computing Devices.
This file is part of GCC.
*************** Software Foundation, 59 Temple Place - S
*** 581,586 ****
--- 581,587 ----
#include "toplev.h"
#include "tm_p.h"
#include "debug.h"
+ #include "target.h"
#include "langhooks.h"
/* NOTE: In the comments in this file, many references are made to
*************** output_mem_loc_descriptor (rtl)
*** 2097,2105 ****
which is actually within the array. That's *not* necessarily the
same as the zeroth element of the array. */
! #ifdef ASM_SIMPLIFY_DWARF_ADDR
! rtl = ASM_SIMPLIFY_DWARF_ADDR (rtl);
! #endif
switch (GET_CODE (rtl))
{
--- 2098,2104 ----
which is actually within the array. That's *not* necessarily the
same as the zeroth element of the array. */
! rtl = (*targetm.delegitimize_address) (rtl);
switch (GET_CODE (rtl))
{
Index: Makefile.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Makefile.in,v
retrieving revision 1.986
diff -c -3 -p -r1.986 Makefile.in
*** Makefile.in 3 Feb 2003 19:40:57 -0000 1.986
--- Makefile.in 4 Feb 2003 03:51:13 -0000
*************** sdbout.o : sdbout.c $(CONFIG_H) $(SYSTEM
*** 1497,1507 ****
sdbout.h toplev.h $(TM_P_H) except.h debug.h langhooks.h gt-sdbout.h
dwarfout.o : dwarfout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
$(RTL_H) dwarf.h flags.h insn-config.h reload.h output.h toplev.h $(TM_P_H) \
! debug.h langhooks.h
dwarf2out.o : dwarf2out.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
$(RTL_H) dwarf2.h debug.h flags.h insn-config.h reload.h output.h diagnostic.h real.h \
hard-reg-set.h $(REGS_H) $(EXPR_H) libfuncs.h toplev.h dwarf2out.h varray.h \
! $(GGC_H) except.h dwarf2asm.h $(TM_P_H) langhooks.h $(HASHTAB_H) gt-dwarf2out.h
dwarf2asm.o : dwarf2asm.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) flags.h $(RTL_H) \
$(TREE_H) output.h dwarf2asm.h $(TM_P_H) $(GGC_H) gt-dwarf2asm.h
vmsdbgout.o : vmsdbgout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
--- 1497,1508 ----
sdbout.h toplev.h $(TM_P_H) except.h debug.h langhooks.h gt-sdbout.h
dwarfout.o : dwarfout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
$(RTL_H) dwarf.h flags.h insn-config.h reload.h output.h toplev.h $(TM_P_H) \
! debug.h langhooks.h $(TARGET_H)
dwarf2out.o : dwarf2out.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
$(RTL_H) dwarf2.h debug.h flags.h insn-config.h reload.h output.h diagnostic.h real.h \
hard-reg-set.h $(REGS_H) $(EXPR_H) libfuncs.h toplev.h dwarf2out.h varray.h \
! $(GGC_H) except.h dwarf2asm.h $(TM_P_H) langhooks.h $(HASHTAB_H) \
! gt-dwarf2out.h $(TARGET_H)
dwarf2asm.o : dwarf2asm.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) flags.h $(RTL_H) \
$(TREE_H) output.h dwarf2asm.h $(TM_P_H) $(GGC_H) gt-dwarf2asm.h
vmsdbgout.o : vmsdbgout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
Index: config/i386/i386.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.h,v
retrieving revision 1.318
diff -c -3 -p -r1.318 i386.h
*** config/i386/i386.h 31 Jan 2003 23:34:15 -0000 1.318
--- config/i386/i386.h 4 Feb 2003 03:51:14 -0000
***************
*** 1,6 ****
/* Definitions of target machine for GNU compiler for IA-32.
Copyright (C) 1988, 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
! 2001, 2002 Free Software Foundation, Inc.
This file is part of GNU CC.
--- 1,6 ----
/* Definitions of target machine for GNU compiler for IA-32.
Copyright (C) 1988, 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
! 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU CC.
*************** do { \
*** 2841,2851 ****
#define ASM_OUTPUT_DWARF_ADDR_CONST(FILE, X) \
i386_dwarf_output_addr_const ((FILE), (X))
-
- /* Either simplify a location expression, or return the original. */
-
- #define ASM_SIMPLIFY_DWARF_ADDR(X) \
- i386_simplify_dwarf_addr (X)
/* Emit a dtp-relative reference to a TLS variable. */
--- 2841,2846 ----
Index: config/i386/i386-protos.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386-protos.h,v
retrieving revision 1.91
diff -c -3 -p -r1.91 i386-protos.h
*** config/i386/i386-protos.h 28 Jan 2003 18:08:50 -0000 1.91
--- config/i386/i386-protos.h 4 Feb 2003 03:51:14 -0000
***************
*** 1,6 ****
/* Definitions of target machine for GNU compiler for IA-32.
Copyright (C) 1988, 1992, 1994, 1995, 1996, 1996, 1997, 1998, 1999,
! 2000, 2001 Free Software Foundation, Inc.
This file is part of GNU CC.
--- 1,6 ----
/* Definitions of target machine for GNU compiler for IA-32.
Copyright (C) 1988, 1992, 1994, 1995, 1996, 1996, 1997, 1998, 1999,
! 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of GNU CC.
*************** extern const char *output_fp_compare PAR
*** 121,127 ****
extern void i386_dwarf_output_addr_const PARAMS ((FILE*, rtx));
extern void i386_output_dwarf_dtprel PARAMS ((FILE*, int, rtx));
- extern rtx i386_simplify_dwarf_addr PARAMS ((rtx));
extern void ix86_expand_clear PARAMS ((rtx));
extern void ix86_expand_move PARAMS ((enum machine_mode, rtx[]));
--- 121,126 ----
Index: config/i386/i386.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.c,v
retrieving revision 1.523
diff -c -3 -p -r1.523 i386.c
*** config/i386/i386.c 3 Feb 2003 19:40:58 -0000 1.523
--- config/i386/i386.c 4 Feb 2003 03:51:17 -0000
*************** struct ix86_address
*** 842,847 ****
--- 842,848 ----
static int ix86_decompose_address PARAMS ((rtx, struct ix86_address *));
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 *))
*************** static enum x86_64_reg_class merge_class
*** 991,997 ****
#define TARGET_CANNOT_FORCE_CONST_MEM ix86_cannot_force_const_mem
#undef TARGET_DELEGITIMIZE_ADDRESS
! #define TARGET_DELEGITIMIZE_ADDRESS i386_simplify_dwarf_addr
#undef TARGET_MS_BITFIELD_LAYOUT_P
#define TARGET_MS_BITFIELD_LAYOUT_P ix86_ms_bitfield_layout_p
--- 992,998 ----
#define TARGET_CANNOT_FORCE_CONST_MEM ix86_cannot_force_const_mem
#undef TARGET_DELEGITIMIZE_ADDRESS
! #define TARGET_DELEGITIMIZE_ADDRESS ix86_delegitimize_address
#undef TARGET_MS_BITFIELD_LAYOUT_P
#define TARGET_MS_BITFIELD_LAYOUT_P ix86_ms_bitfield_layout_p
*************** ix86_find_base_term (x)
*** 5371,5377 ****
return term;
}
! term = i386_simplify_dwarf_addr (x);
if (GET_CODE (term) != SYMBOL_REF
&& GET_CODE (term) != LABEL_REF)
--- 5372,5378 ----
return term;
}
! term = ix86_delegitimize_address (x);
if (GET_CODE (term) != SYMBOL_REF
&& GET_CODE (term) != LABEL_REF)
*************** i386_output_dwarf_dtprel (file, size, x)
*** 6605,6612 ****
general assembler losage, recognize PIC+GOTOFF and turn it back
into a direct symbol reference. */
! rtx
! i386_simplify_dwarf_addr (orig_x)
rtx orig_x;
{
rtx x = orig_x, y;
--- 6606,6613 ----
general assembler losage, recognize PIC+GOTOFF and turn it back
into a direct symbol reference. */
! static rtx
! ix86_delegitimize_address (orig_x)
rtx orig_x;
{
rtx x = orig_x, y;
*************** static rtx
*** 8036,8042 ****
maybe_get_pool_constant (x)
rtx x;
{
! x = i386_simplify_dwarf_addr (XEXP (x, 0));
if (GET_CODE (x) == SYMBOL_REF && CONSTANT_POOL_ADDRESS_P (x))
return get_pool_constant (x);
--- 8037,8043 ----
maybe_get_pool_constant (x)
rtx x;
{
! x = ix86_delegitimize_address (XEXP (x, 0));
if (GET_CODE (x) == SYMBOL_REF && CONSTANT_POOL_ADDRESS_P (x))
return get_pool_constant (x);
Index: config/s390/s390.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/s390/s390.h,v
retrieving revision 1.64
diff -c -3 -p -r1.64 s390.h
*** config/s390/s390.h 31 Jan 2003 23:34:16 -0000 1.64
--- config/s390/s390.h 4 Feb 2003 03:51:17 -0000
*************** extern int flag_pic;
*** 911,920 ****
/* The LOCAL_LABEL_PREFIX variable is used by dbxelf.h. */
#define LOCAL_LABEL_PREFIX "."
- /* Either simplify a location expression, or return the original. */
- #define ASM_SIMPLIFY_DWARF_ADDR(X) \
- s390_simplify_dwarf_addr (X)
-
/* How to refer to registers in assembler output. This sequence is
indexed by compiler's hard-register-number (see above). */
#define REGISTER_NAMES \
--- 911,916 ----
Index: config/s390/s390-protos.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/s390/s390-protos.h,v
retrieving revision 1.26
diff -c -3 -p -r1.26 s390-protos.h
*** config/s390/s390-protos.h 28 Jan 2003 18:08:54 -0000 1.26
--- config/s390/s390-protos.h 4 Feb 2003 03:51:17 -0000
*************** extern void s390_output_constant_pool PA
*** 76,82 ****
extern void s390_trampoline_template PARAMS ((FILE *));
extern void s390_initialize_trampoline PARAMS ((rtx, rtx, rtx));
extern rtx s390_gen_rtx_const_DI PARAMS ((int, int));
- extern rtx s390_simplify_dwarf_addr PARAMS ((rtx));
extern void s390_machine_dependent_reorg PARAMS ((rtx));
extern int s390_agen_dep_p PARAMS ((rtx, rtx));
--- 76,81 ----
Index: config/s390/s390.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/s390/s390.c,v
retrieving revision 1.80
diff -c -3 -p -r1.80 s390.c
*** config/s390/s390.c 28 Jan 2003 18:08:54 -0000 1.80
--- config/s390/s390.c 4 Feb 2003 03:51:18 -0000
*************** static void s390_select_rtx_section PARA
*** 56,61 ****
--- 56,62 ----
static void s390_encode_section_info PARAMS ((tree, int));
static const char *s390_strip_name_encoding PARAMS ((const char *));
static bool s390_cannot_force_const_mem PARAMS ((rtx));
+ static rtx s390_delegitimize_address PARAMS ((rtx));
static void s390_init_builtins PARAMS ((void));
static rtx s390_expand_builtin PARAMS ((tree, rtx, rtx,
enum machine_mode, int));
*************** static int s390_address_cost PARAMS ((rt
*** 98,103 ****
--- 99,107 ----
#undef TARGET_CANNOT_FORCE_CONST_MEM
#define TARGET_CANNOT_FORCE_CONST_MEM s390_cannot_force_const_mem
+ #undef TARGET_DELEGITIMIZE_ADDRESS
+ #define TARGET_DELEGITIMIZE_ADDRESS s390_delegitimize_address
+
#undef TARGET_INIT_BUILTINS
#define TARGET_INIT_BUILTINS s390_init_builtins
#undef TARGET_EXPAND_BUILTIN
*************** s390_expand_cmpstr (target, op0, op1, le
*** 3056,3063 ****
general assembler losage, recognize various UNSPEC sequences
and turn them back into a direct symbol reference. */
! rtx
! s390_simplify_dwarf_addr (orig_x)
rtx orig_x;
{
rtx x = orig_x, y;
--- 3060,3067 ----
general assembler losage, recognize various UNSPEC sequences
and turn them back into a direct symbol reference. */
! static rtx
! s390_delegitimize_address (orig_x)
rtx orig_x;
{
rtx x = orig_x, y;
Roger
--
Roger Sayle, E-mail: roger@eyesopen.com
OpenEye Scientific Software, WWW: http://www.eyesopen.com/
Suite 1107, 3600 Cerrillos Road, Tel: (+1) 505-473-7385
Santa Fe, New Mexico, 87507. Fax: (+1) 505-473-0833