dwarf2out.c: include "varray.h", not dyn-string.h.

* dwarf2out.c: include "varray.h", not dyn-string.h.
        (ASM_OUTPUT_DWARF2_ADDR_CONST, ASM_NAME_TO_STRING): Lose.
        (addr_const_to_string, addr_to_string): Lose.
        (ASM_OUTPUT_DWARF_ADDR_CONST): Copy from dwarfout.c.
        (struct dw_val_struct): val_addr is now an rtx.
        (add_AT_addr, AT_addr, free_AT, output_aranges): Adjust.
        (used_rtx_varray): New varray.
        (dwarf2out_init): Initialize it.
        (save_rtx): New fn.
        (mem_loc_descriptor, add_const_value_attribute): Call it instead of
        addr_to_string.
        * arm/telf.h, arm/unknown-elf.h, mn10200.h, mn10300.h,
        sparc/sp64-elf.h: Remove definition of ASM_OUTPUT_DWARF2_ADDR_CONST.
        * Makefile.in (dwarf2out.o): Update dependencies.

        * i386.c (i386_dwarf_output_addr_const): New.
        * i386.h (ASM_OUTPUT_DWARF_ADDR_CONST): New.

        * dwarf2out.c (mem_loc_descriptor): Call ASM_SIMPLIFY_DWARF_ADDR
        if defined.
        * dwarfout.c (output_mem_loc_descriptor): Likewise.
        * i386.c (i386_simplify_dwarf_addr): New.
        * i386.h (ASM_SIMPLIFY_DWARF_ADDR): New.

From-SVN: r31602
This commit is contained in:
Jason Merrill 2000-01-25 00:59:18 -05:00
parent 7610f2ce1b
commit 1865dbb5e2
12 changed files with 140 additions and 197 deletions

View file

@ -1,3 +1,31 @@
2000-01-24 Jason Merrill <jason@casey.cygnus.com>
* dwarf2out.c: include "varray.h", not dyn-string.h.
(ASM_OUTPUT_DWARF2_ADDR_CONST, ASM_NAME_TO_STRING): Lose.
(addr_const_to_string, addr_to_string): Lose.
(ASM_OUTPUT_DWARF_ADDR_CONST): Copy from dwarfout.c.
(struct dw_val_struct): val_addr is now an rtx.
(add_AT_addr, AT_addr, free_AT, output_aranges): Adjust.
(used_rtx_varray): New varray.
(dwarf2out_init): Initialize it.
(save_rtx): New fn.
(mem_loc_descriptor, add_const_value_attribute): Call it instead of
addr_to_string.
* arm/telf.h, arm/unknown-elf.h, mn10200.h, mn10300.h,
sparc/sp64-elf.h: Remove definition of ASM_OUTPUT_DWARF2_ADDR_CONST.
* Makefile.in (dwarf2out.o): Update dependencies.
2000-01-24 Richard Henderson <rth@cygnus.com>
* i386.c (i386_dwarf_output_addr_const): New.
* i386.h (ASM_OUTPUT_DWARF_ADDR_CONST): New.
* dwarf2out.c (mem_loc_descriptor): Call ASM_SIMPLIFY_DWARF_ADDR
if defined.
* dwarfout.c (output_mem_loc_descriptor): Likewise.
* i386.c (i386_simplify_dwarf_addr): New.
* i386.h (ASM_SIMPLIFY_DWARF_ADDR): New.
Mon Jan 24 16:56:10 2000 Jim Wilson <wilson@cygnus.com>
* dwarf2out.c (gen_struct_or_union_type_die): Set complete if

View file

@ -1532,7 +1532,7 @@ dwarfout.o : dwarfout.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) dwarf.h \
flags.h insn-config.h reload.h output.h defaults.h toplev.h dwarfout.h
dwarf2out.o : dwarf2out.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) dwarf2.h \
flags.h insn-config.h reload.h output.h defaults.h \
hard-reg-set.h $(REGS_H) $(EXPR_H) toplev.h dwarf2out.h dyn-string.h \
hard-reg-set.h $(REGS_H) $(EXPR_H) toplev.h dwarf2out.h varray.h \
ggc.h except.h
xcoffout.o : xcoffout.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) xcoffout.h \
flags.h toplev.h output.h dbxout.h ggc.h

View file

