This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] More early LTO dwarf2out bits
- From: Richard Biener <rguenther at suse dot de>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 19 Sep 2017 16:09:20 +0200 (CEST)
- Subject: Re: [PATCH] More early LTO dwarf2out bits
- Authentication-results: sourceware.org; auth=none
- References: <alpine.LSU.2.11.1610130914090.26629@t29.fhfr.qr> <20170919135618.GP1701@tucnak>
On Tue, 19 Sep 2017, Jakub Jelinek wrote:
> On Thu, Oct 13, 2016 at 09:16:07AM +0200, Richard Biener wrote:
> >
> > This merges a few more bits guarding stuff with ! early_dwarf, mostly
> > to avoid creating locations that involve addresses of decls early
> > but also to avoid wasting work for BLOCK_NONLOCALIZED_VARs.
> >
> > Bootstrapped and tested on x86_64-unknown-linux-gnu, gdb testsuite
> > tested on the same arch (from the gdb 7.12 branch), applied to trunk.
> >
> > Richard.
> >
> > 2016-10-13 Richard Biener <rguenther@suse.de>
> >
> > * dwarf2out.c (tree_add_const_value_attribute): Do not try
> > rtl_for_decl_init during early phase.
> > (gen_variable_die): Do not create locations during early phase.
> > (gen_label_die): Likewise.
> > (decls_for_scope): Do not waste time handling BLOCK_NONLOCALIZED_VARs
> > twice.
>
> As Martin reported, this has very undesirable effect on the size of DWARF
> debug info.
>
> The problem is that add_const_value_attribute has lots of smarts to handle
> various kinds of constants, which the
> if (CHAR_BIT == 8 && BITS_PER_UNIT == 8
> && initializer_constant_valid_p (init, type))
> block doesn't implement, it relies on all the smarts to be done earlier.
> One option is to duplicate that all on trees, another option is
> to use the rtl_for_decl_init + add_const_value_attribute way
> even for early_dwarf for constants, something like:
>
> - if (! early_dwarf)
> + if (! early_dwarf || CONSTANT_CLASS_P (init))
> {
> rtl = rtl_for_decl_init (init, type);
> if (rtl)
> return add_const_value_attribute (die, rtl);
> }
> if (CHAR_BIT == 8 && BITS_PER_UNIT == 8
> && initializer_constant_valid_p (init, type))
If we are sure that rtl_for_decl_init will never create symbol references
for CONSTANT_CLASS_P (init) that's fine, but yes, in the end it would be
nice to not have overlapping rtl/tree handling and have all constants
handled in the tree path...
Richard.
> For the duplicate on trees, some cases might not be that hard, like
> handling of INTEGER_CSTs, just see if they are negative and fit into shwi,
> (then add_AT_int), or fit into uhwi (then add_AT_unsigned); maybe that
> would be enough for now.
>
> > --- gcc/dwarf2out.c (revision 241022)
> > +++ gcc/dwarf2out.c (working copy)
> > @@ -17958,12 +17958,15 @@ tree_add_const_value_attribute (dw_die_r
> > init = t;
> > gcc_assert (!DECL_P (init));
> >
> > - rtl = rtl_for_decl_init (init, type);
> > - if (rtl)
> > - return add_const_value_attribute (die, rtl);
> > + if (! early_dwarf)
> > + {
> > + rtl = rtl_for_decl_init (init, type);
> > + if (rtl)
> > + return add_const_value_attribute (die, rtl);
> > + }
> > /* If the host and target are sane, try harder. */
> > - else if (CHAR_BIT == 8 && BITS_PER_UNIT == 8
> > - && initializer_constant_valid_p (init, type))
> > + if (CHAR_BIT == 8 && BITS_PER_UNIT == 8
> > + && initializer_constant_valid_p (init, type))
> > {
> > HOST_WIDE_INT size = int_size_in_bytes (TREE_TYPE (init));
> > if (size > 0 && (int) size == size)
>
> Jakub
>
>
--
Richard Biener <rguenther@suse.de>
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)