public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Rishi Raj <rishiraj45035@gmail.com>
To: Jan Hubicka <hubicka@ucw.cz>
Cc: rguenther@suse.de, gcc-patches@gcc.gnu.org,
	 Martin Jambor <mjambor@suse.cz>
Subject: Re: [PATCH][WIP] dwarf2out: extend to output debug section directly to object file during debug_early phase
Date: Mon, 23 Oct 2023 18:45:14 +0530	[thread overview]
Message-ID: <CA+1a67OWQi4M9a0X_FWjV1M-_53NWKEvx_m5=6f6+HE+BC-hSw@mail.gmail.com> (raw)
In-Reply-To: <ZTZrgfehZbGojGKc@kam.mff.cuni.cz>

[-- Attachment #1: Type: text/plain, Size: 2882 bytes --]

On Mon, 23 Oct 2023 at 18:18, Jan Hubicka <hubicka@ucw.cz> wrote:

> Hello,
> thanks for the patch.
>
> Overall it looks in right direction except for the code duplication in
> output_die and friends.
> > +/* Given a die and id, produce the appropriate abbreviations
> > +   directly to lto object file */
> > +
> > +static void
> > +output_die_abbrevs_to_object_file(unsigned long abbrev_id, dw_die_ref
> > abbrev)
> > +{
> > +  unsigned ix;
> > +  dw_attr_node *a_attr;
> > +
> > +  output_data_uleb128_to_object_file(abbrev_id);
> > +  output_data_uleb128_to_object_file(abbrev->die_tag);
> > +
> > +
> > +  if (abbrev->die_child != NULL)
> > +    output_data_to_object_file(1,DW_children_yes);
> > +  else
> > +    output_data_to_object_file(1,DW_children_no);
> > +
> > +  for (ix = 0; vec_safe_iterate (abbrev->die_attr, ix, &a_attr); ix++)
> > +    {
> > +      output_data_uleb128_to_object_file(a_attr->dw_attr);
> > +      output_value_format_to_object_file(a_attr);
> > +      if (value_format (a_attr) == DW_FORM_implicit_const)
> > + {
> > +  if (AT_class (a_attr) == dw_val_class_file_implicit)
> > +    {
> > +      int f = maybe_emit_file (a_attr->dw_attr_val.v.val_file);
> > + output_data_sleb128_to_object_file(f);
> > +    }
> > +  else
> > +      output_data_sleb128_to_object_file(a_attr->dw_attr_val.v.val_int);
> > + }
> > +    }
> > +
> > +  output_data_to_object_file (1, 0);
> > +  output_data_to_object_file (1, 0);
>
> So this basically renames dw2_asm_output_data to
> output_data_to_object_file and similarly for other output functions.
>
> What would be main problems of making dw2_asm_* functions to do the
> right thing when outputting to object file?
> Either by conditionals or turning them to virtual functions/hooks as
> Richi suggested?
>
I think it's doable via conditionals. Can you explain the second approach
in more detail?


>
> It may be performance critical how quickly we sput out the bytecode.
> In future we may templateize this, but right now it is likely premature
> optimization.
>
Cool.

> >
> > +struct lto_simple_object
> lto_simple_object is declared in lto frontend.  Why do you need to
> duplicate it here?
>
> It looks like adding relocations should be abstracted by lto API,
> so you don't need to look inside this structure that is
> lto/lto-object.cc only.
>
I should have taken this approach, but instead, I exposed simple objects to
dwarf2out.
That's the reason to duplicate the above struct. I will take care of this
while refactoring
and abstracting it by lto API


>
> > +/* Output one line number table into the .debug_line section.  */
> > +
> > +static void
> > +output_one_line_info_table (dw_line_info_table *table)
> It is hard to tell from the diff.  Did you just moved these functions
> earlier in source file?
>
Yeah. I will refactor the dwarf2out soon to clear these confusions.

-- 
Rishi


>
> Honza
>

  reply	other threads:[~2023-10-23 13:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-23  3:36 Rishi Raj
2023-10-23 12:48 ` Jan Hubicka
2023-10-23 13:15   ` Rishi Raj [this message]
2023-10-23 15:22     ` Jan Hubicka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CA+1a67OWQi4M9a0X_FWjV1M-_53NWKEvx_m5=6f6+HE+BC-hSw@mail.gmail.com' \
    --to=rishiraj45035@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hubicka@ucw.cz \
    --cc=mjambor@suse.cz \
    --cc=rguenther@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).