@ -1,6 +1,6 @@
/* Definitions of target machine for GNU compiler,
for Thumb with ELF obj format.
Copyright (C) 1995, 1996, 1999 Free Software Foundation, Inc.
Copyright (C) 1995, 1996, 1999, 2000 Free Software Foundation, Inc.
This file is part of GNU CC.
@ -141,13 +141,6 @@ extern int arm_structure_size_boundary;
dwarf2.out. */
#define UNALIGNED_WORD_ASM_OP ".4byte"
#define ASM_OUTPUT_DWARF2_ADDR_CONST(FILE,ADDR) \
if (((ADDR)[0] == '.') && ((ADDR)[1] == 'L')) \
fprintf ((FILE), "\t%s\t%s", UNALIGNED_WORD_ASM_OP, (ADDR)); \
else \
fprintf ((FILE), "\t%s\t%s", \
UNALIGNED_WORD_ASM_OP, (ADDR))
#define ASM_OUTPUT_DWARF_ADDR_CONST(FILE,RTX) \
do \
{ \

View file

@ -1,5 +1,5 @@
/* Definitions for non-Linux based ARM systems using ELF
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
Contributed by Catherine Moore <clm@cygnus.com>
This file is part of GNU CC.
@ -107,9 +107,6 @@ func_ptr __DTOR_END__[1] = { (func_ptr) 0 };
dwarf2.out. */
#define UNALIGNED_WORD_ASM_OP ".4byte"
#define ASM_OUTPUT_DWARF2_ADDR_CONST(FILE,ADDR) \
fprintf ((FILE), "\t%s\t%s", UNALIGNED_WORD_ASM_OP, ADDR)
#define ASM_OUTPUT_DWARF_ADDR_CONST(FILE,RTX) \
do { \
fprintf ((FILE), "\t%s\t", UNALIGNED_WORD_ASM_OP); \

View file

@ -82,6 +82,9 @@ extern const char *output_387_binary_op PARAMS ((rtx, rtx*));
extern const char *output_fix_trunc PARAMS ((rtx, rtx*));
extern const char *output_fp_compare PARAMS ((rtx, rtx*, int, int));
extern void i386_dwarf_output_addr_const PARAMS ((FILE*, rtx));
extern rtx i386_simplify_dwarf_addr PARAMS ((rtx));
extern void ix86_expand_move PARAMS ((enum machine_mode, rtx[]));
extern void ix86_expand_binary_operator PARAMS ((enum rtx_code,
enum machine_mode, rtx[]));

View file

@ -2818,6 +2818,51 @@ output_pic_addr_const (file, x, code)
output_operand_lossage ("invalid expression as operand");
}
}
/* This is called from dwarfout.c via ASM_OUTPUT_DWARF_ADDR_CONST.
We need to handle our special PIC relocations. */
void
i386_dwarf_output_addr_const (file, x)
FILE *file;
rtx x;
{
fprintf (file, "\t%s\t", INT_ASM_OP);
if (flag_pic)
output_pic_addr_const (file, x, '\0');
else
output_addr_const (file, x);
fputc ('\n', file);
}
/* In the name of slightly smaller debug output, and to cater to
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;
if (GET_CODE (x) != PLUS
|| GET_CODE (XEXP (x, 0)) != REG
|| GET_CODE (XEXP (x, 1)) != CONST)
return orig_x;
x = XEXP (XEXP (x, 1), 0);
if (GET_CODE (x) == UNSPEC
&& XINT (x, 1) == 7)
return XVECEXP (x, 0, 0);
if (GET_CODE (x) == PLUS
&& GET_CODE (XEXP (x, 0)) == UNSPEC
&& GET_CODE (XEXP (x, 1)) == CONST_INT
&& XINT (XEXP (x, 0), 1) == 7)
return gen_rtx_PLUS (VOIDmode, XVECEXP (XEXP (x, 0), 0, 0), XEXP (x, 1));
return orig_x;
}
static void
put_condition_code (code, mode, reverse, fp, file)

View file

@ -2309,6 +2309,17 @@ do { long l; \
#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
fprintf (FILE, "\t%s\t%s%d-%s%d\n",ASM_LONG, LPREFIX, VALUE, LPREFIX, REL)
/* A C statement that outputs an address constant appropriate to
for DWARF debugging. */
#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)
/* Define the parentheses used to group arithmetic operations
in assembler code. */

View file

@ -981,10 +981,6 @@ do { char dstr[30]; \
((GET_CODE (X) == PLUS ? OFFSET : 0) \
+ (frame_pointer_needed ? 0 : -total_frame_size ()))
/* We need to prepend underscores. */
#define ASM_OUTPUT_DWARF2_ADDR_CONST(FILE,ADDR) \
fprintf ((FILE), "\t%s\t_%s", UNALIGNED_WORD_ASM_OP, (ADDR))
/* Define to use software floating point emulator for REAL_ARITHMETIC and
decimal <-> binary conversion. */
#define REAL_ARITHMETIC

View file

@ -1028,10 +1028,6 @@ do { char dstr[30]; \
+ (frame_pointer_needed \
? 0 : -initial_offset (ARG_POINTER_REGNUM, STACK_POINTER_REGNUM)))
/* We need to prepend underscores. */
#define ASM_OUTPUT_DWARF2_ADDR_CONST(FILE,ADDR) \
fprintf ((FILE), "\t%s\t_%s", UNALIGNED_WORD_ASM_OP, (ADDR))
/* Define to use software floating point emulator for REAL_ARITHMETIC and
decimal <-> binary conversion. */
#define REAL_ARITHMETIC

View file

@ -1,5 +1,5 @@
/* Definitions of target machine for GNU compiler, for SPARC64, ELF.
Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
Copyright (C) 1994, 95, 96, 97, 98, 2000 Free Software Foundation, Inc.
Contributed by Doug Evans, dje@cygnus.com.
This file is part of GNU CC.
@ -146,9 +146,6 @@ do { \
fputc ('\n', (FILE)); \
} while (0)
#define ASM_OUTPUT_DWARF2_ADDR_CONST(FILE, ADDR) \
fprintf ((FILE), "\t%s\t%s", UNALIGNED_LONGLONG_ASM_OP, (ADDR))
/* ??? Not sure if this should be 4 or 8 bytes. 4 works for now. */
#define ASM_OUTPUT_DWARF_REF(FILE, LABEL) \
do { \

View file

@ -53,7 +53,7 @@ Boston, MA 02111-1307, USA. */
#include "dwarf2.h"
#include "dwarf2out.h"
#include "toplev.h"
#include "dyn-string.h"
#include "varray.h"
#include "ggc.h"
#include "tm_p.h"
@ -357,19 +357,13 @@ static void dwarf2out_frame_debug_expr PARAMS ((rtx, char *));
} while (0)
#endif
/* ??? This macro takes an RTX in dwarfout.c and a string in dwarf2out.c.
We resolve the conflict by creating a new macro ASM_OUTPUT_DWARF2_ADDR_CONST
for ports that want to support both DWARF1 and DWARF2. This needs a better
solution. See also the comments in sparc/sp64-elf.h. */
#ifdef ASM_OUTPUT_DWARF2_ADDR_CONST
#undef ASM_OUTPUT_DWARF_ADDR_CONST
#define ASM_OUTPUT_DWARF_ADDR_CONST(FILE,ADDR) \
ASM_OUTPUT_DWARF2_ADDR_CONST (FILE, ADDR)
#endif
#ifndef ASM_OUTPUT_DWARF_ADDR_CONST
#define ASM_OUTPUT_DWARF_ADDR_CONST(FILE,ADDR) \
fprintf ((FILE), "\t%s\t%s", UNALIGNED_WORD_ASM_OP, (ADDR))
#define ASM_OUTPUT_DWARF_ADDR_CONST(FILE,RTX) \
do { \
fprintf ((FILE), "\t%s\t", UNALIGNED_INT_ASM_OP); \
output_addr_const ((FILE), (RTX)); \
fputc ('\n', (FILE)); \
} while (0)
#endif
#ifndef ASM_OUTPUT_DWARF_OFFSET4
@ -2025,7 +2019,7 @@ typedef struct dw_val_struct
dw_val_class val_class;
union
{
char *val_addr;
rtx val_addr;
dw_loc_descr_ref val_loc;
long int val_int;
long unsigned val_unsigned;
@ -2330,10 +2324,14 @@ static int current_function_has_inlines;
static int comp_unit_has_inlines;
#endif
/* Array of RTXes referenced by the debugging information, which therefore
must be kept around forever. We do this rather than perform GC on
the dwarf info because almost all of the dwarf info lives forever, and
it's easier to support non-GC frontends this way. */
static varray_type used_rtx_varray;
/* Forward declarations for functions defined in this file. */
static void addr_const_to_string PARAMS ((dyn_string_t, rtx));
static char *addr_to_string PARAMS ((rtx));
static int is_pseudo_reg PARAMS ((rtx));
static tree type_main_variant PARAMS ((tree));
static int is_tagged_type PARAMS ((tree));
@ -2377,7 +2375,7 @@ static void add_AT_loc PARAMS ((dw_die_ref,
dw_loc_descr_ref));
static void add_AT_addr PARAMS ((dw_die_ref,
enum dwarf_attribute,
char *));
rtx));
static void add_AT_lbl_id PARAMS ((dw_die_ref,
enum dwarf_attribute,
char *));
@ -2614,25 +2612,6 @@ static char debug_line_section_label[MAX_ARTIFICIAL_LABEL_BYTES];
#ifndef SEPARATE_LINE_CODE_LABEL
#define SEPARATE_LINE_CODE_LABEL "LSM"
#endif
/* Convert a reference to the assembler name of a C-level name. This
macro has the same effect as ASM_OUTPUT_LABELREF, but copies to
a string rather than writing to a file. */
#ifndef ASM_NAME_TO_STRING
#define ASM_NAME_TO_STRING(STR, NAME) \
do { \
if ((NAME)[0] == '*') \
dyn_string_append (STR, NAME + 1); \
else \
{ \
const char *newstr; \
STRIP_NAME_ENCODING (newstr, NAME); \
dyn_string_append (STR, user_label_prefix); \
dyn_string_append (STR, newstr); \
} \
} \
while (0)
#endif
/* We allow a language front-end to designate a function that is to be
called to "demangle" any name before it it put into a DIE. */
@ -2646,141 +2625,25 @@ dwarf2out_set_demangle_name_func (func)
demangle_name_func = func;
}
/* Convert an integer constant expression into assembler syntax. Addition
and subtraction are the only arithmetic that may appear in these
expressions. This is an adaptation of output_addr_const in final.c.
Here, the target of the conversion is a string buffer. We can't use
output_addr_const directly, because it writes to a file. */
/* Return an rtx like ORIG which lives forever. If we're doing GC,
that means adding it to used_rtx_varray. If not, that means making
a copy on the permanent_obstack. */
static void
addr_const_to_string (str, x)
dyn_string_t str;
rtx x;
static rtx
save_rtx (orig)
register rtx orig;
{
char buf1[256];
restart:
switch (GET_CODE (x))
if (ggc_p)
VARRAY_PUSH_RTX (used_rtx_varray, orig);
else
{
case PC:
if (flag_pic)
dyn_string_append (str, ",");
else
abort ();
break;
case SYMBOL_REF:
ASM_NAME_TO_STRING (str, XSTR (x, 0));
break;
case LABEL_REF:
ASM_GENERATE_INTERNAL_LABEL (buf1, "L", CODE_LABEL_NUMBER (XEXP (x, 0)));
ASM_NAME_TO_STRING (str, buf1);
break;
case CODE_LABEL:
ASM_GENERATE_INTERNAL_LABEL (buf1, "L", CODE_LABEL_NUMBER (x));
ASM_NAME_TO_STRING (str, buf1);
break;
case CONST_INT:
sprintf (buf1, HOST_WIDE_INT_PRINT_DEC, INTVAL (x));
dyn_string_append (str, buf1);
break;
case CONST:
/* This used to output parentheses around the expression, but that does
not work on the 386 (either ATT or BSD assembler). */
addr_const_to_string (str, XEXP (x, 0));
break;
case CONST_DOUBLE:
if (GET_MODE (x) == VOIDmode)
{
/* We can use %d if the number is one word and positive. */
if (CONST_DOUBLE_HIGH (x))
sprintf (buf1, HOST_WIDE_INT_PRINT_DOUBLE_HEX,
CONST_DOUBLE_HIGH (x), CONST_DOUBLE_LOW (x));
else if (CONST_DOUBLE_LOW (x) < 0)
sprintf (buf1, HOST_WIDE_INT_PRINT_HEX, CONST_DOUBLE_LOW (x));
else
sprintf (buf1, HOST_WIDE_INT_PRINT_DEC,
CONST_DOUBLE_LOW (x));
dyn_string_append (str, buf1);
}
else
/* We can't handle floating point constants; PRINT_OPERAND must
handle them. */
output_operand_lossage ("floating constant misused");
break;
case PLUS:
/* Some assemblers need integer constants to appear last (eg masm). */
if (GET_CODE (XEXP (x, 0)) == CONST_INT)
{
addr_const_to_string (str, XEXP (x, 1));
if (INTVAL (XEXP (x, 0)) >= 0)
dyn_string_append (str, "+");
addr_const_to_string (str, XEXP (x, 0));
}
else
{
addr_const_to_string (str, XEXP (x, 0));
if (INTVAL (XEXP (x, 1)) >= 0)
dyn_string_append (str, "+");
addr_const_to_string (str, XEXP (x, 1));
}
break;
case MINUS:
/* Avoid outputting things like x-x or x+5-x, since some assemblers
can't handle that. */
x = simplify_subtraction (x);
if (GET_CODE (x) != MINUS)
goto restart;
addr_const_to_string (str, XEXP (x, 0));
dyn_string_append (str, "-");
if (GET_CODE (XEXP (x, 1)) == CONST_INT
&& INTVAL (XEXP (x, 1)) < 0)
{
dyn_string_append (str, ASM_OPEN_PAREN);
addr_const_to_string (str, XEXP (x, 1));
dyn_string_append (str, ASM_CLOSE_PAREN);
}
else
addr_const_to_string (str, XEXP (x, 1));
break;
case ZERO_EXTEND:
case SIGN_EXTEND:
addr_const_to_string (str, XEXP (x, 0));
break;
default:
output_operand_lossage ("invalid expression as operand");
push_obstacks_nochange ();
end_temporary_allocation ();
orig = copy_rtx (orig);
pop_obstacks ();
}
}
/* Convert an address constant to a string, and return a pointer to
a copy of the result, located on the heap. */
static char *
addr_to_string (x)
rtx x;
{
dyn_string_t ds = dyn_string_new (256);
char *s;
addr_const_to_string (ds, x);
/* Return the dynamically allocated string, but free the
dyn_string_t itself. */
s = ds->s;
free (ds);
return s;
return orig;
}
/* Test if rtl node points to a pseudo register. */
@ -3837,7 +3700,7 @@ static inline void
add_AT_addr (die, attr_kind, addr)
register dw_die_ref die;
register enum dwarf_attribute attr_kind;
char *addr;
rtx addr;
{
register dw_attr_ref attr = (dw_attr_ref) xmalloc (sizeof (dw_attr_node));
@ -3848,7 +3711,7 @@ add_AT_addr (die, attr_kind, addr)
add_dwarf_attr (die, attr);
}
static inline const char *
static inline rtx
AT_addr (a)
register dw_attr_ref a;
{
@ -4029,7 +3892,6 @@ free_AT (a)
{
switch (AT_class (a))
{
case dw_val_class_addr:
case dw_val_class_str:
case dw_val_class_lbl_id:
case dw_val_class_lbl_offset:
@ -5533,7 +5395,8 @@ output_aranges ()
if (loc->dw_loc_opc != DW_OP_addr)
abort ();
ASM_OUTPUT_DWARF_ADDR (asm_out_file, loc->dw_loc_oprnd1.v.val_addr);
ASM_OUTPUT_DWARF_ADDR_CONST (asm_out_file,
loc->dw_loc_oprnd1.v.val_addr);
}
if (flag_debug_asm)
@ -6433,6 +6296,10 @@ mem_loc_descriptor (rtl, mode)
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))
{
case POST_INC:
@ -6482,7 +6349,7 @@ mem_loc_descriptor (rtl, mode)
case SYMBOL_REF:
mem_loc_result = new_loc_descr (DW_OP_addr, 0, 0);
mem_loc_result->dw_loc_oprnd1.val_class = dw_val_class_addr;
mem_loc_result->dw_loc_oprnd1.v.val_addr = addr_to_string (rtl);
mem_loc_result->dw_loc_oprnd1.v.val_addr = save_rtx (rtl);
break;
case PRE_INC:
@ -6942,7 +6809,7 @@ add_const_value_attribute (die, rtl)
case SYMBOL_REF:
case LABEL_REF:
case CONST:
add_AT_addr (die, DW_AT_const_value, addr_to_string (rtl));
add_AT_addr (die, DW_AT_const_value, save_rtx (rtl));
break;
case PLUS:
@ -9959,6 +9826,12 @@ dwarf2out_init (asm_out_file, main_input_filename)
invoked when the given (base) source file was compiled. */
comp_unit_die = gen_compile_unit_die (main_input_filename);
if (ggc_p)
{
VARRAY_RTX_INIT (used_rtx_varray, 32, "used_rtx_varray");
ggc_add_tree_varray_root (&used_rtx_varray, 1);
}
ASM_GENERATE_INTERNAL_LABEL (text_end_label, TEXT_END_LABEL, 0);
ASM_GENERATE_INTERNAL_LABEL (abbrev_section_label, ABBREV_SECTION_LABEL, 0);
if (DWARF2_GENERATE_TEXT_SECTION_LABEL)

View file

@ -1715,6 +1715,10 @@ output_mem_loc_descriptor (rtl)
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))
{
case SUBREG: